use null-terminated strings for vga_println
This commit is contained in:
1 parent
bd3063a80d
commit
e913eb04ae
1 file changed
+15
-18
@@ -214,7 +214,6 @@ main:
|
||||
call vga_clear
|
||||
|
||||
mov ax, msg_boot1_loaded
|
||||
mov cx, MSG_BOOT1_LOADED_LEN
|
||||
call vga_println
|
||||
|
||||
call test_a20
|
||||
@@ -308,12 +307,13 @@ vga_scroll:
|
||||
fnret
|
||||
|
||||
|
||||
; Write one line to the VGA text buffer.
|
||||
; Write one line to the VGA text buffer. The string should be null-terminated; we embrace the evil
|
||||
; of null-termination so this function only takes one argument, so it's slightly less of a faff to
|
||||
; call in most cases.
|
||||
; Arguments:
|
||||
; - ax: pointer to the string to print
|
||||
; - cx: string length
|
||||
; - ax: pointer to the string to print, null-terminated
|
||||
; Return: none
|
||||
; Clobber: ax, cx
|
||||
; Clobber: ax
|
||||
vga_println:
|
||||
fnstart
|
||||
push si
|
||||
@@ -327,10 +327,6 @@ vga_println:
|
||||
.scroll_done:
|
||||
|
||||
mov si, ax
|
||||
mov ax, VGA_WIDTH
|
||||
cmp cx, ax
|
||||
cmova cx, ax
|
||||
mov di, VGA_WIDTH * (VGA_HEIGHT - 1) * 2
|
||||
|
||||
xor dx, dx
|
||||
mov ax, [GLOBALS + TEXTBUF_LINE]
|
||||
@@ -342,10 +338,15 @@ vga_println:
|
||||
mov es, ax
|
||||
mov ah, [GLOBALS + VGA_COL + 1]
|
||||
|
||||
mov dx, VGA_WIDTH
|
||||
|
||||
.loop:
|
||||
or cx, cx
|
||||
test dx, dx
|
||||
jz .done
|
||||
dec dx
|
||||
mov al, [si]
|
||||
test al, al
|
||||
jz .done
|
||||
mov es:[di], ax
|
||||
add di, 2
|
||||
inc si
|
||||
@@ -404,14 +405,10 @@ test_a20:
|
||||
ret
|
||||
|
||||
|
||||
msg_boot1_loaded db "boot1 loaded. hello!"
|
||||
MSG_BOOT1_LOADED_LEN equ $ - msg_boot1_loaded
|
||||
msg_a20_enabled db "a20 enabled"
|
||||
MSG_A20_ENABLED_LEN equ $ - msg_a20_enabled
|
||||
msg_a20_disabled db "a20 disabled"
|
||||
MSG_A20_DISABLED_LEN equ $ - msg_a20_disabled
|
||||
msg_panic db "fuck"
|
||||
MSG_PANIC_LEN equ $ - msg_panic
|
||||
msg_boot1_loaded db "boot1 loaded. hello!", 0
|
||||
msg_a20_enabled db "a20 enabled", 0
|
||||
msg_a20_disabled db "a20 disabled", 0
|
||||
msg_panic db "panic!", 0
|
||||
|
||||
boot1_magic dd BOOT1_MAGIC
|
||||
|
||||
|
||||
Reference in new issue
Block a user