Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
*~
*.html
*.docx
*.pdf
*Zone.Identifier
*.bak
51.txt
Expand Down
14 changes: 13 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
PAGE_SIZE = Letter

book.html :
asciidoctor -a toc=left book.adoc

book.pdf :
asciidoctor -r asciidoctor-pdf -b pdf \
-a doctype=book \
-a toc \
-a media=prepress \
-a pdf-page-size="$(PAGE_SIZE)" \
-a pdf-themesdir=themes \
-a pdf-theme=print \
book.adoc

clean :
rm book.html *~
rm $(wildcard book.html book.pdf *~)
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,28 @@ The following line compiles `book.adoc` into `book.html` with a table of content
$ make
```

### Print PDF

The following line compiles `book.adoc` into `book.pdf`, laid out for printing:
facing-page margins and chapters starting on a right-hand page.
Margins and fonts are set in `themes/print-theme.yml`.

```
$ make book.pdf
```

Pages are US Letter by default. Set `PAGE_SIZE` for another size:

```
$ make book.pdf PAGE_SIZE=A4
$ make book.pdf "PAGE_SIZE=[6in, 9in]"
```

This needs [asciidoctor-pdf](https://github.com/asciidoctor/asciidoctor-pdf).


Code coloring works the same as the HTML build: it uses `pygments.rb` if installed.


## Deploy

Expand Down
2 changes: 1 addition & 1 deletion chapters/assembly.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ The piece of memory in which are stored the variables of a function is called th

[.text-center]
.Stack frame of func2
image::images/9image1.png[]
image::images/9image1.PNG[]

If we want to access the value of var6, we do rbp minus 3. Note that if we subtract three positions from rbp, we would be pointing to var6. As you can see, accessing variables in assembly is not complicated, we just need to subtract from rbp some positions to point to the variable we want. However, we just have one register in the processor to keep the value of the base pointer. So, what we do, is pushing into memory the value of the base pointer from the previous function. That is the “rbp func1” that you see in the memory from the previous image. We store the rbp from a previous function, as we store a local variable, to be able to recover it later when we come back to func1 and be able to access the variable from func1. We explained all that to point out what was this line for:

Expand Down
9 changes: 9 additions & 0 deletions themes/print-theme.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
extends: default
page:
margin: [0.75in, 0.625in, 0.75in, 0.625in]
margin_inner: 0.875in
margin_outer: 0.625in
base:
font_size: 10
code:
font_size: 8