37 lines
356 B
PHP
37 lines
356 B
PHP
|
; IN:
|
||
|
; ax = hex value
|
||
|
printh16:
|
||
|
xchg ah, al
|
||
|
call printh8
|
||
|
xchg ah, al
|
||
|
|
||
|
; IN:
|
||
|
; al = hex value
|
||
|
printh8:
|
||
|
push ax
|
||
|
mov ah, al
|
||
|
|
||
|
shr al, 1
|
||
|
shr al, 1
|
||
|
shr al, 1
|
||
|
shr al, 1
|
||
|
call .printh4
|
||
|
|
||
|
mov al, 0xf
|
||
|
and al, ah
|
||
|
call .printh4
|
||
|
|
||
|
pop ax
|
||
|
ret
|
||
|
|
||
|
.printh4:
|
||
|
cmp al, 10
|
||
|
jb .numeric
|
||
|
|
||
|
add al, 'a' - 10
|
||
|
jmp printc
|
||
|
|
||
|
.numeric:
|
||
|
add al, '0'
|
||
|
jmp printc
|