summaryrefslogtreecommitdiffstats
path: root/arch/x86/boot/bootloader/bios.inc
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/boot/bootloader/bios.inc')
-rw-r--r--arch/x86/boot/bootloader/bios.inc20
1 files changed, 20 insertions, 0 deletions
diff --git a/arch/x86/boot/bootloader/bios.inc b/arch/x86/boot/bootloader/bios.inc
new file mode 100644
index 0000000..19cd9a0
--- /dev/null
+++ b/arch/x86/boot/bootloader/bios.inc
@@ -0,0 +1,20 @@
+# CONVENTION: macro only uses %AX, %SI registers
+.macro BIOS_PRINT string
+ mov $0x0e, %ah # Set writing char in TTY mode routine
+ mov \string, %si # Set in Source Index reg the beginning
+ # address of a string
+print_loop\@:
+ lodsb # Increase SI by 1 byte => get next char
+ or %al, %al # Check for a '\0'
+ jz print_done\@
+
+ int $0x10 # Print a char in al register
+ jmp print_loop\@
+print_done\@:
+.endm
+
+.macro PUTCHAR char
+ mov $0x0e, %ah # Set writing char in TTY mode routine
+ mov \char, %al
+ int $0x10 # Print a char in al register
+.endm