toobig1 said:
SH7604,It's of too many registers,it seems much more difficult than i supposed to emulate it.
That's just an SH-2 without all the cool transformation stuff like the SH-4 (several generations later) which was in the Dream Cast (now dead cast). It has 16 bit opcodes so decoding them shouldn't be too bad at least.
The fun stuff happens when you want to try something new.
My Suggestion is first go through the opcodes and look for a pattern to the decoding (always there is one). Then after this you take the major opcode IDS IE Add rx,ry might decode to
This opcode is say ADD R0,R1
Code:
ADD R0 R1
000100 00000 00001
If you know the size of R0 and R1 you add them and place the result in R0 in your code. However instead of having 65536 lines of switch statements, this one will roll 1024 possible lines into one because.
Code:
case SH2_ADD:
DST = OPC_DEST(Code);
SRC = OPC_SRC(Code);
REG.R[DST] += REG.R[SRC];
break;
if for example there are signed and unsigned adds then you might also want to make UR[] and IR[] in a union so they overlay each other as well
Anyhow.. the number of registers shouldn't be the problem it's the number of possible opcodes that will be the real problem. AMD's new hammer processor has 16 General purpose 64bit registers. The 68000 had 16 16 bit registers and 16 32 bit.. trust me lots of registers is a NON issue. Opcodes is the fun stuff.
Cyb