From fcd4c9a267b407e653ed6b21ae87f219f3e4c4af Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Tue, 18 Aug 2026 16:39:37 +0200 Subject: Add global labels MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These are labels that are declared by prefixing a '#' symbol to the name, and it allows the label to be declared at the global scope instead of the current one. This is a feature which is not to be abused so to not make scopes pointless, but it can be quite handy with some optimizations while not abandoning scopes completely. Signed-off-by: Miquel Sabaté Solà --- tests/global-labels.s | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 tests/global-labels.s (limited to 'tests/global-labels.s') diff --git a/tests/global-labels.s b/tests/global-labels.s new file mode 100644 index 0000000..93b4d6d --- /dev/null +++ b/tests/global-labels.s @@ -0,0 +1,26 @@ +.segment "HEADER" + .byte 'N', 'E', 'S', $1A + .byte $02, $01 + .byte $00 + .byte $00 + +.segment "CODE" +;; asan:stack full + +.scope Scope + .proc foo + lda #1 ; $8000 + jmp Scope::bar ; $8002 + #@known_address: + rts ; $8005 + .endproc + + .proc bar + jmp @label ; $8006 + nop ; $8009 + @label: + jmp @known_address ; $800A + .endproc +.endscope + +jsr Scope::foo ; $800D -- cgit v1.2.3