From d264404bb199cf7ef96b4e1acabd0f54ad6bfe8c Mon Sep 17 00:00:00 2001 From: Ain <41307858+nero@users.noreply.github.com> Date: Mon, 18 May 2020 22:50:30 +0200 Subject: [PATCH] debug: print register name when changing register --- debug/chario.asm | 17 +++++++++-------- rom/debug.asm | 5 +++++ 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/debug/chario.asm b/debug/chario.asm index ba2269a..08ef004 100644 --- a/debug/chario.asm +++ b/debug/chario.asm @@ -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 diff --git a/rom/debug.asm b/rom/debug.asm index 101efd2..7bce37f 100644 --- a/rom/debug.asm +++ b/rom/debug.asm @@ -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