debug: print register name when changing register

This commit is contained in:
Nero 2020-05-18 22:50:30 +02:00
parent 8407275ba9
commit d264404bb1
2 changed files with 14 additions and 8 deletions

View File

@ -1,8 +1,10 @@
; Print AL
space: mov al, ' '
putc: xor bx, bx
putc: push bx
xor bx, bx
mov ah, 0x0e
int 0x10
pop bx
ret
; Print code string CS:SI
@ -27,9 +29,6 @@ crlf: mov al, 0x0A
jmp putc
print16:
; setup bx and ah for int 10h call
xor bx, bx
mov ah, 0x0e
mov cl, 4
; this double-call is essentially a 4 times repeating loop
call .c1
@ -44,11 +43,10 @@ print16:
add al, 0x30
; if result is larger than '9', ...
cmp al, 0x3a
jl .noadj
jl putc
; ... add 7 so we continue at 'A'
add al, 7
.noadj: int 0x10
ret
jmp putc
; Read character
getc: xor ax, ax
@ -90,7 +88,8 @@ getch: call getcu
; Read string into inbuf
; IN ingetc ptr to getc function
; inlen max number of chars
gets: mov di, inbuf
gets: push bx
mov di, inbuf
; calculate max pointer for writing
mov dx, [inmin]
.loop: call [ingetc]
@ -125,6 +124,7 @@ gets: mov di, inbuf
jmp .loop
; ctrl+c: return with carry set
.can: stc
pop bx
ret
; enter: if enough chars, return
.enter: mov bx, di
@ -133,4 +133,5 @@ gets: mov di, inbuf
jc .loop
xor al, al
stosb
pop bx
ret

View File

@ -168,6 +168,11 @@ 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