CX16 Emulator speed vs Ultimate 64 8MHz

Chat about anything CX16 related that doesn't fit elsewhere
Post Reply
TomXP411
Posts: 1785
Joined: Tue May 19, 2020 8:49 pm

CX16 Emulator speed vs Ultimate 64 8MHz

Post by TomXP411 »


So there were some questions a while back about the emulator performance, specifically whether the emulator on PC truly runs the virtual computer at 8MHz.

On a totally unrelated note, Gideo recently released an update for the Ultimate 64. The U64 now has a selectable clock rate, going up to 48MHz. It has several clock speeds available, including 8MHz. 

What a great opportunity to compare the Commander X16 and a real (FPGA) 8MHz 6502 CPU!!

So I set the clock speed on the Ultimate to 8MHz, and I load OLEG IMANILOV's benchmark program (available on Github) and ran the two. The Commander and the Commodore ran at almost exactly the same speed. The numbers were slightly different, since the clock on one of the two machines doesn't quite match real time (that's another experiment for later), but the results are conclusive: the emulator can be relied on for 8MHz 6502 benchmarks and performance testing. 

Now to figure out how to get an 80 column display on the Ultimate 64....

 

User avatar
StephenHorn
Posts: 565
Joined: Tue Apr 28, 2020 12:00 am
Contact:

CX16 Emulator speed vs Ultimate 64 8MHz

Post by StephenHorn »


The answer to your question is more complicated than that. If you're simply referring to a realtime comparison, then it depends on whether the emulator is able to run at full speed on the PC you're on, or whether it's getting stalled (probably on rasterizing display lines from the VERA). Emulator performance is a work in progress, but we seem to be at "good enough" with the optimizations that got pulled into the web emulator. The official build (r37) is less optimized, in part because the guy who had been driving the latest round of optimizations seems to have dropped off without finalizing his optimizations, and I never submitted a pull request for my version of the optimizations.

If your PC or other device isn't fast enough to run the emulator at full speed, then the emulator won't run at full speed. It will try to signal this to you by changing the title of the window, to indicate the percentage speed it's managing.

Of course, the emulator caps its simulation to 8 million cycles/second. Or, more specifically, to "however many cycles execute until the VERA emulation signals that it's time to present the next frame", after which it tells the graphics library to do that, then checks the time and asks the OS to briefly suspend process execution until 16ms have elapsed since the start of the frame we're presenting. (16ms = 60 frames per second).

But regardless of whether the emulator is running at full speed, it is *simulating* the CPU running at 8MHz, and the VERA running at a pixel frequency of 25.175MHz, by alternating between stepping the CPU by 1 instruction and then stepping the VERA and other components by "however long that instruction took". We believe this is doing a good job with accuracy, and we've seen at least a few bits of software running unmodified on real hardware, even though they were entirely written and tested for the emulator, including Chase Vault and a couple of prototype music demos.

Developer for Box16, the other X16 emulator. (Box16 on GitHub)
I also accept pull requests for x16emu, the official X16 emulator. (x16-emulator on GitHub)
TomXP411
Posts: 1785
Joined: Tue May 19, 2020 8:49 pm

CX16 Emulator speed vs Ultimate 64 8MHz

Post by TomXP411 »


Thanks for that explanation, Stephen. 



I think maybe I could have picked a better topic title, since I wasn't so much asking a question as demonstrating a fact... When I did some simple memory benchmarks, there was some contention (I think on the FB group) about whether the emulator speed reflected the real thing. Demonstrating its similarity to real hardware (ie: the U64) was one way of proving to the naysayers that yes, the emulator does in fact simulate the CPU correctly at 8Mhz. 

And, of course, knowing the U64 can effectively simulate a 48MHz 6510 makes me long for a 48MHz FPGA Commander.... just because.  ?

 

 

Perifractic
Posts: 511
Joined: Sat Apr 25, 2020 4:53 pm

CX16 Emulator speed vs Ultimate 64 8MHz

Post by Perifractic »

So there were some questions a while back about the emulator performance, specifically whether the emulator on PC truly runs the virtual computer at 8MHz. On a totally unrelated note, Gideo recently released an update for the Ultimate 64. The U64 now has a selectable clock rate, going up to 48MHz. It has several clock speeds available, including 8MHz.  What a great opportunity to compare the Commander X16 and a real (FPGA) 8MHz 6502 CPU!! So I set the clock speed on the Ultimate to 8MHz, and I load OLEG IMANILOV's benchmark program (available on Github) and ran the two. The Commander and the Commodore ran at almost exactly the same speed. The numbers were slightly different, since the clock on one of the two machines doesn't quite match real time (that's another experiment for later), but the results are conclusive: the emulator can be relied on for 8MHz 6502 benchmarks and performance testing.  Now to figure out how to get an 80 column display on the Ultimate 64....  
Very cool test! It's interesting also that the benchmark program is compatible with the X16 emulator without modification.  
TomXP411
Posts: 1785
Joined: Tue May 19, 2020 8:49 pm

CX16 Emulator speed vs Ultimate 64 8MHz

Post by TomXP411 »



38 minutes ago, Perifractic said:




Very cool test! It's interesting also that the benchmark program is compatible with the X16 emulator without modification.



 



Thanks. I believe Oleg wrote the program on the CX16 emulator, and I modified it a little bit to run on the 64. Mostly, I just changed the column widths and the text to make it fit in 40 columns. But it was cool that I was able to write the program on the CX16 emulator, save the PRG, and load the PRG uncanged on my U64. 

I also ran my prime number tester, but it runs so fast on the Ultimate that it's a pointless test. I'm thinking about writing a new series of benchmarks that does a specific set of operations for a period of time, say 5 seconds, and then counts the results. 



For example:



100 I=0

110 I=I+1:A=23 / 14:IF TI<300 THEN 110

120 PRINT I

This has the advantage of working on any CPU at any speed, and the test runs in a fixed amount of time. 

 

Post Reply