I have a new idea for CPU emulation. I think that this method may already exist but I am not too sure. Let's say, instead of having a switch/case table that is used every time for an opcode fetch, the PRG-ROM is decoded into a cache of memory, and then the x86's PC is set to that memory location and this eliminates the need for the switch/case table.
Example;
When the ROM is loaded the emulator processes the ROM data into an area of memory that stores x86 code.
int temp = 0;
void ADC_Immediate()
{
_asm {
store x86 code for ADC Immediate in cache...
}
}
switch(opcode)
{
...
case 0x69: ADC_Immediate(); break;
...
}
Is this method possible?
Example;
Code:
Instead of...
void ADC_Immediate()
{
getbyte();
a += ...
pc += 2;
cc += 2;
}
switch(opcode)
{
...
case 0x69: ADC_Immediate(); break;
...
}
void ADC_Immediate()
{
getbyte();
a += ...
pc += 2;
cc += 2;
}
switch(opcode)
{
...
case 0x69: ADC_Immediate(); break;
...
}
When the ROM is loaded the emulator processes the ROM data into an area of memory that stores x86 code.
Code:
int temp = 0;
void ADC_Immediate()
{
_asm {
store x86 code for ADC Immediate in cache...
}
}
switch(opcode)
{
...
case 0x69: ADC_Immediate(); break;
...
}
Is this method possible?