Romhacking.net

Romhacking => Programming => Topic started by: UltimateUrinater on July 08, 2016, 07:33:10 pm

Title: This snes assembly problem is hurting me.
Post by: UltimateUrinater on July 08, 2016, 07:33:10 pm
I dont know why. But after my emu (no$sns) runs the opcode:

ldx #8000      a2 00 80
nop                ea
.
Instead of jumping to the next instruction, which is of course the nop, it goes to the last byte of the "ldx #8000" opcode. Which makes the next instuction after ldx 8000 look like this:

bra  #ea       80 ea

I always set the index registers to 16 bit before i run this. But i guess it doesnt seem to recognize. Not sure if I have made a mistake, or if this is just a lil glitch within the emu itself
Title: Re: This snes assembly problem is hurting me.
Post by: Disch on July 08, 2016, 07:47:24 pm
Odds of it being the emu are extraordinarily slim.  More than likely you're either accidentally using SEP instead of REP -- or you're REP'ing the wrong flag, or your REP isn't executing (like, the game is jumping past it or something)

I'm not familiar with any SNES debuggers, but they should allow you to step through code and/or set breakpoints.  So step 1 here would be to set breakpoints on both your REP and on this LDX.  Make sure the REP is being hit first -- and once it is, step through and make sure the X flag isn't changing at any point between the REP and the LDX
Title: Re: This snes assembly problem is hurting me.
Post by: UltimateUrinater on July 08, 2016, 08:12:24 pm
 ;D ;D ;D ;D ;D ;D ;D ;D ;D

I fixed the problem....

I forgot to set the processor to native mode. All is well now thanks