Explain the booterr code a bit
This commit is contained in:
parent
3da473a00c
commit
6eca218f8e
@ -1,18 +1,27 @@
|
|||||||
errcll: pop dx
|
errcll: ; put return address into dx
|
||||||
|
pop dx
|
||||||
errjmp: call dmpdx
|
errjmp: call dmpdx
|
||||||
hlt: hlt
|
hlt: hlt
|
||||||
jmp hlt
|
jmp hlt
|
||||||
dmpdx: xor bx, bx
|
dmpdx: ; setup bx and ah for int 10h call
|
||||||
|
xor bx, bx
|
||||||
mov ah, 0x0e
|
mov ah, 0x0e
|
||||||
mov cl, 4
|
mov cl, 4
|
||||||
|
; this double-call is essentially a 4 times repeating loop
|
||||||
call dmpdx1
|
call dmpdx1
|
||||||
dmpdx1: call dmpdx2
|
dmpdx1: call dmpdx2
|
||||||
dmpdx2: mov al, dh
|
dmpdx2: ; grab highest nibble from dx
|
||||||
|
mov al, dh
|
||||||
|
; remove highest nibble from dx
|
||||||
shl dx, cl
|
shl dx, cl
|
||||||
|
; shift away second-highest nibble that we accidentally copied
|
||||||
shr al, cl
|
shr al, cl
|
||||||
|
; map 0-9 to ascii codes for '0' to '9'
|
||||||
add al, 0x30
|
add al, 0x30
|
||||||
|
; if result is larger than '9', ...
|
||||||
cmp al, 0x3a
|
cmp al, 0x3a
|
||||||
jl dmpdx3
|
jl dmpdx3
|
||||||
|
; ... add 7 so we continue at 'A'
|
||||||
add al, 7
|
add al, 7
|
||||||
dmpdx3: int 0x10
|
dmpdx3: int 0x10
|
||||||
ret
|
ret
|
||||||
|
Loading…
Reference in New Issue
Block a user