Super Mario triggers hidden blocks
Moderator: Moderators
Super Mario triggers hidden blocks
I've been working on my emulator https://github.com/w1n5t0n99/rustnes and Super Mario has an odd glitch I haven't been able to track down. Every time Mario jumps he triggers an invisible box. He will climb invincible steps and eventually fall in invisible hole. Visually everything appears as it should and my CPU passes nestest. Any help would be greatly appreciated.
Re: Super Mario triggers hidden blocks
I would recommend running blargg's tests (especially "instr_test_v5"), since there are apparently several potential bugs that "nestest" fails to detect.
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.
P.S. If you don't get this note, let me know and I'll write you another.
Re: Super Mario triggers hidden blocks
Thanks for the tip. It seems ADC, RRA, and AXS are failing. I imagine it's a flag but I'm not sure what Blaarg is checking for that nestest isn't.Quietust wrote: ↑Tue May 04, 2021 12:56 pm I would recommend running blargg's tests (especially "instr_test_v5"), since there are apparently several potential bugs that "nestest" fails to detect.
Re: Super Mario triggers hidden blocks
Your logic for setting the Overflow flag is incorrect:
Code: Select all
cpu.a = result;
if ((cpu.ops.dl ^ result) & (cpu.a & result) & 0x80) == 0x80 { cpu.p.set(StatusRegister::OVERFLOW, true) } else { cpu.p.set(StatusRegister::OVERFLOW, false) };
Second, the correct expression for Overflow should be (~(cpu.a ^ cpu.ops.dl) & (cpu.a ^ result) & 0x80).
Looking at nestest, it appears to test the following expressions:
- 0 + 105 = 105 -> no overflow
- 1 + 105 + C = 107 -> no overflow
- 127 + 127 + C = -1 -> overflow
- 127 + -128 = -1 -> no overflow
- 127 + -128 + C = 0 -> no overflow
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.
P.S. If you don't get this note, let me know and I'll write you another.