From 1bbcb4597e873416223a01a03f7c7e3831dfa6bc Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Wed, 14 Feb 2024 00:42:13 +0100 Subject: Offset labels by 0x200 --- src/c8asm/assembler.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/c8asm/assembler.c b/src/c8asm/assembler.c index c682ccb..ea292b7 100644 --- a/src/c8asm/assembler.c +++ b/src/c8asm/assembler.c @@ -50,8 +50,10 @@ getaddr(struct raw_addr a) struct label *lbl; if (!a.label) return a.val; + /* The first 0x200 is reserved for the interpreter, so we need to offset + labels that aren’t integer-literals by that. */ if (lbl = getlabel(a.sv)) - return lbl->addr; + return lbl->addr + 0x200; die_with_off(filename, a.sv.p - baseptr, E_LNEXISTS, U8_PRI_ARGS(a.sv)); } -- cgit v1.2.3