famec hack, CPU debug in CD mode
[picodrive.git] / cpu / fame / famec.c
index 2549147..041413f 100644 (file)
@@ -28,6 +28,7 @@
 \r
 #define USE_CYCLONE_TIMING\r
 #define USE_CYCLONE_TIMING_DIV\r
+#define PICODRIVE_HACK\r
 // Options //\r
 \r
 \r
@@ -521,6 +522,10 @@ static u32 flag_I;
 \r
 static u32 initialised = 0;\r
 \r
+#ifdef PICODRIVE_HACK\r
+extern M68K_CONTEXT PicoCpuFS68k;\r
+#endif\r
+\r
 /* Custom function handler */\r
 typedef void (*opcode_func)(void);\r
 \r
@@ -793,6 +798,9 @@ int fm68k_emulate(s32 cycles)
        // won't emulate double fault\r
        // if (m68kcontext.execinfo & M68K_FAULTED) return -1;\r
 \r
+       // Cache PPL\r
+       flag_I = M68K_PPL;\r
+\r
        if (m68kcontext.execinfo & FM68K_HALTED)\r
        {\r
                if (interrupt_chk__() <= 0)\r
@@ -812,9 +820,6 @@ int fm68k_emulate(s32 cycles)
        // Cache SR\r
        SET_SR(m68kcontext.sr)\r
 \r
-       // Cache PPL\r
-       flag_I = M68K_PPL;\r
-\r
        // Fijar PC\r
        SET_PC(m68kcontext.pc)\r
 \r
@@ -943,8 +948,6 @@ init_jump_table:
 #endif\r
        u32 i, j;\r
 \r
-       m68kcontext.sr = 0x2704; // Z flag\r
-\r
        for(i = 0x0000; i <= 0xFFFF; i += 0x0001)\r
                JumpTable[0x0000 + i] = CAST_OP(0x4AFC);\r
        for(i = 0x0000; i <= 0x0007; i += 0x0001)\r