I've finally got the throttling code implemented in the 4004 emulation code. I can run it throttled or unthrottled, and below is unthrottled to see how fast it _can_ run. This is on a Windows 10 box, win32 console application. My task manager says the CPU is 1.69 GHz because I have my power mode set to balanced. The 4004 code is a single instruction that just jumps to itself. A two instruction cycle instruction. I am attaching the code so you can see how it measures and reports this. In the case of the jump instruction, it increases a variable called icycles for instruction cycles twice. The first instruction makes this a 2, and so on and so on as it runs.
When compiled for DOS and run on my Toshiba 1100plus - 8086 @ 7.16 MHz, the unthrottled speed is about 130000 Hz - so it takes about 55 8086 cycles to emulate one 4004 cycle. While I would have liked a bit more performance on this, it doesn't compare to the nearly 10:1 that I was able to obtain on an AVR for the 8080. That was obtained however by using the AVR's registers to directly hold many of the 8080 internals. Anyway, for DOS on the T1100 plus we are looking at 55:1. This makes sense to me.
What does not make sense to me is the WIN32 results. See below. Over 1 GHz running on a 1.69 GHz CPU. How can this be possible assuming there isn't something going on that I am missing. 1.7:1 ? It does not make sense. I've pasted some CPU step windows to show it does have to go through all the instructions as expected. I just don't see how it can do it so quickly.
When compiled for DOS and run on my Toshiba 1100plus - 8086 @ 7.16 MHz, the unthrottled speed is about 130000 Hz - so it takes about 55 8086 cycles to emulate one 4004 cycle. While I would have liked a bit more performance on this, it doesn't compare to the nearly 10:1 that I was able to obtain on an AVR for the 8080. That was obtained however by using the AVR's registers to directly hold many of the 8080 internals. Anyway, for DOS on the T1100 plus we are looking at 55:1. This makes sense to me.
What does not make sense to me is the WIN32 results. See below. Over 1 GHz running on a 1.69 GHz CPU. How can this be possible assuming there isn't something going on that I am missing. 1.7:1 ? It does not make sense. I've pasted some CPU step windows to show it does have to go through all the instructions as expected. I just don't see how it can do it so quickly.