summaryrefslogtreecommitdiff
path: root/boot/test.asm
diff options
context:
space:
mode:
authorMichal Idziorek <m.i@gmx.at>2014-08-19 09:25:44 +0200
committerMichal Idziorek <m.i@gmx.at>2014-08-19 09:25:44 +0200
commitae38fa16c1ee45ccd9acb4a91ad9ccf01955f6a6 (patch)
treedc2352a23c1721f786aa0d1218a6376d84dc5803 /boot/test.asm
parentaaede87d03f4ee05d32fe89f89da70c1436a5001 (diff)
Added minimal mbr for testing
Diffstat (limited to 'boot/test.asm')
-rw-r--r--boot/test.asm48
1 files changed, 48 insertions, 0 deletions
diff --git a/boot/test.asm b/boot/test.asm
new file mode 100644
index 0000000..62110b6
--- /dev/null
+++ b/boot/test.asm
@@ -0,0 +1,48 @@
+[org 0x7c00]
+
+[bits 16]
+jmp boot_16 ;start boot process
+
+STR_VERSION:
+
+ db "FoolOs~",0
+
+;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
+
+boot_16:
+
+ mov bx, STR_VERSION
+ call print_string
+
+ jmp boot_16
+
+times 510-($-$$) db 0
+dw 0xaa55
+
+
+