2020-04-03 21:43:10 +02:00
|
|
|
errcll: ; put return address into dx
|
|
|
|
pop dx
|
2020-04-03 19:38:33 +02:00
|
|
|
errjmp: call dmpdx
|
2020-04-03 21:45:49 +02:00
|
|
|
xor ax, ax
|
|
|
|
int 0x16
|
|
|
|
int 0x19
|
2020-04-03 21:43:10 +02:00
|
|
|
dmpdx: ; setup bx and ah for int 10h call
|
|
|
|
xor bx, bx
|
2020-04-03 19:38:33 +02:00
|
|
|
mov ah, 0x0e
|
|
|
|
mov cl, 4
|
2020-04-03 21:43:10 +02:00
|
|
|
; this double-call is essentially a 4 times repeating loop
|
2020-04-03 19:38:33 +02:00
|
|
|
call dmpdx1
|
|
|
|
dmpdx1: call dmpdx2
|
2020-04-03 21:43:10 +02:00
|
|
|
dmpdx2: ; grab highest nibble from dx
|
|
|
|
mov al, dh
|
|
|
|
; remove highest nibble from dx
|
2020-04-03 19:38:33 +02:00
|
|
|
shl dx, cl
|
2020-04-03 21:43:10 +02:00
|
|
|
; shift away second-highest nibble that we accidentally copied
|
2020-04-03 19:38:33 +02:00
|
|
|
shr al, cl
|
2020-04-03 21:43:10 +02:00
|
|
|
; map 0-9 to ascii codes for '0' to '9'
|
2020-04-03 19:38:33 +02:00
|
|
|
add al, 0x30
|
2020-04-03 21:43:10 +02:00
|
|
|
; if result is larger than '9', ...
|
2020-04-03 19:38:33 +02:00
|
|
|
cmp al, 0x3a
|
|
|
|
jl dmpdx3
|
2020-04-03 21:43:10 +02:00
|
|
|
; ... add 7 so we continue at 'A'
|
2020-04-03 19:38:33 +02:00
|
|
|
add al, 7
|
|
|
|
dmpdx3: int 0x10
|
|
|
|
ret
|