X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=cpu%2Fcz80%2Fcz80.c;h=091e2a5f9dd2474fe07461b5329901ba2883d384;hb=c8d1e9b66255c00a3bef7ca27ae019e3523d7a4b;hp=461b46a761826531ca25c0b791ebc89cf94c9ddb;hpb=b542be4686241c9e0722ff8e452980f9ac2b4d7c;p=picodrive.git diff --git a/cpu/cz80/cz80.c b/cpu/cz80/cz80.c index 461b46a..091e2a5 100644 --- a/cpu/cz80/cz80.c +++ b/cpu/cz80/cz80.c @@ -14,12 +14,20 @@ #include "cz80.h" #if PICODRIVE_HACKS -#include +#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 @@ -211,7 +219,10 @@ void Cz80_Reset(cz80_struc *CPU) #if PICODRIVE_HACKS static inline unsigned char picodrive_read(unsigned short a) { - return (a < 0x4000) ? Pico.zram[a&0x1fff] : z80_read(a); + unsigned long v = z80_read_map[a >> Z80_MEM_SHIFT]; + if (v & 0x80000000) + return ((z80_read_f *)(v << 1))(a); + return *(unsigned char *)((v << 1) + a); } #endif @@ -234,6 +245,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 @@ -247,7 +259,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++; @@ -262,6 +275,8 @@ Cz80_Check_Interrupt: if (CPU->IRQState != CLEAR_LINE) { CHECK_INT + CPU->ICount -= CPU->ExtraCycles; + CPU->ExtraCycles = 0; } goto Cz80_Exec; }