mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-27 15:08:05 +11:00
zasm: add ERR_OVFL
This commit is contained in:
parent
f9118ef88e
commit
d76dd54f4b
@ -8,3 +8,6 @@
|
|||||||
|
|
||||||
; Code is badly formatted (comma without a following arg, unclosed quote, etc.)
|
; Code is badly formatted (comma without a following arg, unclosed quote, etc.)
|
||||||
.equ ERR_BAD_FMT 0x03
|
.equ ERR_BAD_FMT 0x03
|
||||||
|
|
||||||
|
; Value specified doesn't fit in its destination byte or word
|
||||||
|
.equ ERR_OVFL 0x04
|
||||||
|
@ -559,7 +559,9 @@ handleLDrr:
|
|||||||
|
|
||||||
; Compute the upcode for argspec row at (DE) and arguments in curArg{1,2} and
|
; Compute the upcode for argspec row at (DE) and arguments in curArg{1,2} and
|
||||||
; writes the resulting upcode in instrUpcode. A is the number if bytes written
|
; writes the resulting upcode in instrUpcode. A is the number if bytes written
|
||||||
; to instrUpcode (can be zero if something went wrong).
|
; to instrUpcode.
|
||||||
|
; A is zero on error. The only thing that can go wrong in this routine is
|
||||||
|
; overflow.
|
||||||
getUpcode:
|
getUpcode:
|
||||||
push ix
|
push ix
|
||||||
push de
|
push de
|
||||||
@ -814,7 +816,7 @@ parseInstruction:
|
|||||||
; goal here!
|
; goal here!
|
||||||
call getUpcode
|
call getUpcode
|
||||||
or a ; is zero?
|
or a ; is zero?
|
||||||
jr z, .error
|
jr z, .overflow
|
||||||
ld b, a ; save output byte count
|
ld b, a ; save output byte count
|
||||||
ld hl, instrUpcode
|
ld hl, instrUpcode
|
||||||
.loopWrite:
|
.loopWrite:
|
||||||
@ -824,6 +826,9 @@ parseInstruction:
|
|||||||
djnz .loopWrite
|
djnz .loopWrite
|
||||||
cp a ; ensure Z
|
cp a ; ensure Z
|
||||||
jr .end
|
jr .end
|
||||||
|
.overflow:
|
||||||
|
ld a, ERR_OVFL
|
||||||
|
jr .error
|
||||||
.badfmt:
|
.badfmt:
|
||||||
ld a, ERR_BAD_FMT
|
ld a, ERR_BAD_FMT
|
||||||
.error:
|
.error:
|
||||||
|
@ -21,3 +21,4 @@ chkerr "ld a, foo" 2
|
|||||||
chkerr "ld a, hl" 2
|
chkerr "ld a, hl" 2
|
||||||
chkerr "ld a," 3
|
chkerr "ld a," 3
|
||||||
chkerr "ld a, 'A" 3
|
chkerr "ld a, 'A" 3
|
||||||
|
chkerr "ld a, 0x100" 4
|
||||||
|
Loading…
Reference in New Issue
Block a user