Skip to content

Commit 0fbf328

Browse files
committed
[Interpreter] Fix REGIMM instructions (Fixes some Amidog tests)
1 parent 64032e7 commit 0fbf328

1 file changed

Lines changed: 11 additions & 8 deletions

File tree

src/core/psxinterpreter.cc

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,15 +1188,18 @@ const InterpretedCPU::intFunc_t InterpretedCPU::s_psxSPC[64] = {
11881188
&InterpretedCPU::psxNULL, &InterpretedCPU::psxNULL, &InterpretedCPU::psxNULL, &InterpretedCPU::psxNULL, // 3c
11891189
};
11901190

1191+
// The REGIMM instruction is actually valid for every single value that the rt field might have
1192+
// If the lowest bit of the rt field is 1 then the instruction is a BGEZ, otherwise it's a BLTZ.
1193+
// If ((_Rt_ >> 4) & 0xF) == 0x8 then the instruction should link the return address to $ra, otherwise not.
11911194
const InterpretedCPU::intFunc_t InterpretedCPU::s_psxREG[32] = {
1192-
&InterpretedCPU::psxBLTZ, &InterpretedCPU::psxBGEZ, &InterpretedCPU::psxNULL, &InterpretedCPU::psxNULL, // 00
1193-
&InterpretedCPU::psxNULL, &InterpretedCPU::psxNULL, &InterpretedCPU::psxNULL, &InterpretedCPU::psxNULL, // 04
1194-
&InterpretedCPU::psxNULL, &InterpretedCPU::psxNULL, &InterpretedCPU::psxNULL, &InterpretedCPU::psxNULL, // 08
1195-
&InterpretedCPU::psxNULL, &InterpretedCPU::psxNULL, &InterpretedCPU::psxNULL, &InterpretedCPU::psxNULL, // 0c
1196-
&InterpretedCPU::psxBLTZAL, &InterpretedCPU::psxBGEZAL, &InterpretedCPU::psxNULL, &InterpretedCPU::psxNULL, // 10
1197-
&InterpretedCPU::psxNULL, &InterpretedCPU::psxNULL, &InterpretedCPU::psxNULL, &InterpretedCPU::psxNULL, // 14
1198-
&InterpretedCPU::psxNULL, &InterpretedCPU::psxNULL, &InterpretedCPU::psxNULL, &InterpretedCPU::psxNULL, // 18
1199-
&InterpretedCPU::psxNULL, &InterpretedCPU::psxNULL, &InterpretedCPU::psxNULL, &InterpretedCPU::psxNULL, // 1c
1195+
&InterpretedCPU::psxBLTZ, &InterpretedCPU::psxBGEZ, &InterpretedCPU::psxBLTZ, &InterpretedCPU::psxBGEZ, // 00
1196+
&InterpretedCPU::psxBLTZ, &InterpretedCPU::psxBGEZ, &InterpretedCPU::psxBLTZ, &InterpretedCPU::psxBGEZ, // 04
1197+
&InterpretedCPU::psxBLTZ, &InterpretedCPU::psxBGEZ, &InterpretedCPU::psxBLTZ, &InterpretedCPU::psxBGEZ, // 08
1198+
&InterpretedCPU::psxBLTZ, &InterpretedCPU::psxBGEZ, &InterpretedCPU::psxBLTZ, &InterpretedCPU::psxBGEZ, // 0c
1199+
&InterpretedCPU::psxBLTZAL, &InterpretedCPU::psxBGEZAL, &InterpretedCPU::psxBLTZ, &InterpretedCPU::psxBGEZ, // 10
1200+
&InterpretedCPU::psxBLTZ, &InterpretedCPU::psxBGEZ, &InterpretedCPU::psxBLTZ, &InterpretedCPU::psxBGEZ, // 14
1201+
&InterpretedCPU::psxBLTZ, &InterpretedCPU::psxBGEZ, &InterpretedCPU::psxBLTZ, &InterpretedCPU::psxBGEZ, // 18
1202+
&InterpretedCPU::psxBLTZ, &InterpretedCPU::psxBGEZ, &InterpretedCPU::psxBLTZ, &InterpretedCPU::psxBGEZ // 1c
12001203
};
12011204

12021205
const InterpretedCPU::intFunc_t InterpretedCPU::s_psxCP0[32] = {

0 commit comments

Comments
 (0)