From 02ee4c3c8843f1c3fcf3f9bd50908146c07a884b Mon Sep 17 00:00:00 2001 From: Camden Dixie O'Brien Date: Sun, 15 Mar 2026 21:27:48 +0000 Subject: [PATCH] Support symbols in .at address field --- asm.js | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/asm.js b/asm.js index 80b032a..9699496 100644 --- a/asm.js +++ b/asm.js @@ -550,15 +550,10 @@ class Parser { token_at_addr(token) { const value = this.integer(token); - if (value == null) { - console.error( - `ERROR: Unexpected token ${token} in .mem: ` - + "expected address"); - this.at = undefined; - return; - } - - this.at.addr = value; + if (value != null) + this.at.addr = value; + else + this.at.addr_symbol = token; const action = { type: Action.AT, at: this.at }; this.at = undefined; this.state = State.TOP; @@ -998,7 +993,8 @@ export class Assembler { return; } this.pos.mem = mem; - this.pos.addr = action.at.addr; + this.pos.addr = action.at.addr + ?? this.lookup_def(action.at.addr_symbol); this.data.push({ loc: { ...this.pos }, data: [] }) }