rdos/lib/print.asm
2019-03-31 12:44:07 +00:00

36 lines
504 B
NASM

; important functions in this file: kprintf
; print a byte
; in: al
print8:
push ax ; avoid destroying ah
push bx
mov bx, 0x0000
aam 16 ; high nibble moved into ah, low nibble into al
add ax, 0x3030
push ax
xchg al, ah
call .nib
pop ax
call .nib
pop bx
pop ax
ret
.nib:
cmp al, 0x3a
jl .out
add al, 0x07
.out:
mov ah, 0x0e
int 0x10
ret
; print a word
; in: ax
print16:
xchg ah,al
call print8
xchg ah,al
call print8
ret