I've tested if the macrolabel can also screws up the "+" or "-" labels,
and it did, by doing this:
- On Gopher Popcorn Stew (GPS), I created a block file with this code:
Code;This is a template block.
db $37
JMP MarioBelow : JMP MarioAbove : JMP MarioSide : JMP SpriteV
JMP SpriteH : JMP MarioCape : JMP MarioFireball : JMP TopCorner
JMP BodyInside : JMP HeadInside : JMP WallFeet : JMP WallBody
MarioBelow:
MarioAbove:
MarioSide:
TopCorner:
BodyInside:
HeadInside:
print "plus test ",pc
BRA +
%MacroLabelTest()
+
SpriteV:
SpriteH:
MarioCape:
MarioFireball:
WallFeet:
WallBody:
RTL
- And on the created routine file named MacroLabelTest.asm, I've added this code:
- Then I inserted the block into the ROM, I then run the game using bsnes plus, and breakpointed the address shown on the tooltip on Lunar Magic, after the
breakpoint have fired, I've look at the executed code using "step":
Code90802d bra $8048 [908048] A:8024 X:0000 Y:0001 S:01e7 D:0000 DB:90 nvMXdiZc V: 24 H: 23 F:11 ;>In block code
908048 nop A:8024 X:0000 Y:0001 S:01e7 D:0000 DB:90 nvMXdiZc V: 24 H: 28 F:11 ;\in routine file
908049 nop A:8024 X:0000 Y:0001 S:01e7 D:0000 DB:90 nvMXdiZc V: 24 H: 32 F:11 ;|
90804a nop A:8024 X:0000 Y:0001 S:01e7 D:0000 DB:90 nvMXdiZc V: 24 H: 35 F:11 ;|
90804b rtl A:8024 X:0000 Y:0001 S:01e7 D:0000 DB:90 nvMXdiZc V: 24 H: 39 F:11 ;/
- I noticed that the BRA jumps into the subroutine code rather than jumping to the + after %MacroLabelTest() inside the block code.
Right now, in case if other asm makers uses macros, stick to using main labels (that does not use the same main label as any of them inside the macro) until this is fixed. It literally treats as if any types of label (main labels, +/- and .sublables) exist outside the %callmacro(). I even tested by replacing all the + with
screwy (main label) in both the block's and routine's while keeping the routine filename as
MacroLabelTest.asm and it errors out saying
screwy is redefined, even when
screwy label doesn't physically exist 2+ times in the block file (outside the macro) itself.
EDIT: Feature request - can you add sublabels for macro labels that prefixed with "?"? It mentions about using "?":
Originally posted by xkas.htmlLastly, there are labels specifically for macros. They are identical to real labels, and begin with a ?
Example: ?label:
Edit: According to alcaro:
Originally posted by Alcaro on Dischordasar macros are just copypasting the contents right into where they're called, no smarts whatsoever
exceptions: macrolabels (but they're still ugly hacks), and error messages (though they're still fairly limited)
Give thanks to RPG hacker for working on Asar.