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

View File

@ -168,6 +168,11 @@ cmd_r: cmp byte [si], 0
je printregs je printregs
call eat_register call eat_register
jc .err jc .err
mov al, [cs:bx+rnames]
call putc
mov al, [cs:bx+rnames+1]
call putc
call space
call edit_word call edit_word
call crlf call crlf
ret ret