asar
asar copied to clipboard
External labels are incorrectly processed when used in code in structs
when writing code in a struct, any label has its first character replaced by '.' and is then assumed to be part of the struct:
org $008000
struct test $008000
.label1
jmp ExternalLabel ;incorrect
.label2
jmp .label1 ;works fine
.label3
jmp Zlabel1 ;incorrect, should throw an error but refers to test.label1
endstruct
ExternalLabel:
test.asm:6: error: (E5060): Label 'test.xternalLabel' wasn't found. [jmp ExternalLabel]
This is a funny one. Didn't know structs did weird stuff with label names.
Wonder what the correct behavior here should be. Just throw errors for most commands/opcodes when used inside structs? Seems like the most reasonable idea.
Okay but we fixed that one five months ago, we just didn't make a release since then.
(Or rather, we improved the error into "Invalid label name" x2. I don't know what code in a struct is supposed to mean.)
This is indeed fixed in the repo but before I close it, is there any strong reason you want case number 1 (externallabel) to work? The current status it now produces an error. I'm not going to call code in structs useless (could be handy for generating code to be modified in WRAM or something?) But using specific labels doesn't seem all too useful since structs will be overwritten unless you use skip sizeof(mystruct) after defining the struct.