RPGHacker / asar

(Now) official repository of the SNES assembler Asar, originally created by Alcaro
Other
204 stars 44 forks source link

Using spcblock messes up pc #322

Open Domkeykong opened 5 months ago

Domkeykong commented 5 months ago

Assembling the following code reproduces the error.

org $808000

print "pc: $",hex(pc())

spcblock $6000 nspc
endspcblock

print "pc: $",hex(pc())

prints:

pc: $808000
pc: $6000
hellow554 commented 4 months ago

Same behavoir for me. As a workaround I do this:

!PREVIOUS_PC #= pc()
spcblock $400 nspc
incsrc "spc/default.spc700.asm"
endspcblock execute spc_entry

base !PREVIOUS_PC+pc()-$400+4 ; $400 is the entry of the spc code
org pc()|$400000
undef "PREVIOUS_PC"

I have a hirom code, therefore I do the org pc()|400000 to set the address correctly