diff options
| author | Miquel Sabaté Solà <mssola@mssola.com> | 2026-08-18 16:39:37 +0200 |
|---|---|---|
| committer | Miquel Sabaté Solà <mssola@mssola.com> | 2026-08-18 16:39:37 +0200 |
| commit | fcd4c9a267b407e653ed6b21ae87f219f3e4c4af (patch) | |
| tree | 0b5f3e9bf99ab7377fa0bb6d204661ac8fbe3380 /tests/global-labels.s | |
| parent | d479b0fbd3778f5b6fc8b63f46aa0c5364e4fe7e (diff) | |
| download | tools.nes-fcd4c9a267b407e653ed6b21ae87f219f3e4c4af.tar.gz tools.nes-fcd4c9a267b407e653ed6b21ae87f219f3e4c4af.zip | |
Add global labels
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à <mssola@mssola.com>
Diffstat (limited to 'tests/global-labels.s')
| -rw-r--r-- | tests/global-labels.s | 26 |
1 files changed, 26 insertions, 0 deletions
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 |
