I'm now working on the PPU but having an issue trying to grasp how to actually do timing/drawing.
The CPU and the PPU have fixed frequencies. The frequency to on the CPU makes sense to me... The CPU executes instructions in memory, each having their own cycle counts.
The PPU, on the other hand, doesn't actually execute any instructions, yet it still has a clock rate. From the emulators perspective, I'm having difficulty trying to figure out what to do with the clock rate of the PPU, and tying that into drawing pixels on the screen.
My code is like this:
Code: Select all
while (1)
{
int cpu_cycles = execute_next_cpu_instruction();
wait_until_cpu_cycles_elapse(cpu_cycles);
}
If anyone has any advice or articles that they can point me to, I'd greatly appreciate it. Thanks.