1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-27 15:38:05 +11:00

zasm: implement error conditions for #inc

This commit is contained in:
Virgil Dupras 2019-05-27 14:21:46 -04:00
parent 31f7c7771d
commit b298e607bd
3 changed files with 17 additions and 4 deletions

View File

@ -11,3 +11,5 @@
; Value specified doesn't fit in its destination byte or word ; Value specified doesn't fit in its destination byte or word
.equ ERR_OVFL 0x04 .equ ERR_OVFL 0x04
.equ ERR_FILENOTFOUND 0x05

View File

@ -184,13 +184,21 @@ handleFIL:
handleINC: handleINC:
call readWord call readWord
jr nz, .end jr nz, .badfmt
; HL points to scratchpad ; HL points to scratchpad
call enterDoubleQuotes call enterDoubleQuotes
jr nz, .end jr nz, .badfmt
call ioOpenInclude call ioOpenInclude
.end: jr nz, .badfn
xor a ; zero bytes written cp a ; ensure Z
ret
.badfmt:
ld a, ERR_BAD_FMT
jr .error
.badfn:
ld a, ERR_FILENOTFOUND
.error:
call unsetZ
ret ret
; Reads string in (HL) and returns the corresponding ID (D_*) in A. Sets Z if ; Reads string in (HL) and returns the corresponding ID (D_*) in A. Sets Z if

View File

@ -32,5 +32,8 @@ chkerr ".equ" 3
chkerr ".equ foo" 3 chkerr ".equ foo" 3
chkerr ".org" 3 chkerr ".org" 3
chkerr ".fill" 3 chkerr ".fill" 3
chkerr "#inc" 3
chkerr "#inc foo" 3
chkerr "ld a, 0x100" 4 chkerr "ld a, 0x100" 4
chkerr ".db 0x100" 4 chkerr ".db 0x100" 4
chkerr "#inc \"doesnotexist\"" 5