summaryrefslogtreecommitdiff
path: root/src/stage2_functions.asm
diff options
context:
space:
mode:
Diffstat (limited to 'src/stage2_functions.asm')
-rw-r--r--src/stage2_functions.asm31
1 files changed, 16 insertions, 15 deletions
diff --git a/src/stage2_functions.asm b/src/stage2_functions.asm
index 2954d62..61a574c 100644
--- a/src/stage2_functions.asm
+++ b/src/stage2_functions.asm
@@ -22,13 +22,13 @@ pm_print_newline:
; IN si
pm_print_string:
push eax
-_loop_pm_print_string:
+.loop:
lodsb
cmp al, 0
- je pm_print_string_fini
+ je .fini
call pm_print_char
- jmp _loop_pm_print_string
-pm_print_string_fini:
+ jmp .loop
+.fini:
pop eax
ret
@@ -89,16 +89,16 @@ inc_cursor:
inc ax
mov [CURSOR_X], ax
cmp ax, VIDEO_COLS
- jl inc_cursor_fini
+ jl .fini
mov [CURSOR_X], word 1
mov ax, [CURSOR_Y]
inc ax
mov [CURSOR_Y], ax
cmp ax, VIDEO_ROWS
- jl inc_cursor_fini
+ jl .fini
; TODO: scoll one line, for now restart on top
mov [CURSOR_Y], word 0
-inc_cursor_fini:
+.fini:
call update_vga_cursor
pop eax
ret
@@ -184,23 +184,24 @@ check_magic:
sub edx, MAGICLEN ; subtract the length of the magic string
mov esi, edx ; now use edx as first string address to compare to
mov edi, COMPARE_MAGIC ; position of second string
- mov ecx, MAGICLEN ; length of the magic string
+ mov ecx, MAGICLEN-2 ; length of the magic string, we can have a second
+ ; (one digit) tolerance when comparing
repe cmpsb
- jne MAGIC_MISMATCH
- jmp MAGIC_OK
-MAGIC_MISMATCH:
+ jne .ok
+ jmp .mismatch
+.ok:
mov si, MAGIC_OK_MSG
call pm_print_string
call pm_print_newline
xor eax, eax
- jmp MAGIC_END
-MAGIC_OK:
+ jmp .end
+.mismatch:
mov si, MAGIC_NOT_OK_MSG
call pm_print_string
call pm_print_newline
xor eax, eax
mov eax, 1
-MAGIC_END:
+.end:
pop edi
pop esi
pop edx
@@ -209,7 +210,7 @@ MAGIC_END:
ret
COMPARE_MAGIC:
-db "ABAOSMAGIC", 0
+db "ABAOSMAGIC ", __UTC_DATE__, " ", __UTC_TIME__, 0
MAGICLEN equ $ - COMPARE_MAGIC
MAGIC_NOT_OK_MSG: