summaryrefslogtreecommitdiff
path: root/boot/print_string_16.asm
diff options
context:
space:
mode:
authorMichal Idziorek <m.i@gmx.at>2014-08-27 14:43:16 +0200
committerMichal Idziorek <m.i@gmx.at>2014-08-27 14:43:16 +0200
commit62c211ade1606d82f9b262b68ef074ae07e26184 (patch)
treec819565b6f22f75b35fedec6e6eb5e0ec200c5d9 /boot/print_string_16.asm
parent2d20d0d1f720e064b29aa3578aa33b5146a954e5 (diff)
boot directory cleanup continued
Diffstat (limited to 'boot/print_string_16.asm')
-rw-r--r--boot/print_string_16.asm28
1 files changed, 28 insertions, 0 deletions
diff --git a/boot/print_string_16.asm b/boot/print_string_16.asm
new file mode 100644
index 0000000..5d8ad5c
--- /dev/null
+++ b/boot/print_string_16.asm
@@ -0,0 +1,28 @@
+[bits 16]
+
+;print_string routine ([bx])
+;this routine will print a null terminated string at [bx] to the screen.
+print_string:
+
+ pusha ;push all registers
+ mov ah,0x0e
+
+ print_string_loop:
+
+ ;check if value at [bx] is "\0" (end of string)
+ mov cl,[bx]
+ cmp cl,0
+ je print_string_finish
+
+ ;otherwise instruct BIOS to print the current char
+ mov al,cl
+ int 0x10
+
+ ;proceed with next char
+ inc bx
+ jmp print_string_loop
+
+ print_string_finish:
+
+ popa ;pop all registers
+ ret ;return to caller