You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
72 lines
1.7 KiB
72 lines
1.7 KiB
BITS 16
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
print:
|
|
; Prints string in si
|
|
; IN si: zero terminated string to print
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
mov ah, 0xE ; Specify 'int 0x10' 'teletype output' function
|
|
; [AL = Character, BH = Page Number, BL = Colour (in graphics mode)]
|
|
.printchar:
|
|
lodsb ; Load byte at address SI into AL, and increment SI
|
|
test al, al
|
|
jz .done ; If the character is zero (NUL), stop writing the string
|
|
int 0x10 ; Otherwise, print the character via 'int 0x10'
|
|
jmp .printchar ; Repeat for the next character
|
|
.done:
|
|
ret
|
|
|
|
printCRLF:
|
|
mov ah, 0xE
|
|
mov al, 13
|
|
int 0x10
|
|
mov al, 10
|
|
int 0x10
|
|
ret
|
|
|
|
printSpace:
|
|
mov ax, 0xE20
|
|
int 0x10
|
|
ret
|
|
|
|
printALChar:
|
|
mov ah, 0xE
|
|
mov bl, 0x02 ;color
|
|
int 0x10
|
|
ret
|
|
|
|
; Changing the screen the user i looking at.
|
|
; value in 'al' is the screen we want to switch to.
|
|
; starting from 0x00
|
|
os_change_screen:
|
|
; Here the addresses for the screens stack
|
|
; and base pointer has to be set.
|
|
mov ah, 0x05
|
|
int 0x10
|
|
ret
|
|
|
|
os_clear_screen:
|
|
pusha
|
|
; move cursor to the bootom
|
|
xor ax, ax
|
|
xor bx, bx
|
|
mov ah, 0x02
|
|
mov bh, 0x00 ; page number 0
|
|
mov dh, 0x18 ; row zero
|
|
mov dl, 0x00 ; coloumn zero
|
|
int 0x10
|
|
xor cx, cx
|
|
.loop:
|
|
call printCRLF
|
|
add cx, 1
|
|
cmp cx, 0x19 ; until blank screen
|
|
jne .loop
|
|
; Move curser back to the top of the screen
|
|
mov ah, 0x02
|
|
mov bh, 0x00 ; page number 0
|
|
mov dh, 0x00 ; row zero
|
|
mov dl, 0x00 ; coloumn zero
|
|
int 0x10
|
|
|
|
popa
|
|
ret
|