use null-terminated strings for vga_println

main
pantonshire 1 year ago
parent bd3063a80d
commit e913eb04ae

@ -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,25 +327,26 @@ 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]
mov di, VGA_WIDTH * 2
mul di
mov di, ax
mov ax, 0xb800
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

Loading…
Cancel
Save