Here's my timing test. This is a very crude test.
Code: Select all
*= $1000
LDA #$14 ; 2 - 20 million cycles
L1 JSR C1M ; 6
LDX $00 ; 3
DEA ; 2
BNE L1 ; 2/3
RTS ; 6
C1M LDY #$F8 ; 2 - 1 million Cycles
L4 JSR C1000 ; 6
JSR C1000 ; 6
JSR C1000 ; 6
JSR C1000 ; 6
LDX $10 ; 3
DEY ; 2
BNE L4 ; 2/3
LDX #$02 ; 2
L6 JSR C10 ; 6
DEX ; 2
BNE L6 ; 2/3
RTS ; 6
C1000 LDX #$2F ; 2 1000 Cycles
L7 JSR C10 ; 6
DEX ; 2
BNE L7 ; 2/3
NOP ; 2
NOP ; 2
NOP ; 2
RTS ; 6
C10 NOP ; 2 10 cycles
NOP ; 2
RTS ; 6
Sorry the formatting is off. This code executes exactly 20,000,000 cycles. To get more accuracy, I call it 100 times using this code:
Code: Select all
$800 LDA #$64
$802 PHA
JSR $1000
PLA
DEA
BNE $802
RTS
I then time the execution and divide to total cycles (2,000,000,000) by the time (~18 seconds) for 111MHz.
This is crude for many reasons. I am only using a small portion of 65C02 opcodes so am not testing every case. Also, the code at $800 adds ~2300 cycles to the total execution, but I don't count that (I'd rather fall slower than faster on my estimated speed.) Also, timing with a clock is no the most accurate, but it gets me a ballpark answer. Reading and writing to IO will also slow down the execution so if I were to cycle the LED within a loop, the apparent clock speed would most likely decrease.
I had originally thought of doing cycle counting and then use a system timer to throttle the execution to a fixed number. That would make a more stable platform for emulation of a "system", but at this stage I don't see a need.
Daryl