From d6f5cf5b9039629eae959c82d38acd9375648c48 Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Sun, 12 May 2019 08:50:29 -0400 Subject: [PATCH] zasm: fix first pass inversion bug Also, confirm in tests that we can refer to other symbols in `.equ`. --- apps/zasm/directive.asm | 3 +-- apps/zasm/tests/test1.asm | 5 +++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/zasm/directive.asm b/apps/zasm/directive.asm index 6f00493..e83fcf4 100644 --- a/apps/zasm/directive.asm +++ b/apps/zasm/directive.asm @@ -50,7 +50,7 @@ handleDW: handleEQU: call zasmIsFirstPass - jr z, .begin + jr nz, .begin ; first pass? .equ are noops xor a ret @@ -74,7 +74,6 @@ handleEQU: call toWord call readWord ld hl, scratchpad - ld a, (hl) call parseNumberOrSymbol jr nz, .error ld hl, DIREC_SCRATCHPAD diff --git a/apps/zasm/tests/test1.asm b/apps/zasm/tests/test1.asm index 5b1c87c..aff03fb 100644 --- a/apps/zasm/tests/test1.asm +++ b/apps/zasm/tests/test1.asm @@ -11,5 +11,6 @@ label2: .dw 3742 .dw 0x3742 ld a, (label1) -.equ foobar 0x1234 - ld hl, foobar +.equ foo 0x1234 +.equ bar foo + ld hl, bar