Date : Mon, 25 Jul 1994 09:28:24 WET DST
From : Bonfield James <jkb@...>
Subject: Re: Beeb Emulators
Stephen Quan writes:
> opcode = 0xa9;
> switch (opcode)
> {
> case 0x00 : PC += 0x00; break; /* fake execution of opcode 0x00. */
> case 0x01 : PC += 0x01; break; /* fake execution of opcode 0x01. */
> ....
> case 0xff : PC += 0xff; break; /* fake execution of opcode 0xff. */
> }
> }
> }
>
>This code executed on my PC in 50 seconds when compiled exactly the
>same way as my emulator. Meaning that the execution cycle of our
>emulator only account for 9 seconds in 59. If optimisations are to
I tried using gcc with:
-O2 -fforce-mem -fforce-addr -ffast-math -fomit-frame-pointer -fcaller-saves
Much of those were just experimental tests, but the -fomit-frame-pointer in
particular is important. With this, I found that the switch system, and the
'opcode[x]()' systems were implemented in exactly the same manner - by a large
lookup table and a jump. The lookups didn't seem to be particularly complex
either. I'm suprised at the 50/59 seconds result! Maybe this will help aim our
directions to the real slow down.
James B