-// cycles after syscall/hle?
// pending_exception?
+// swi 0 in do_unalignedwritestub?
#include <stdio.h>
#include "emu_if.h"
//#define evprintf printf
#define evprintf(...)
-//#define DRC_DBG
-
char invalid_code[0x100000];
void MTC0_()
{
extern void psxMTC0();
- printf("ari64 MTC0 %08x\n", psxRegs.code);
+ memprintf("ari64 MTC0 %08x\n", psxRegs.code);
psxMTC0();
pending_exception = 1; /* FIXME? */
}
void gen_interupt()
{
evprintf("ari64_gen_interupt\n");
- evprintf(" +ge %08x, %d->%d\n", psxRegs.pc, Count, next_interupt);
+ evprintf(" +ge %08x, %d->%d\n", psxRegs.pc, psxRegs.cycle, next_interupt);
#ifdef DRC_DBG
psxRegs.cycle += 2;
-#else
- psxRegs.cycle = Count; // stupid
#endif
psxBranchTest();
- if (psxRegs.cycle != Count) {
- printf("psxRegs.cycle != Count: %d != %d\n", psxRegs.cycle, Count);
- Count = psxRegs.cycle;
- }
-
- next_interupt = Count + psxNextCounter;
- evprintf(" -ge %08x, %d->%d\n", psxRegs.pc, Count, next_interupt);
+ next_interupt = psxNextsCounter + psxNextCounter;
+ evprintf(" -ge %08x, %d->%d\n", psxRegs.pc, psxRegs.cycle, next_interupt);
pending_exception = 1; /* FIXME */
}
void (*writememb[0x10000])();
void (*writememh[0x10000])();
+void *gte_handlers[64];
+
+/* from gte.txt.. not sure if this is any good. */
+const char gte_cycletab[64] = {
+ /* 1 2 3 4 5 6 7 8 9 a b c d e f */
+ 0, 15, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 6, 0, 0, 0,
+ 8, 8, 8, 19, 13, 0, 44, 0, 0, 0, 0, 17, 11, 0, 14, 0,
+ 30, 0, 0, 0, 0, 0, 0, 0, 5, 8, 17, 0, 0, 5, 6, 0,
+ 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 39,
+};
static int ari64_init()
{
+ extern void (*psxCP2[64])();
+ extern void psxNULL();
size_t i;
+
new_dynarec_init();
for (i = 0; i < sizeof(readmem) / sizeof(readmem[0]); i++) {
writemem[i] = write_mem32;
}
- psxHLEt_addr = (void *)psxHLEt;
+ for (i = 0; i < sizeof(gte_handlers) / sizeof(gte_handlers[0]); i++)
+ if (psxCP2[i] != psxNULL)
+ gte_handlers[i] = psxCP2[i];
+
+ psxHLEt_addr = (void *)psxHLEt; // FIXME: rm
+ return 0;
}
static void ari64_reset()
static void ari64_execute()
{
- /* TODO: get rid of this cycle counter copying */
- Count = psxRegs.cycle;
- next_interupt = Count + psxNextCounter;
+ next_interupt = psxNextsCounter + psxNextCounter;
evprintf("psxNextsCounter %d, psxNextCounter %d\n", psxNextsCounter, psxNextCounter);
- evprintf("ari64_execute %08x, %d->%d\n", psxRegs.pc, Count, next_interupt);
- new_dyna_start(psxRegs.pc);
- evprintf("ari64_execute end %08x, %d->%d\n", psxRegs.pc, Count, next_interupt);
-
-#ifndef DRC_DBG
- psxRegs.cycle = Count;
-#endif
+ evprintf("ari64_execute %08x, %d->%d\n", psxRegs.pc, psxRegs.cycle, next_interupt);
+ new_dyna_start();
+ evprintf("ari64_execute end %08x, %d->%d\n", psxRegs.pc, psxRegs.cycle, next_interupt);
}
static void ari64_clear(u32 Addr, u32 Size)