RPGHacker / asar

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

Using spcblock messes up pc #322

Open Domkeykong opened 3 months ago

Domkeykong commented 3 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 3 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