TetrisGYM icon indicating copy to clipboard operation
TetrisGYM copied to clipboard

replace switch_s_plus_2a with branch macro

Open zohassadar opened this issue 1 year ago • 1 comments

See commit notes for details.

Interestingly this change causes this test to panic:

https://github.com/kirjavascript/TetrisGYM/blob/a222aa463090986c3ff7f82b9213bec791055d34/tests/src/nmi.rs#L59-L65

The first anomaly is that the the nmi + 25 points to line 15 here, not past oam staging as described.

https://github.com/kirjavascript/TetrisGYM/blob/a222aa463090986c3ff7f82b9213bec791055d34/src/nmi/nmi.asm#L11-L17

The second anomaly is that sleepCounter appears to be affected by where emu.run_until_vblank() stops. It appears as though the decrement happens in one frame but the following increment doesn't happen, causing subsequent frames to have a decrementing sleep counter. If run_until_vblank is replaced with a custom function that stops at scanline 243 instead, the test will pass.

zohassadar avatar Jan 25 '25 15:01 zohassadar

Forgot to mention, if the macro is modified to be padded with at least 4 nops, the test will also pass.

zohassadar avatar Jan 25 '25 15:01 zohassadar