
pushpc
org $123456
derp:
pullpc
->
derp = $123456
<blm> zsnes users are the flatearthers of emulation
macro include_once(target, base, offset) if !<base> != 1 !<base> = 1 pushpc if read3(<offset>+$03E05C) != $FFFFFF <base> = read3(<offset>+$03E05C) else freecode cleaned <base>: print " Routine: <base> inserted at $",pc incsrc <target> ORG <offset>+$03E05C dl <base> endif pullpc endif endmacro !Aiming = 0 macro Aiming() %include_once("routines/Aiming.asm", Aiming, $00) JSL Aiming endmacro
?macrolabel: blah ?.macrosublabel: blah
!Define = $1234 pushdefine !Define = $4567 pulldefine ;!Define now equals $1234 here.
freecode code: lda.b #10 ;code inserted at some freespace sei xba pushpc org $008000 ;completely unrelated code, but you wanted to insert it here because you're lazy and unorganized. nop #2 pullpc asl ;resume the code before the push/pull pc ldy #$00 wdm pushpc freedata align ;it also lets you to use freedata/freecode incbin some_stuff.bin pullpc brk #$00 stp bra $FF ;resume the code before the push/pull pc
incsrc "<relative path>" !Define = $1234 incsrc "<relative path>" ;^restore the defines back. Must be ;the same as the first incsrc path ;for the same file. Avoid putting ;SNES code in the defines, ;its a waste of space
;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
+ NOP NOP NOP RTL
90802d 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 ;/
JSL MacroLabelTest pushpc freecode cleaned MacroLabelTest: incsrc "routines/MacroLabelTest.asm" pullpc
MacroLabelTest = read3($xxxxxx) ; from some address
macro include_once(target, base, offset) if !__<base>__ != 1 !__<base>__ = 1 pushpc if read3(<offset>+$03E05C) != $FFFFFF <base> = read3(<offset>+$03E05C) else freecode cleaned namespace __<base>__ <base>: print " Routine: <base> inserted at $",pc incsrc <target> namespace off org <offset>+$03E05C namespace __<base>__ dl <base> namespace off endif pullpc endif endmacro