From aa5e68ab3f8d85fc95fb0ccfd0f218912d921d79 Mon Sep 17 00:00:00 2001 From: dbfreem Date: Sun, 8 Nov 2026 16:00:14 -0500 Subject: [PATCH 1/3] Add print PDF build make book.pdf builds a print layout with asciidoctor-pdf. Page size and margins are in themes/print-theme.yml. Also fix the 9image1 reference (file is .PNG) and ignore *.pdf. --- .gitignore | 1 + Makefile | 11 ++++++++++- README.md | 19 +++++++++++++++++++ chapters/assembly.adoc | 2 +- themes/print-theme.yml | 10 ++++++++++ 5 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 themes/print-theme.yml diff --git a/.gitignore b/.gitignore index ae55bc4..003c041 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ *~ *.html *.docx +*.pdf *Zone.Identifier *.bak 51.txt diff --git a/Makefile b/Makefile index ab29a0e..0b8a978 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,14 @@ 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-themesdir=themes \ + -a pdf-theme=print \ + book.adoc + clean : - rm book.html *~ + rm $(wildcard book.html book.pdf *~) diff --git a/README.md b/README.md index 432c9d7..8a07972 100644 --- a/README.md +++ b/README.md @@ -71,6 +71,25 @@ 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: +6x9in pages, facing-page margins, and chapters starting on a right-hand page. +Page size, margins and fonts are set in `themes/print-theme.yml`. + +``` +$ make book.pdf +``` + +This needs [asciidoctor-pdf](https://github.com/asciidoctor/asciidoctor-pdf). +On Ubuntu/Debian: + +``` +$ sudo apt-get install asciidoctor ruby-asciidoctor-pdf +``` + +Code coloring works the same as the HTML build: it uses `pygments.rb` if installed. + ## Deploy diff --git a/chapters/assembly.adoc b/chapters/assembly.adoc index f4a090c..41b973c 100644 --- a/chapters/assembly.adoc +++ b/chapters/assembly.adoc @@ -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: diff --git a/themes/print-theme.yml b/themes/print-theme.yml new file mode 100644 index 0000000..d82134e --- /dev/null +++ b/themes/print-theme.yml @@ -0,0 +1,10 @@ +extends: default +page: + size: [6in, 9in] + 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 From e72d5cac5ac6700c28b15cda942f8d553a8c5be0 Mon Sep 17 00:00:00 2001 From: dbfreem Date: Sun, 8 Nov 2026 16:18:57 -0500 Subject: [PATCH 2/3] Made the page size configurable --- Makefile | 3 +++ README.md | 11 +++++++++-- themes/print-theme.yml | 1 - 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 0b8a978..ccc3a80 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,5 @@ +PAGE_SIZE = Letter + book.html : asciidoctor -a toc=left book.adoc @@ -6,6 +8,7 @@ book.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 diff --git a/README.md b/README.md index 8a07972..371f175 100644 --- a/README.md +++ b/README.md @@ -74,13 +74,20 @@ $ make ### Print PDF The following line compiles `book.adoc` into `book.pdf`, laid out for printing: -6x9in pages, facing-page margins, and chapters starting on a right-hand page. -Page size, margins and fonts are set in `themes/print-theme.yml`. +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). On Ubuntu/Debian: diff --git a/themes/print-theme.yml b/themes/print-theme.yml index d82134e..cedf55e 100644 --- a/themes/print-theme.yml +++ b/themes/print-theme.yml @@ -1,6 +1,5 @@ extends: default page: - size: [6in, 9in] margin: [0.75in, 0.625in, 0.75in, 0.625in] margin_inner: 0.875in margin_outer: 0.625in From 08ab03583330772e0fdb23c49177bb94956ba9f6 Mon Sep 17 00:00:00 2001 From: dbfreem Date: Sun, 8 Nov 2026 16:25:29 -0500 Subject: [PATCH 3/3] remove ubuntu reference from the README --- README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/README.md b/README.md index 371f175..83e46df 100644 --- a/README.md +++ b/README.md @@ -89,11 +89,7 @@ $ make book.pdf "PAGE_SIZE=[6in, 9in]" ``` This needs [asciidoctor-pdf](https://github.com/asciidoctor/asciidoctor-pdf). -On Ubuntu/Debian: -``` -$ sudo apt-get install asciidoctor ruby-asciidoctor-pdf -``` Code coloring works the same as the HTML build: it uses `pygments.rb` if installed.