Merge pull request #1762 from MrCheeze/ackbar

Implemented the remaining N64 R4300 trap instructions besides TEQ
This commit is contained in:
adelikat 2020-01-11 15:32:54 -06:00 committed by GitHub
commit a1e7035b70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 155 additions and 10 deletions

View File

@ -978,10 +978,30 @@ void gendsubu()
{ {
} }
void gentge()
{
}
void gentgeu()
{
}
void gentlt()
{
}
void gentltu()
{
}
void genteq() void genteq()
{ {
} }
void gentne()
{
}
void gendsll() void gendsll()
{ {
} }

View File

@ -354,6 +354,46 @@ DECLARE_INSTRUCTION(DSUBU)
ADD_TO_PC(1); ADD_TO_PC(1);
} }
DECLARE_INSTRUCTION(TGE)
{
if (rrs >= rrt)
{
DebugMessage(M64MSG_ERROR, "trap exception in TGE");
//stop=1;
}
ADD_TO_PC(1);
}
DECLARE_INSTRUCTION(TGEU)
{
if ((unsigned long long)rrs >= (unsigned long long)rrt)
{
DebugMessage(M64MSG_ERROR, "trap exception in TGEU");
//stop=1;
}
ADD_TO_PC(1);
}
DECLARE_INSTRUCTION(TLT)
{
if (rrs < rrt)
{
DebugMessage(M64MSG_ERROR, "trap exception in TLT");
//stop=1;
}
ADD_TO_PC(1);
}
DECLARE_INSTRUCTION(TLTU)
{
if ((unsigned long long)rrs < (unsigned long long)rrt)
{
DebugMessage(M64MSG_ERROR, "trap exception in TLTU");
//stop=1;
}
ADD_TO_PC(1);
}
DECLARE_INSTRUCTION(TEQ) DECLARE_INSTRUCTION(TEQ)
{ {
if (rrs == rrt) if (rrs == rrt)
@ -364,6 +404,16 @@ DECLARE_INSTRUCTION(TEQ)
ADD_TO_PC(1); ADD_TO_PC(1);
} }
DECLARE_INSTRUCTION(TNE)
{
if (rrs != rrt)
{
DebugMessage(M64MSG_ERROR, "trap exception in TNE");
//stop=1;
}
ADD_TO_PC(1);
}
DECLARE_INSTRUCTION(DSLL) DECLARE_INSTRUCTION(DSLL)
{ {
rrd = rrt << rsa; rrd = rrt << rsa;

View File

@ -306,7 +306,12 @@ typedef struct _cpu_instruction_table
void (*SYSCALL)(void); void (*SYSCALL)(void);
// Exception instructions // Exception instructions
void (*TGE)(void);
void (*TGEU)(void);
void (*TLT)(void);
void (*TLTU)(void);
void (*TEQ)(void); void (*TEQ)(void);
void (*TNE)(void);
// Emulator helper functions // Emulator helper functions
void (*NOP)(void); // No operation (used to nullify R0 writes) void (*NOP)(void); // No operation (used to nullify R0 writes)

View File

@ -373,7 +373,12 @@ static cpu_instruction_table pure_interpreter_table = {
SYSCALL, SYSCALL,
TGE,
TGEU,
TLT,
TLTU,
TEQ, TEQ,
TNE,
NOP, NOP,
RESERVED, RESERVED,

View File

@ -523,7 +523,12 @@ const cpu_instruction_table cached_interpreter_table = {
SYSCALL, SYSCALL,
TGE,
TGEU,
TLT,
TLTU,
TEQ, TEQ,
TNE,
NOP, NOP,
RESERVED, RESERVED,

View File

@ -430,26 +430,30 @@ static void RDSUBU(void)
static void RTGE(void) static void RTGE(void)
{ {
dst->ops = current_instruction_table.NI; dst->ops = current_instruction_table.TGE;
recomp_func = genni; recomp_func = gentge;
recompile_standard_r_type();
} }
static void RTGEU(void) static void RTGEU(void)
{ {
dst->ops = current_instruction_table.NI; dst->ops = current_instruction_table.TGEU;
recomp_func = genni; recomp_func = gentgeu;
recompile_standard_r_type();
} }
static void RTLT(void) static void RTLT(void)
{ {
dst->ops = current_instruction_table.NI; dst->ops = current_instruction_table.TLT;
recomp_func = genni; recomp_func = gentlt;
recompile_standard_r_type();
} }
static void RTLTU(void) static void RTLTU(void)
{ {
dst->ops = current_instruction_table.NI; dst->ops = current_instruction_table.TLTU;
recomp_func = genni; recomp_func = gentltu;
recompile_standard_r_type();
} }
static void RTEQ(void) static void RTEQ(void)
@ -461,8 +465,9 @@ static void RTEQ(void)
static void RTNE(void) static void RTNE(void)
{ {
dst->ops = current_instruction_table.NI; dst->ops = current_instruction_table.TNE;
recomp_func = genni; recomp_func = gentne;
recompile_standard_r_type();
} }
static void RDSLL(void) static void RDSLL(void)

View File

@ -193,7 +193,12 @@ void gendadd(void);
void gendaddu(void); void gendaddu(void);
void gendsub(void); void gendsub(void);
void gendsubu(void); void gendsubu(void);
void gentge(void);
void gentgeu(void);
void gentlt(void);
void gentltu(void);
void genteq(void); void genteq(void);
void gentne(void);
void gendsrl(void); void gendsrl(void);
void gendsrl32(void); void gendsrl32(void);
void genbltz_idle(void); void genbltz_idle(void);

View File

@ -1041,11 +1041,36 @@ void gendsubu(void)
#endif #endif
} }
void gentge(void)
{
gencallinterp((unsigned int)cached_interpreter_table.TGE, 0);
}
void gentgeu(void)
{
gencallinterp((unsigned int)cached_interpreter_table.TGEU, 0);
}
void gentlt(void)
{
gencallinterp((unsigned int)cached_interpreter_table.TLT, 0);
}
void gentltu(void)
{
gencallinterp((unsigned int)cached_interpreter_table.TLTU, 0);
}
void genteq(void) void genteq(void)
{ {
gencallinterp((unsigned int)cached_interpreter_table.TEQ, 0); gencallinterp((unsigned int)cached_interpreter_table.TEQ, 0);
} }
void gentne(void)
{
gencallinterp((unsigned int)cached_interpreter_table.TNE, 0);
}
void gendsll(void) void gendsll(void)
{ {
#ifdef INTERPRET_DSLL #ifdef INTERPRET_DSLL

View File

@ -956,6 +956,26 @@ void gendsubu(void)
#endif #endif
} }
void gentge(void)
{
gencallinterp((unsigned long long)cached_interpreter_table.TGE, 0);
}
void gentgeu(void)
{
gencallinterp((unsigned long long)cached_interpreter_table.TGEU, 0);
}
void gentlt(void)
{
gencallinterp((unsigned long long)cached_interpreter_table.TLT, 0);
}
void gentltu(void)
{
gencallinterp((unsigned long long)cached_interpreter_table.TLTU, 0);
}
void genteq(void) void genteq(void)
{ {
#if defined(COUNT_INSTR) #if defined(COUNT_INSTR)
@ -964,6 +984,11 @@ void genteq(void)
gencallinterp((unsigned long long)cached_interpreter_table.TEQ, 0); gencallinterp((unsigned long long)cached_interpreter_table.TEQ, 0);
} }
void gentne(void)
{
gencallinterp((unsigned long long)cached_interpreter_table.TNE, 0);
}
void gendsll(void) void gendsll(void)
{ {
#if defined(COUNT_INSTR) #if defined(COUNT_INSTR)

Binary file not shown.