zasm: implement error conditions for #inc
This commit is contained in:
parent
31f7c7771d
commit
b298e607bd
@ -11,3 +11,5 @@
|
||||
|
||||
; Value specified doesn't fit in its destination byte or word
|
||||
.equ ERR_OVFL 0x04
|
||||
|
||||
.equ ERR_FILENOTFOUND 0x05
|
||||
|
@ -184,13 +184,21 @@ handleFIL:
|
||||
|
||||
handleINC:
|
||||
call readWord
|
||||
jr nz, .end
|
||||
jr nz, .badfmt
|
||||
; HL points to scratchpad
|
||||
call enterDoubleQuotes
|
||||
jr nz, .end
|
||||
jr nz, .badfmt
|
||||
call ioOpenInclude
|
||||
.end:
|
||||
xor a ; zero bytes written
|
||||
jr nz, .badfn
|
||||
cp a ; ensure Z
|
||||
ret
|
||||
.badfmt:
|
||||
ld a, ERR_BAD_FMT
|
||||
jr .error
|
||||
.badfn:
|
||||
ld a, ERR_FILENOTFOUND
|
||||
.error:
|
||||
call unsetZ
|
||||
ret
|
||||
|
||||
; Reads string in (HL) and returns the corresponding ID (D_*) in A. Sets Z if
|
||||
|
@ -32,5 +32,8 @@ chkerr ".equ" 3
|
||||
chkerr ".equ foo" 3
|
||||
chkerr ".org" 3
|
||||
chkerr ".fill" 3
|
||||
chkerr "#inc" 3
|
||||
chkerr "#inc foo" 3
|
||||
chkerr "ld a, 0x100" 4
|
||||
chkerr ".db 0x100" 4
|
||||
chkerr "#inc \"doesnotexist\"" 5
|
||||
|
Loading…
Reference in New Issue
Block a user