diff --git a/apps/zasm/const.asm b/apps/zasm/const.asm index 3972478..17a6e4d 100644 --- a/apps/zasm/const.asm +++ b/apps/zasm/const.asm @@ -6,3 +6,5 @@ ; contains references to undefined symbols. .equ ERR_BAD_ARG 0x02 +; Code is badly formatted (comma without a following arg, unclosed quote, etc.) +.equ ERR_BAD_FMT 0x03 diff --git a/apps/zasm/instr.asm b/apps/zasm/instr.asm index cefff68..e13ece3 100644 --- a/apps/zasm/instr.asm +++ b/apps/zasm/instr.asm @@ -791,7 +791,7 @@ parseInstruction: call readComma jr nz, .nomorearg call readWord - jr nz, .error + jr nz, .badfmt ld de, curArg2 call processArg jr nz, .error ; A is set to error @@ -824,6 +824,8 @@ parseInstruction: djnz .loopWrite cp a ; ensure Z jr .end +.badfmt: + ld a, ERR_BAD_FMT .error: ; A is set to error already call unsetZ diff --git a/tools/emul/zasm/zasm.bin b/tools/emul/zasm/zasm.bin index dcd66d3..b7b0c76 100644 Binary files a/tools/emul/zasm/zasm.bin and b/tools/emul/zasm/zasm.bin differ diff --git a/tools/tests/zasm/errtests.sh b/tools/tests/zasm/errtests.sh index 7bf15b2..c70d8a3 100755 --- a/tools/tests/zasm/errtests.sh +++ b/tools/tests/zasm/errtests.sh @@ -18,3 +18,5 @@ chkerr() { chkerr "foo" 1 chkerr "ld a, foo" 2 +chkerr "ld a," 3 +chkerr "ld a, 'A" 3