ITotalJustice / notorious_beeg

gba emulator written in c++23
https://notorious-beeg.netlify.app/
GNU General Public License v3.0
41 stars 4 forks source link

[banjo kazooie - grunty revenge] invalid opcode executed (thumb 0xEE00) #44

Closed ITotalJustice closed 2 years ago

ITotalJustice commented 2 years ago

crashes after this frame image

1110111000000000 which doesn't match anything in the arm.pdf.

havent checked where it's executing from, shouldnt be too hard to debug either. check the pc, if not rom, check any dmas that should happen to that region, and trace back the error

ITotalJustice commented 2 years ago

had ago at debugging this.

the fault seems to be around when the game executes mov pc, lr (0x46F7) which jumps to 0x0800322E.

the game does this jump numerous times, the opcode causing it is bx r0 (0x4700), however the where it seems to break is with the opcode above.

tracking down the 0x46F7 seems that this opcode shouldnt be executed anyway, so the bug is further back.

so next thing is break on the first 0x46F7 and trace everything back. not sure how far to trace back, ideally to the last known working state, but idk what that is either. so i guess trace back and step backwards through everything and see if anything is broken.

ITotalJustice commented 2 years ago

this is fixed locally.

basically, bit4 of the psr is always set, meaning the mode minimum value is always 16.

image

thanks to fleroviux for explaining it to me.