Hi, I've finally implemented my SPC700 core, but no DSP
yet... I've gotten it up to the point where I can bypass the CMP $2140/BNE $FB loop where it checks for the SPC700 ready value without hard coding everything... Basically, the CPU and APU can now sort of "talk to each other" by reading the memory-mapped IO ports.
But I'm trying to wrap my head around how the main CPU and APU loop should execute... Right now I am doing it in a dumb way by executing one instruction of the CPU and APU at a time... Kind of like this:
So basically I am running 1 instruction of the CPU, then handing off to 1 instruction of the APU. I am counting the instruction cycles internally. My wonder is... How am I supposed to actually correctly execute the main system loop?
Is there a set number of instructions, or cycles I should be executing the CPU before executing the APU? I read something about emulator "catch-up" on the NESDev wiki, but I am not sure how to implement it.
Also I am aware that the chips on the SNES do execute in parallel... so I figure that executing each chip one instruction at a time sort of "emulates" this effect on a much faster machine. I am developing on a dual-core Core i7 3.0GHz (2014 MacBook Pro).
I have actually implemented by CPU and APU at the opcode level.. Which basically is a big switch statement that interprets the current opcode byte and increments the program counter registers by the length of the expected instruction.