44 lines
1.2 KiB
ArmAsm
44 lines
1.2 KiB
ArmAsm
; Some utilities to deal with the TTY using the BIOS
|
|
; during real mode
|
|
|
|
next_line:
|
|
; Points the TTY cursor to the next
|
|
; line
|
|
pusha
|
|
; Source: http://www.techhelpmanual.com/118-int_10h_03h__query_cursor_position_and_size.html
|
|
mov ah, 0x3 ; Get cursor position
|
|
mov bh, 0x0 ; Page 0
|
|
int 0x10
|
|
; Go to the next row
|
|
; Source: http://www.techhelpmanual.com/117-int_10h_02h__set_cursor_position.html
|
|
mov ah, 0x2 ; Set cursor position
|
|
mov bh, 0x0 ; Page 0
|
|
xor dl, dl ; Goes to column 0 (i.e. start of the line)
|
|
inc dh ; Goes to the next row
|
|
int 0x10
|
|
popa
|
|
ret
|
|
|
|
|
|
print:
|
|
; Prints a null-terminated string whose address
|
|
; is located in the si register
|
|
pusha
|
|
mov ah, 0xe ; Set the screen in TTY mode
|
|
print_loop:
|
|
mov al, [si]
|
|
int 0x10 ; Writes the content of al to the screen
|
|
inc si
|
|
cmp byte [si], 0x0 ; If we got to the null byte, we're done
|
|
jne print_loop ; Otherwise, we run this again
|
|
popa
|
|
ret
|
|
|
|
|
|
println:
|
|
; Prints a null-terminated string whose address
|
|
; is located in the si register and sets the TTY
|
|
; cursor to the next line
|
|
call print
|
|
call next_line
|
|
ret |