From 1e3982d3ab17af87ab10bd4d4e44415ff955503e Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Sun, 12 May 2019 21:44:59 -0400 Subject: [PATCH] zasm: make DE indicate the last line to be read Facilitates debugging --- apps/zasm/main.asm | 8 ++++++-- tools/emul/zasm.c | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/apps/zasm/main.asm b/apps/zasm/main.asm index 3e528d1..6f05dce 100644 --- a/apps/zasm/main.asm +++ b/apps/zasm/main.asm @@ -88,10 +88,14 @@ incOutputOffset: pop de ret +; Repeatedly reads lines from IO, assemble them and spit the binary code in +; IO. Z is set on success, unset on error. DE contains the last line number to +; be read (first line is 1). zasmParseFile: - ld hl, 0 - ld (curOutputOffset), hl + ld de, 0 + ld (curOutputOffset), de .loop: + inc de call ioReadLine or a ; is A 0? ret z ; We have EOF diff --git a/tools/emul/zasm.c b/tools/emul/zasm.c index 3785be3..891bcf4 100644 --- a/tools/emul/zasm.c +++ b/tools/emul/zasm.c @@ -119,6 +119,7 @@ int main() } #endif fflush(stdout); + fprintf(stderr, "Ended with A=%d DE=%d\n", cpu.R1.br.A, cpu.R1.wr.DE); return 0; }