diff --git a/apps/zasm/parse.asm b/apps/zasm/parse.asm index f3bf07d..af8858a 100644 --- a/apps/zasm/parse.asm +++ b/apps/zasm/parse.asm @@ -226,7 +226,13 @@ parseLiteral: parseNumberOrSymbol: call parseLiteral ret z - ; Not a number. Try symbol + ; Not a number. Try PC + push de + ld de, .sDollar + call strcmp + pop de + jr z, .returnPC + ; Not PC either, try symbol call symSelect call symFind jr nz, .notfound @@ -244,3 +250,12 @@ parseNumberOrSymbol: ; Otherwise return error. Z is already unset, so in fact, this is the ; same as jumping to zasmIsFirstPass jp zasmIsFirstPass + +.returnPC: + push hl + call zasmGetPC + push hl \ pop ix + pop hl + ret +.sDollar: + .db '$', 0 diff --git a/tools/emul/user.h b/tools/emul/user.h index fdfd203..cf0a76e 100644 --- a/tools/emul/user.h +++ b/tools/emul/user.h @@ -1,5 +1,5 @@ .equ USER_CODE 0x4800 -.equ USER_RAMSTART 0x5800 +.equ USER_RAMSTART 0x6000 .equ FS_HANDLE_SIZE 8 ; *** JUMP TABLE *** diff --git a/tools/emul/zasm/zasm.bin b/tools/emul/zasm/zasm.bin index f6c9b9a..f842fac 100644 Binary files a/tools/emul/zasm/zasm.bin and b/tools/emul/zasm/zasm.bin differ diff --git a/tools/tests/unit/test_expr.asm b/tools/tests/unit/test_expr.asm index 0924ba6..eec8984 100644 --- a/tools/tests/unit/test_expr.asm +++ b/tools/tests/unit/test_expr.asm @@ -13,6 +13,9 @@ jp test zasmIsFirstPass: jp unsetZ +zasmGetPC: + ret + testNum: .db 1 s1: .db "2+2", 0 diff --git a/tools/tests/unit/test_parse.asm b/tools/tests/unit/test_parse.asm index 6654f9b..fa12fee 100644 --- a/tools/tests/unit/test_parse.asm +++ b/tools/tests/unit/test_parse.asm @@ -3,6 +3,9 @@ jp test #include "core.asm" #include "parse.asm" +zasmGetPC: + ret + testNum: .db 1 sFoo: .db "Foo", 0 diff --git a/tools/tests/unit/test_parse_z.asm b/tools/tests/unit/test_parse_z.asm index ff88dac..30333c9 100644 --- a/tools/tests/unit/test_parse_z.asm +++ b/tools/tests/unit/test_parse_z.asm @@ -6,6 +6,7 @@ jp test #include "zasm/parse.asm" ; mocks. aren't used in tests +zasmGetPC: zasmIsFirstPass: symSelect: symFind: diff --git a/tools/tests/zasm/test1.asm b/tools/tests/zasm/test1.asm index da2fcb9..04b1691 100644 --- a/tools/tests/zasm/test1.asm +++ b/tools/tests/zasm/test1.asm @@ -27,4 +27,4 @@ label2: .dw 0x42 rlc c cp '-' sbc hl, de -.fill 0x10 +.fill 0x50-$