Comment by zeta0134
15 hours ago
Now that I can finally test on hardware, I completely rewrote input handling. I can now support original NES controllers, but also SNES and the Power Pad dance mat, for anyone crazy enough to try that. The hardest part was working around a particularly nasty hardware bug: if you try to read the input ports on even cycles while one of the sound channels is playing, the data becomes corrupted. Perform the exact same read on an odd cycle and it works every time.
The solution? Have the cartridge keep track of CPU parity (there's no simple way to do this with just the CPU), then check that, skip one cycle if needed... and very carefully cycle time the rest of the routine, making sure that your reads land on safe cycles, and your writes land in places that won't throw off the alignment.
But it works! It's quite reliable on every console revision I've thrown it at so far. Suuuper happy with that.
No comments yet
Contribute on Hacker News ↗