2019-10-12 17:10:39 +02:00
|
|
|
; print a word
|
|
|
|
; in: ax
|
|
|
|
print16:
|
|
|
|
xchg ah,al
|
|
|
|
call print8
|
|
|
|
xchg ah,al
|
|
|
|
|
|
|
|
; print a byte
|
|
|
|
; in: al
|
|
|
|
print8:
|
|
|
|
push ax ; avoid destroying ah
|
|
|
|
push bx
|
|
|
|
xor bx, bx
|
|
|
|
aam 16 ; high nibble moved into ah, low nibble into al
|
|
|
|
add ax, 0x3030
|
|
|
|
push ax
|
|
|
|
xchg al, ah
|
|
|
|
call .nib
|
|
|
|
pop ax
|
|
|
|
call .nib
|
|
|
|
pop bx
|
|
|
|
pop ax
|
|
|
|
ret
|
|
|
|
.nib:
|
|
|
|
cmp al, 0x3a
|
|
|
|
jl .out
|
|
|
|
add al, 0x07
|
|
|
|
.out:
|
|
|
|
mov dl, al
|
2019-10-29 12:08:11 +01:00
|
|
|
call CONOUT
|
2019-10-12 17:10:39 +02:00
|
|
|
ret
|
|
|
|
|
|
|
|
dump:
|
|
|
|
push ax
|
|
|
|
push cx
|
|
|
|
push dx
|
|
|
|
push bx
|
|
|
|
mov dl, 0x0A
|
2019-10-29 12:08:11 +01:00
|
|
|
call CONOUT
|
2019-10-12 17:10:39 +02:00
|
|
|
mov dl, 0x0D
|
2019-10-29 12:08:11 +01:00
|
|
|
call CONOUT
|
2019-10-12 17:10:39 +02:00
|
|
|
mov cx, 4
|
|
|
|
.loop_line:
|
|
|
|
push cx
|
|
|
|
push bx
|
|
|
|
mov ax, bx
|
|
|
|
call print16
|
|
|
|
mov dl, ':'
|
2019-10-29 12:08:11 +01:00
|
|
|
call CONOUT
|
2019-10-12 17:10:39 +02:00
|
|
|
mov dl, ' '
|
2019-10-29 12:08:11 +01:00
|
|
|
call CONOUT
|
2019-10-12 17:10:39 +02:00
|
|
|
mov cx, 0x8
|
|
|
|
.loop_bin:
|
|
|
|
mov ax, [bx]
|
|
|
|
xchg al, ah
|
|
|
|
inc bx
|
|
|
|
inc bx
|
|
|
|
call print16
|
|
|
|
mov dl, ' '
|
2019-10-29 12:08:11 +01:00
|
|
|
call CONOUT
|
2019-10-12 17:10:39 +02:00
|
|
|
loop .loop_bin
|
|
|
|
pop bx
|
|
|
|
mov cx, 0x10
|
|
|
|
.loop_ascii:
|
|
|
|
mov dl, '.'
|
|
|
|
cmp byte [bx], 0x20
|
|
|
|
jc .print
|
|
|
|
cmp byte [bx], 0x80
|
|
|
|
jnc .print
|
|
|
|
mov dl, [bx]
|
|
|
|
.print:
|
|
|
|
inc bx
|
2019-10-29 12:08:11 +01:00
|
|
|
call CONOUT
|
2019-10-12 17:10:39 +02:00
|
|
|
loop .loop_ascii
|
|
|
|
pop cx
|
|
|
|
mov dl, 0x0A
|
2019-10-29 12:08:11 +01:00
|
|
|
call CONOUT
|
2019-10-12 17:10:39 +02:00
|
|
|
mov dl, 0x0D
|
2019-10-29 12:08:11 +01:00
|
|
|
call CONOUT
|
2019-10-12 17:10:39 +02:00
|
|
|
loop .loop_line
|
|
|
|
pop bx
|
|
|
|
pop dx
|
|
|
|
pop cx
|
|
|
|
pop ax
|
|
|
|
ret
|