zasm: add ERR_BAD_FMT

This commit is contained in:
Virgil Dupras 2019-05-27 11:58:12 -04:00
parent 412b3f374a
commit e1e6d52fea
4 changed files with 7 additions and 1 deletions

View File

@ -6,3 +6,5 @@
; contains references to undefined symbols. ; contains references to undefined symbols.
.equ ERR_BAD_ARG 0x02 .equ ERR_BAD_ARG 0x02
; Code is badly formatted (comma without a following arg, unclosed quote, etc.)
.equ ERR_BAD_FMT 0x03

View File

@ -791,7 +791,7 @@ parseInstruction:
call readComma call readComma
jr nz, .nomorearg jr nz, .nomorearg
call readWord call readWord
jr nz, .error jr nz, .badfmt
ld de, curArg2 ld de, curArg2
call processArg call processArg
jr nz, .error ; A is set to error jr nz, .error ; A is set to error
@ -824,6 +824,8 @@ parseInstruction:
djnz .loopWrite djnz .loopWrite
cp a ; ensure Z cp a ; ensure Z
jr .end jr .end
.badfmt:
ld a, ERR_BAD_FMT
.error: .error:
; A is set to error already ; A is set to error already
call unsetZ call unsetZ

Binary file not shown.

View File

@ -18,3 +18,5 @@ chkerr() {
chkerr "foo" 1 chkerr "foo" 1
chkerr "ld a, foo" 2 chkerr "ld a, foo" 2
chkerr "ld a," 3
chkerr "ld a, 'A" 3