summaryrefslogtreecommitdiff
path: root/boot
diff options
context:
space:
mode:
Diffstat (limited to 'boot')
-rw-r--r--boot/mbr.asm37
1 files changed, 35 insertions, 2 deletions
diff --git a/boot/mbr.asm b/boot/mbr.asm
index d4dcbe5..a9c26f7 100644
--- a/boot/mbr.asm
+++ b/boot/mbr.asm
@@ -26,8 +26,8 @@ KERNEL_OFFSET equ 0x1000
jmp boot_16 ;start boot process
;SOME Global Data, mainly strings
-;STR_VERSION:
-; db "v0.2~",0
+STR_VERSION:
+ db "v0.2~",0
;STR_PROT:
; db "32-bit PM",0
;STR_LOADED:
@@ -57,8 +57,41 @@ BOOT_DRIVE:
;lets start
[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
+
+
+
boot_16:
+ mov bx, STR_VERSION
+ call print_string
+
;setup the stack
mov bp,0x8000
mov sp,bp