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

avra: avoid pgm addr truncation error on first pass

This commit is contained in:
Virgil Dupras 2019-12-22 19:44:46 -05:00
parent b955a67daa
commit 51e500e8da

View File

@ -354,6 +354,8 @@ parseInstruction:
.spitk12: .spitk12:
; k(12) in HL ; k(12) in HL
; We're doing the same dance as in _readk7. See comments there. ; We're doing the same dance as in _readk7. See comments there.
call zasmIsFirstPass
jr z, .spit
ld de, 0xfff ld de, 0xfff
add hl, de add hl, de
jp c, unsetZ ; Carry? number is way too high. jp c, unsetZ ; Carry? number is way too high.
@ -612,6 +614,10 @@ _readk7:
push ix push ix
call parseExpr call parseExpr
jr nz, .end jr nz, .end
; If we're in first pass, stop now. The value of HL doesn't matter and
; truncation checks might falsely fail.
call zasmIsFirstPass
jr z, .end
; IX contains an absolute value. Turn this into a -64/+63 relative ; IX contains an absolute value. Turn this into a -64/+63 relative
; value by subtracting PC from it. However, before we do that, let's ; value by subtracting PC from it. However, before we do that, let's
; add 0x7f to it, which we'll remove later. This will simplify bounds ; add 0x7f to it, which we'll remove later. This will simplify bounds