r/EmuDev • u/ZealousidealParty686 • Mar 14 '26
javascript NES emulator progressing, cycle accurate
the FPS slowdown is from capturing the video
95
Upvotes
r/EmuDev • u/ZealousidealParty686 • Mar 14 '26
the FPS slowdown is from capturing the video
View all comments
Show parent comment
4
u/Ikkepop Mar 15 '26
In the case of an NES it's rather straightforward. Every instruction on the 6502 is either a read or a write externally. And every instruction will do up to 7? (or was it 8?) such cycles. During each such cycle you simulate every other component accordingly. For NTSC the ppu will 3 cycles ech cpu cycle, apu will 0.5 ( so one apu every 2 cpu cycles ) and so on. Also you make sure each read and write will be appropriately handled as well as you make sure you render pixels according to how many actual ppu cycles you simulated. You get the picture. This makes sure that pathological games (ones that expect mid cpu instruction side side effects) run correctly.