lib/print: shave off some bytes
This commit is contained in:
parent
9aa032a90c
commit
1c4a0cf185
@ -1,37 +1,28 @@
|
|||||||
; important functions in this file: kprintf
|
; important functions in this file: kprintf
|
||||||
|
|
||||||
; write a character to kernel output
|
|
||||||
; in: al
|
|
||||||
printc:
|
|
||||||
push ax
|
|
||||||
push bx
|
|
||||||
mov bx, 0x0000
|
|
||||||
mov ah, 0x0e
|
|
||||||
int 0x10
|
|
||||||
pop bx
|
|
||||||
pop ax
|
|
||||||
ret
|
|
||||||
|
|
||||||
; prints a nibble in hex
|
|
||||||
; in: al
|
|
||||||
print4:
|
|
||||||
and al, 0x0F
|
|
||||||
add al, 0x30
|
|
||||||
cmp al, 0x3a
|
|
||||||
jl printc
|
|
||||||
add al, 0x07
|
|
||||||
jmp printc
|
|
||||||
|
|
||||||
; print a byte
|
; print a byte
|
||||||
; in: al
|
; in: al
|
||||||
print8:
|
print8:
|
||||||
push ax ; avoid destroying ah
|
push ax ; avoid destroying ah
|
||||||
aam 16 ; high nibble moved into ah
|
push bx
|
||||||
xchg ah,al ; high nibble first
|
mov bx, 0x0000
|
||||||
call print4
|
aam 16 ; high nibble moved into ah, low nibble into al
|
||||||
xchg ah,al
|
add ax, 0x3030
|
||||||
call print4
|
push ax
|
||||||
|
xchg al, ah
|
||||||
|
call .nib
|
||||||
pop ax
|
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
|
ret
|
||||||
|
|
||||||
; print a word
|
; print a word
|
||||||
|
Loading…
Reference in New Issue
Block a user