1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-09-29 14:30:55 +10:00

zasm: make "double parsing" a bit more solid

It was previously skipped on a local label.
This commit is contained in:
Virgil Dupras 2019-05-14 14:35:34 -04:00
parent 7972b92be1
commit 99a7c94c9f
2 changed files with 10 additions and 12 deletions

View File

@ -133,7 +133,14 @@ parseLine:
call _parseDirec call _parseDirec
jr .end ; Z is correct jr .end ; Z is correct
.label: .label:
push hl
call _parseLabel call _parseLabel
pop hl
jr nz, .end ; error out
; We're finished here. However, because it's a label, it's possible that
; another logical line follows directly after the label. Let's parse
; this and propagate error.
call parseLine
; Continue to .end, Z has proper value ; Continue to .end, Z has proper value
.end: .end:
pop bc pop bc
@ -194,18 +201,10 @@ _parseLabel:
; When we're not in the first pass, we set the context (if label is not ; When we're not in the first pass, we set the context (if label is not
; local) to that label. ; local) to that label.
call symIsLabelLocal call symIsLabelLocal
jr z, .noContext ; local? don't set context jr z, .success ; local? don't set context
call symSetContext call symSetContext
jr nz, .error ; NZ? this means that (HL) couldn't be
; found in symbol list. Weird
.noContext:
; We're finished here. However, because it's a label, it's possible that
; another logical line follows directly after the label. Let's parse
; this and propagate error.
ex hl, de ; recall end of label position from DE
; into HL
call parseLine
jr z, .success jr z, .success
; NZ? this means that (HL) couldn't be found in symbol list. Weird
jr .error jr .error
.registerLabel: .registerLabel:
ld de, (curOutputOffset) ld de, (curOutputOffset)

View File

@ -4,8 +4,7 @@ addDE:
add a, e add a, e
jr nc, .end ; no carry? skip inc jr nc, .end ; no carry? skip inc
inc d inc d
.end: .end: ld e, a
ld e, a
pop af pop af
ret ret