zasm: support forward label references!

This commit is contained in:
Virgil Dupras 2019-05-10 21:14:46 -04:00
parent c239ec7dea
commit c000d5cfb1
2 changed files with 4 additions and 1 deletions

View File

@ -169,6 +169,9 @@ symFind:
; Return value associated with symbol string in (HL) into DE. ; Return value associated with symbol string in (HL) into DE.
; Sets Z on success, unset on error. ; Sets Z on success, unset on error.
symGetVal: symGetVal:
call zasmIsFirstPass
ret z ; first pass? we don't care about the value,
; return success.
call symFind call symFind
ret nz ; not found ret nz ; not found
; our index is in A. Let's fetch the proper value ; our index is in A. Let's fetch the proper value

View File

@ -2,6 +2,7 @@
add a, b ; comment add a, b ; comment
label1: label1:
inc a ; comment inc a ; comment
ld hl, label2
; comment ; comment
.db 42 .db 42
label2: label2:
@ -9,4 +10,3 @@ label2:
.dw 3742 .dw 3742
.dw 0x3742 .dw 0x3742
ld a, (label1) ld a, (label1)
ld hl, label2