You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not sure if this is an mGBA issue or an issue in MEGA_EXE3_BLA3XE, but sometimes, if the ISR is triggered after a software breakpoint, it can return control to the same PC and re-execute the same instruction, causing the breakpoint handler to execute twice.
To reproduce this, enter a battle using the patched MEGA_EXE3_BLA3XE ROM (replace 0x0000643E with EF BE, should be 04 1C originally) and sometimes you can get this trace where ThumbStep will run 0x0000643E twice:
trace ThumbStep: pc = 08006440, lr = 08008829, opcode = beef
trace ThumbStep: pc = 03005f2e, lr = 03005f00, opcode = 4770
trace ThumbStep: pc = 08006440, lr = 08008829, opcode = beef
trace ThumbStep: pc = 08006440, lr = 08008829, opcode = 1c04
trace end
Weirdly enough though, this doesn't seem to happen in BN4, 5, or 6.
The text was updated successfully, but these errors were encountered:
The interrupt in question being fired looks like it's hblank, which isn't enabled in BN456 which explains why I haven't seen it there.
I'm not 100% sure on this (this doesn't explain why the instruction gets double executed) but here is my working theory:
Software breakpoint is triggered, entering the breakpoint handler and ARMRunFake replaces the CPU prefetch,
If the software breakpoint causes cycles to exceed the cycles for the next event, the hblank ISR routine is entered and the PC + prefetch are clobbered,
When we return, we never see the effects of the ARMRunFake in the breakpoint handler since the ISR ate it.
bigfarts
changed the title
Software breakpoints sometimes get hit twice in Mega Man Battle Network 3 Blue (MEGA_EXE3_BLA3XE)
Software breakpoints get hit twice if the ISR executed directly after the breakpoint instruction
Jun 11, 2022
I'm not sure if this is an mGBA issue or an issue in MEGA_EXE3_BLA3XE, but sometimes, if the ISR is triggered after a software breakpoint, it can return control to the same PC and re-execute the same instruction, causing the breakpoint handler to execute twice.
See this Gist for tracing: https://gist.github.com/bigfarts/edc75b8c207cbf76c98e336cfa2948ef
To reproduce this, enter a battle using the patched MEGA_EXE3_BLA3XE ROM (replace
0x0000643E
withEF BE
, should be04 1C
originally) and sometimes you can get this trace where ThumbStep will run0x0000643E
twice:Weirdly enough though, this doesn't seem to happen in BN4, 5, or 6.
The text was updated successfully, but these errors were encountered: