I figured, the NES is 40+ years old, shouldn’t be too hard to emulate it fast enough.
I was wrong. With the PPU generating garbage pixels (I’m not far enough along to run real games yet) I’m only getting 30fps on my iPhone 14 Pro.
I may have to lose some of the Swiftiness of my code to make it fast enough. It needs to run at 60fps (for NTSC) because the CPU and PPU and their numbers of clock cycles per frame are directly tied together.
I say “garbage” pixels and not “random” pixels because generating random pixels using UInt8.random() produced single-digit frames per second. Randomness is expensive!
I’ve got ROMs loading into my NES emulator (mapper 0 only for now) and things are extremely not working! Found a big ol’ bug in my jump instructions. I’m sure there are many more to come.
Update: there were bugs in like 8 of my instructions 🫣
The test ROM I’m using is insisting that I implement the illegal instructions, and I’m not interested in that right now, so on to trying to make graphics render. I’m even less sure what’s going wrong here.
Some things are working! (Other things are not (not pictured).)
A test ROM is running in my NES emulator. A checkerboard pattern and a rainbow pattern scroll as I hold the start button. A frames per second counter shows 49 FPS.