[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Switch Case Loop Slower For Emulator
"Bryan Parkoff" <BParkoff@satx.rr.com> wrote in message
SPidnUW3adArBjWjXTWQkQ@giganews.com">news:SPidnUW3adArBjWjXTWQkQ@giganews.com...
> > Go one step further and create a table which is word indexed according
> > to opcode and the following byte.
> > You can then do a direct jump to an opcode handling routine and pass it
> > the operand (in the case of single byte operands).
> > This saves an extra memory fetch for the operand as well.
> I agree with you, but some opcodes are not used frequently. For
> example, Intel has over 50,000 opcodes that it has to emulate on PC Power
or
> 68xxx. It will be very slow.
Only 256 (or less, depending on which 6502 model you are emulating)
> There is another way. Add 8 bytes (Not Bit) in this table that uses
> DWORD indexed. First DWORD will be opcode. Second DWORD will be pointer
> address to each opcode's Jump Address Location. It will use only one IF
> THEN statement instead of switch case statement. It will run much faster
> with frequent opcodes better than infrequent opcodes.
> Table with DWORD indexed should use dymanic memory instead of static
> memory. New opcode will be added every time Table with DWORD indexed will
> be removed from dymanic memory before it will be created back to dymanic
> memory. It might increase the performance with frequency opcodes.
> What do you think?
I think the best speed increases would be gained from doing a 6502 JIT
emulator version.
Seems a lot of hard work for not a great deal in return.
My 2GHz P4 will emulate the GS (using Kegs) at well over 125MHz equivalent
speed.
I have to throttle it to 80MHz, otherwise there appear to be problems with
the pointer being correctly updated in GSOS.
Red