[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Switch Case Loop Slower For Emulator
> 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.
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?
Bryan Parkoff
BParkoff@satx.rr.com