X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=cpu%2Fcz80%2Fcz80.c;h=20e8053fe93c9f3da85416e41ccc5b0c0088852f;hb=c299a73848342a745422a2e1980ed7fcf7960f26;hp=f2ab0032d952c03bf43449f0a99664f9c1145802;hpb=80db44425aa5b46185fb9a64520f4b6f5d494ba5;p=picodrive.git diff --git a/cpu/cz80/cz80.c b/cpu/cz80/cz80.c index f2ab003..20e8053 100644 --- a/cpu/cz80/cz80.c +++ b/cpu/cz80/cz80.c @@ -13,9 +13,21 @@ #include #include "cz80.h" +#if PICODRIVE_HACKS +#undef EMU_M68K +#include +#endif + #ifndef ALIGN_DATA +#ifdef _MSC_VER +#define ALIGN_DATA +#define inline +#undef CZ80_USE_JUMPTABLE +#define CZ80_USE_JUMPTABLE 0 +#else #define ALIGN_DATA __attribute__((aligned(4))) #endif +#endif #define CF 0x01 #define NF 0x02 @@ -203,6 +215,13 @@ void Cz80_Reset(cz80_struc *CPU) Cz80_Set_Reg(CPU, CZ80_PC, 0); } +/* */ +#if PICODRIVE_HACKS +static inline unsigned char picodrive_read(unsigned short a) +{ + return (a < 0x4000) ? Pico.zram[a&0x1fff] : z80_read(a); +} +#endif /*-------------------------------------------------------- CPUŽÀs @@ -223,6 +242,7 @@ INT32 Cz80_Exec(cz80_struc *CPU, INT32 cycles) UINT32 res; UINT32 val; int afterEI = 0; + union16 *data; PC = CPU->PC; #if CZ80_ENCRYPTED_ROM @@ -236,7 +256,8 @@ INT32 Cz80_Exec(cz80_struc *CPU, INT32 cycles) Cz80_Exec: if (CPU->ICount > 0) { - union16 *data = pzHL; +Cz80_Exec_nocheck: + data = pzHL; Opcode = READ_OP(); #if CZ80_EMULATE_R_EXACTLY zR++; @@ -251,6 +272,8 @@ Cz80_Check_Interrupt: if (CPU->IRQState != CLEAR_LINE) { CHECK_INT + CPU->ICount -= CPU->ExtraCycles; + CPU->ExtraCycles = 0; } goto Cz80_Exec; }