X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=libpcsxcore%2Fnew_dynarec%2Femu_if.c;h=cd447263bdd01bbace19ea1d17364e7627b5ec1b;hb=b9b61529b6c9bf30a3146178e2dda31b15ff3614;hp=d0b991e28620cf1d9289d366e577e5996ac1430b;hpb=7139f3c8070e9aa14fd36c2451d7f10079caa37a;p=pcsx_rearmed.git diff --git a/libpcsxcore/new_dynarec/emu_if.c b/libpcsxcore/new_dynarec/emu_if.c index d0b991e2..cd447263 100644 --- a/libpcsxcore/new_dynarec/emu_if.c +++ b/libpcsxcore/new_dynarec/emu_if.c @@ -1,5 +1,5 @@ -// cycles after syscall/hle? // pending_exception? +// swi 0 in do_unalignedwritestub? #include #include "emu_if.h" @@ -11,15 +11,13 @@ //#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? */ } @@ -27,22 +25,15 @@ void MTC0_() 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 */ } @@ -100,10 +91,23 @@ void (*writemem[0x10000])(); 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++) { @@ -115,7 +119,12 @@ static int ari64_init() 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() @@ -126,18 +135,12 @@ 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)