2020-05-18 23:43:54 +02:00
|
|
|
; Commands and utils related to displaying or editing memory or registers
|
|
|
|
|
|
|
|
cmd_r: cmp byte [si], 0
|
|
|
|
je printregs
|
|
|
|
call eat_register
|
|
|
|
jc .err
|
|
|
|
mov al, [cs:bx+rnames]
|
|
|
|
call putc
|
|
|
|
mov al, [cs:bx+rnames+1]
|
|
|
|
call putc
|
|
|
|
call space
|
|
|
|
call edit_word
|
|
|
|
call crlf
|
|
|
|
ret
|
|
|
|
.err: mov di, eat_register.emsg
|
|
|
|
jmp parse_error
|
|
|
|
|
|
|
|
printregs:
|
|
|
|
mov cx, 13
|
|
|
|
xor bx, bx
|
|
|
|
mov ah, 0x0e
|
|
|
|
mov si, reg_ax
|
|
|
|
.loop: push cx
|
|
|
|
mov dx, [cs:si+rnames]
|
|
|
|
lodsw
|
|
|
|
call printreg
|
|
|
|
pop cx
|
|
|
|
loop .loop
|
|
|
|
|
|
|
|
mov dx, [reg_fl]
|
|
|
|
mov si, fnames
|
|
|
|
mov cx, 16
|
|
|
|
.floop: mov al, [cs:si]
|
|
|
|
inc si
|
|
|
|
cmp al, '+'
|
|
|
|
je .fskip
|
|
|
|
test dx, 0x8000
|
|
|
|
jnz .fprnt
|
|
|
|
mov al, '-'
|
|
|
|
.fprnt: int 0x10
|
|
|
|
.fskip: shl dx, 1
|
|
|
|
loop .floop
|
|
|
|
call crlf
|
|
|
|
ret
|
|
|
|
|
|
|
|
printreg:
|
|
|
|
push ax
|
|
|
|
mov al, dl
|
|
|
|
call putc
|
|
|
|
mov al, dh
|
|
|
|
call putc
|
|
|
|
mov al, '='
|
|
|
|
call putc
|
|
|
|
pop dx
|
2020-05-19 18:26:22 +02:00
|
|
|
call print_dx
|
2020-05-18 23:43:54 +02:00
|
|
|
call space
|
|
|
|
ret
|
|
|
|
|
2020-05-18 22:35:41 +02:00
|
|
|
; let the user edit the word at ES:BX
|
|
|
|
edit_word:
|
|
|
|
push bx
|
|
|
|
mov dx, [es:bx]
|
2020-05-19 18:26:22 +02:00
|
|
|
call print_dx
|
2020-05-18 22:35:41 +02:00
|
|
|
mov al, '.'
|
|
|
|
call putc
|
|
|
|
mov byte [inmin], 4
|
|
|
|
mov byte [inmax], 4
|
|
|
|
mov word [ingetc], getch
|
|
|
|
call gets
|
|
|
|
pop bx
|
|
|
|
jc .ret
|
|
|
|
|
|
|
|
mov si, inbuf
|
|
|
|
call eat_hex_word
|
|
|
|
jc .err
|
|
|
|
mov [es:bx], dx
|
|
|
|
|
|
|
|
.ret: ret
|
|
|
|
.err: call crlf
|
|
|
|
mov di, eat_hex_word.emsg
|
|
|
|
jmp parse_error
|