geos/OST OS/os/x16/print/print_hex.asm
2024-03-25 23:00:14 +01:00

25 lines
344 B
NASM

print_hex:
mov cx, 4
mov di, HEX_OUT + 6
convert_loop:
mov ax, dx
and ax, 0x000F
add al, '0'
cmp al, '9'
jbe not_hex_letter
add al, 7
not_hex_letter:
dec di
mov [di], al
shr dx, 4
loop convert_loop
mov bx, HEX_OUT
call writeLn
ret
HEX_OUT: db '0x0000', 0