Save some bytes on printing hexnumbers

This commit is contained in:
Nero 2019-09-26 14:53:50 +00:00
parent df8e47803a
commit 62a15d52bb

View File

@ -1,11 +1,18 @@
; important functions in this file: kprintf ; important functions in this file: kprintf
; print a word
; in: ax
print16:
xchg ah,al
call print8
xchg ah,al
; print a byte ; print a byte
; in: al ; in: al
print8: print8:
push ax ; avoid destroying ah push ax ; avoid destroying ah
push bx push bx
mov bx, 0x0000 xor bx, bx
aam 16 ; high nibble moved into ah, low nibble into al aam 16 ; high nibble moved into ah, low nibble into al
add ax, 0x3030 add ax, 0x3030
push ax push ax
@ -24,12 +31,3 @@ print8:
mov ah, 0x0e mov ah, 0x0e
int 0x10 int 0x10
ret ret
; print a word
; in: ax
print16:
xchg ah,al
call print8
xchg ah,al
call print8
ret