lesson 5 with hex printer

This commit is contained in:
Carlos Fenollosa
2014-10-05 20:12:33 +02:00
parent fc73be819b
commit 545546ce5e
3 changed files with 38 additions and 12 deletions

View File

@@ -110,15 +110,26 @@ The syntax is
%include "file.asm"
```
Printing hex values
-------------------
In the next lesson we will start reading from disk, so we need some way
to make sure that we are reading the correct data. File `boot_sect_print_hex.asm`
extends `boot_sect_print.asm` to print hex bytes, not just ASCII chars.
Code!
-----
Let's jump to the code. File `boot_sect_print.asm` is the subroutine which will
get `%include`d in the main file. It uses a loop to print bytes on screen.
The main file `boot_sect_main.asm` loads a couple strings, calls `print` and hangs. If you understood
the previous sections, it's quite straightforward.
As a last goodie, we will learn how to print newlines. The familiar `'\n'` is
It also includes a function to print a newline. The familiar `'\n'` is
actually two bytes, the newline char `0x0A` and a carriage return `0x0D`. Please
experiment by removing the carriage return char and see its effect.
As stated above, `boot_sect_print_hex.asm` allows for printing of bytes.
The main file `boot_sect_main.asm` loads a couple strings and bytes,
calls `print` and `print_hex` and hangs. If you understood
the previous sections, it's quite straightforward.