82 lines
1.1 KiB
NASM
82 lines
1.1 KiB
NASM
; 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
|
|
call print16
|
|
call space
|
|
ret
|
|
|
|
; let the user edit the word at ES:BX
|
|
edit_word:
|
|
push bx
|
|
mov dx, [es:bx]
|
|
call print16
|
|
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
|