changed EI handling a bit and types
[picodrive.git] / cpu / cz80 / cz80.c
index 461b46a..20e8053 100644 (file)
 #include "cz80.h"\r
 \r
 #if PICODRIVE_HACKS\r
+#undef EMU_M68K\r
 #include <Pico/PicoInt.h>\r
 #endif\r
 \r
 #ifndef ALIGN_DATA\r
+#ifdef _MSC_VER\r
+#define ALIGN_DATA\r
+#define inline\r
+#undef  CZ80_USE_JUMPTABLE\r
+#define CZ80_USE_JUMPTABLE 0\r
+#else\r
 #define ALIGN_DATA      __attribute__((aligned(4)))\r
 #endif\r
+#endif\r
 \r
 #define CF                                     0x01\r
 #define NF                                     0x02\r
@@ -234,6 +242,7 @@ INT32 Cz80_Exec(cz80_struc *CPU, INT32 cycles)
        UINT32 res;\r
        UINT32 val;\r
        int afterEI = 0;\r
+       union16 *data;\r
 \r
        PC = CPU->PC;\r
 #if CZ80_ENCRYPTED_ROM\r
@@ -247,7 +256,8 @@ INT32 Cz80_Exec(cz80_struc *CPU, INT32 cycles)
 Cz80_Exec:\r
                if (CPU->ICount > 0)\r
                {\r
-                       union16 *data = pzHL;\r
+Cz80_Exec_nocheck:\r
+                       data = pzHL;\r
                        Opcode = READ_OP();\r
 #if CZ80_EMULATE_R_EXACTLY\r
                        zR++;\r
@@ -262,6 +272,8 @@ Cz80_Check_Interrupt:
                        if (CPU->IRQState != CLEAR_LINE)\r
                        {\r
                                CHECK_INT\r
+                               CPU->ICount -= CPU->ExtraCycles;\r
+                               CPU->ExtraCycles = 0;\r
                        }\r
                        goto Cz80_Exec;\r
                }\r