Greetings,
I am writing a 65c02 processor simulator. One thing that I do not know how
to do is emulate clock speed. First, the processor is a 1Mhz CPU that I'm
attempting to simulate (modern 6502's operate at 14MHz -- unless I'm
thinking of 65816's).
In either case, I need to calculate how many cycles to consume per second
depending on the speed of the simulated processor. I'm at a complete loss
as to go about "figuring" out how long a cycle should be represented on the
processor that the program is executing in. What I'm going to do, whether
this is the way it should be or not, is when each instruction is initially
decoded, also keep track of when the next instruction can be executed based
on the number of clock cycles the current instruction requires. This way, I
can simulate the speed. Anyway, is there a resource or example somewhere of
how I can determine this? I'm on an x86 processor.
Thanks,
Shawn