opbasm
opbasm copied to clipboard
local labels do not work when using C-style ifs
The following code does not work:
proc:
jump .test
if (sA == 1) {
nop()
}
.test:
nop()
This is because the if will create a label that will destroy the locality of .local. It would be nice if automatic generated labels could be ignored while parsing local label. This would make this features much more useful.
I have fixed this. Now all macro generated labels will start with "__". Any label with a double-underscore prefix will not affect the context for local labels.
Oh, looks like this introduces a subtle bug. The following code now fails:
loadaddr(tmp16, .jump_tab)
fetch sC, spm_state
add16(tmp16, zero, sC)
call@ (tmp16)
jump rxtx_Run ;endless loop
.jump_tab:
jump doStateBusyDelimiterScanning
jump doStateIdleDelimiterScanning
Message
ERROR: Unknown label: .jump_tab'upper
This should be fixed now.
Looks like this was broken again by 6b41b29745bebd52d787af57b771310810abb3a1 :cry: The version before seems to work.
Even simpler testcase:
a:
jump .test
uniqlabel(debug):
.test:
load sA, 1