Printing to the screen without a db: Difference between revisions
[unchecked revision] | [unchecked revision] |
Content deleted Content added
mNo edit summary |
m Bot: Replace deprecated source tag with syntaxhighlight |
||
Line 3:
Note: this macro is designed to be used in [[real mode]] only, since it uses [[BIOS]] functions.
<
print_string: ; Null terminated string in SI.
pusha ; Push all registers
Line 30:
call print_string ; Print it out using the print_string function.
%endmacro
</syntaxhighlight>
Now you can use '''print''' as if it were a function or instruction in your OS like so (note, you don't want to use this in a bootloader, it messes with the data section and I don't know how to place the boot signature at the end of the data section and still pad out to 512 bytes):
<
print 'Printing without a db in NASM!',0Dh,0Ah ; Print out a little message!
</syntaxhighlight>
By the way, a little feature of NASM is the usage of the ` (back quote) character to contain a string that can use C-style escape codes like \n. It's nice and helpful.
|