diff --git a/source/m68k/m68kCycleAccurate.h b/source/m68k/m68kCycleAccurate.h index ca07b08..97ef667 100644 --- a/source/m68k/m68kCycleAccurate.h +++ b/source/m68k/m68kCycleAccurate.h @@ -111,7 +111,7 @@ INLINE unsigned getDivu68kCycles( DWORD dividend, WORD divisor) } } - return mcycles * 2; + return mcycles * 14; } // @@ -133,7 +133,7 @@ INLINE unsigned getDivs68kCycles( LONG dividend, SHORT divisor) // Check for absolute overflow if( ((DWORD) abs( dividend) >> 16) >= (WORD) abs( divisor)) { - return (mcycles + 2) * 2; + return (mcycles + 2) * 14; } // Absolute quotient @@ -159,7 +159,7 @@ INLINE unsigned getDivs68kCycles( LONG dividend, SHORT divisor) aquot <<= 1; } - return mcycles * 2; + return mcycles * 14; } // @@ -171,14 +171,14 @@ INLINE unsigned getMulu68kCycles( WORD source) { int i; - unsigned mcycles = 38; + unsigned mcycles = 266; /* count number of bits set to 1 */ for( i = 0; i < 15; i++) { if (source & 1) { - mcycles += 2; + mcycles += 14; } source >>= 1; } @@ -196,7 +196,7 @@ INLINE unsigned getMuls68kCycles( SHORT source) { int i; - unsigned mcycles = 38; + unsigned mcycles = 266; /* detect 01 or 10 patterns */ LONG temp = source << 1; @@ -207,7 +207,7 @@ INLINE unsigned getMuls68kCycles( SHORT source) { if (source & 1) { - mcycles += 2; + mcycles += 14; } source >>= 1; } diff --git a/source/m68k/m68kcpu.c b/source/m68k/m68kcpu.c index 81bbe1f..2b3462e 100644 --- a/source/m68k/m68kcpu.c +++ b/source/m68k/m68kcpu.c @@ -124,7 +124,7 @@ const uint m68ki_shift_32_table[65] = /* Number of clock cycles to use for exception processing. * I used 4 for any vectors that are undocumented for processing times. */ -const uint8 m68ki_exception_cycle_table[4][256] = +uint16 m68ki_exception_cycle_table[4][256] = { { /* 000 */ 40, /* 0: Reset - Initial Stack Pointer */ @@ -420,6 +420,7 @@ const uint8 m68ki_exception_cycle_table[4][256] = } }; +#if M68K_EMULATE_010 || M68K_EMULATE_020 || M68K_EMULATE_EC020 || M68K_EMULATE_040 const uint8 m68ki_ea_idx_cycle_table[64] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -439,7 +440,7 @@ const uint8 m68ki_ea_idx_cycle_table[64] = 13, /* ..11..11 memory indirect, base 32, outer 32 */ 0, 11, 13, 13, 0, 11, 13, 13, 0, 11, 13, 13 }; - +#endif /* ======================================================================== */ @@ -683,15 +684,15 @@ void m68k_set_cpu_type(unsigned int cpu_type) CPU_SR_MASK = 0xa71f; /* T1 -- S -- -- I2 I1 I0 -- -- -- X N Z V C */ CYC_INSTRUCTION = m68ki_cycles[0]; CYC_EXCEPTION = m68ki_exception_cycle_table[0]; - CYC_BCC_NOTAKE_B = -2; - CYC_BCC_NOTAKE_W = 2; - CYC_DBCC_F_NOEXP = -2; - CYC_DBCC_F_EXP = 2; - CYC_SCC_R_TRUE = 2; - CYC_MOVEM_W = 2; - CYC_MOVEM_L = 3; - CYC_SHIFT = 1; - CYC_RESET = 132; + CYC_BCC_NOTAKE_B = -2 * 7; + CYC_BCC_NOTAKE_W = 2 * 7; + CYC_DBCC_F_NOEXP = -2 * 7; + CYC_DBCC_F_EXP = 2 * 7; + CYC_SCC_R_TRUE = 2 * 7; + CYC_MOVEM_W = 4 * 7; + CYC_MOVEM_L = 8 * 7; + CYC_SHIFT = 2 * 7; + CYC_RESET = 132 * 7; return; case M68K_CPU_TYPE_68008: CPU_TYPE = CPU_TYPE_008; @@ -839,13 +840,6 @@ void m68k_run (unsigned int cycles) while (mcycles_68k < cycles) { - /* Make sure we're not stopped */ - if(CPU_STOPPED) - { - mcycles_68k = cycles; - return; - } - /* check interrupt updates */ if (irq_status & 0x10) { @@ -857,7 +851,7 @@ void m68k_run (unsigned int cycles) m68k_execute(); #ifdef LOGVDP - error("[%d(%d)][%d(%d)] IRQ Level = %d (%x)\n", v_counter, mcycles_68k/3420, mcycles_68k, mcycles_68k%3420,int_level,m68k_get_reg (NULL, M68K_REG_PC)); + error("[%d(%d)][%d(%d)] IRQ Level = %d(0x%02x) (%x)\n", v_counter, mcycles_68k/3420, mcycles_68k, mcycles_68k%3420,int_level,FLAG_INT_MASK,m68k_get_reg (NULL, M68K_REG_PC)); #endif /* update IRQ level */ CPU_INT_LEVEL = int_level << 8; @@ -865,7 +859,13 @@ void m68k_run (unsigned int cycles) if (mcycles_68k >= cycles) return; + } + /* Make sure we're not stopped */ + if(CPU_STOPPED) + { + mcycles_68k = cycles; + return; } /* execute a single instruction */ diff --git a/source/m68k/m68kcpu.h b/source/m68k/m68kcpu.h index 6ab7d6a..7442dc5 100644 --- a/source/m68k/m68kcpu.h +++ b/source/m68k/m68kcpu.h @@ -384,8 +384,8 @@ #define CPU_TYPE_IS_020_PLUS(A) ((A) & (CPU_TYPE_020 | CPU_TYPE_040)) #define CPU_TYPE_IS_020_LESS(A) 1 #else - #define CPU_TYPE_IS_020_PLUS(A) 0 - #define CPU_TYPE_IS_020_LESS(A) 1 + #define CPU_TYPE_IS_020_PLUS(A) CPU_TYPE_IS_040_PLUS(A) + #define CPU_TYPE_IS_020_LESS(A) CPU_TYPE_IS_040_LESS(A) #endif #if M68K_EMULATE_EC020 @@ -801,7 +801,7 @@ #define USE_ALL_CYCLES() m68ki_remaining_cycles = 0 */ -#define USE_CYCLES(A) mcycles_68k += (7 * (A)) +#define USE_CYCLES(A) mcycles_68k += (A) /* ----------------------------- Read / Write ----------------------------- */ @@ -899,7 +899,7 @@ typedef struct uint cyc_shift; uint cyc_reset; const uint8* cyc_instruction; - const uint8* cyc_exception; + const uint16* cyc_exception; /* Callbacks to host */ int (*int_ack_callback)(int int_line); /* Interrupt Acknowledge */ @@ -922,7 +922,7 @@ extern uint m68ki_tracing; extern const uint8 m68ki_shift_8_table[]; extern const uint16 m68ki_shift_16_table[]; extern const uint m68ki_shift_32_table[]; -extern const uint8 m68ki_exception_cycle_table[][256]; +extern uint16 m68ki_exception_cycle_table[][256]; extern uint m68ki_address_space; extern const uint8 m68ki_ea_idx_cycle_table[]; @@ -1254,8 +1254,6 @@ INLINE uint m68ki_get_ea_ix(uint An) /* An = base register */ uint extension = m68ki_read_imm_16(); uint Xn = 0; /* Index register */ - uint bd = 0; /* Base Displacement */ - uint od = 0; /* Outer Displacement */ if(CPU_TYPE_IS_010_LESS(CPU_TYPE)) { @@ -1268,6 +1266,11 @@ INLINE uint m68ki_get_ea_ix(uint An) return An + Xn + MAKE_INT_8(extension); } +#if M68K_EMULATE_010 || M68K_EMULATE_020 || M68K_EMULATE_EC020 || M68K_EMULATE_040 + + uint bd = 0; /* Base Displacement */ + uint od = 0; /* Outer Displacement */ + /* Brief extension format */ if(!BIT_8(extension)) { @@ -1318,6 +1321,7 @@ INLINE uint m68ki_get_ea_ix(uint An) /* Preindex */ return m68ki_read_32(An + bd + Xn) + od; +#endif } diff --git a/source/m68k/m68kops.c b/source/m68k/m68kops.c index 2ab3a58..7225699 100644 --- a/source/m68k/m68kops.c +++ b/source/m68k/m68kops.c @@ -3426,7 +3426,7 @@ static void m68k_op_asr_8_s(void) uint res = src >> shift; if(shift != 0) - USE_CYCLES(shift<> shift; if(shift != 0) - USE_CYCLES(shift<> shift; if(shift != 0) - USE_CYCLES(shift<> 6) & 7])); } return; @@ -8711,7 +8711,7 @@ static void m68k_op_cas_8_pi(void) *compare = MASK_OUT_BELOW_8(*compare) | dest; else { - USE_CYCLES(3); + USE_CYCLES(21); m68ki_write_8(ea, MASK_OUT_ABOVE_8(REG_D[(word2 >> 6) & 7])); } return; @@ -8740,7 +8740,7 @@ static void m68k_op_cas_8_pi7(void) *compare = MASK_OUT_BELOW_8(*compare) | dest; else { - USE_CYCLES(3); + USE_CYCLES(21); m68ki_write_8(ea, MASK_OUT_ABOVE_8(REG_D[(word2 >> 6) & 7])); } return; @@ -8769,7 +8769,7 @@ static void m68k_op_cas_8_pd(void) *compare = MASK_OUT_BELOW_8(*compare) | dest; else { - USE_CYCLES(3); + USE_CYCLES(21); m68ki_write_8(ea, MASK_OUT_ABOVE_8(REG_D[(word2 >> 6) & 7])); } return; @@ -8798,7 +8798,7 @@ static void m68k_op_cas_8_pd7(void) *compare = MASK_OUT_BELOW_8(*compare) | dest; else { - USE_CYCLES(3); + USE_CYCLES(21); m68ki_write_8(ea, MASK_OUT_ABOVE_8(REG_D[(word2 >> 6) & 7])); } return; @@ -8827,7 +8827,7 @@ static void m68k_op_cas_8_di(void) *compare = MASK_OUT_BELOW_8(*compare) | dest; else { - USE_CYCLES(3); + USE_CYCLES(21); m68ki_write_8(ea, MASK_OUT_ABOVE_8(REG_D[(word2 >> 6) & 7])); } return; @@ -8856,7 +8856,7 @@ static void m68k_op_cas_8_ix(void) *compare = MASK_OUT_BELOW_8(*compare) | dest; else { - USE_CYCLES(3); + USE_CYCLES(21); m68ki_write_8(ea, MASK_OUT_ABOVE_8(REG_D[(word2 >> 6) & 7])); } return; @@ -8885,7 +8885,7 @@ static void m68k_op_cas_8_aw(void) *compare = MASK_OUT_BELOW_8(*compare) | dest; else { - USE_CYCLES(3); + USE_CYCLES(21); m68ki_write_8(ea, MASK_OUT_ABOVE_8(REG_D[(word2 >> 6) & 7])); } return; @@ -8914,7 +8914,7 @@ static void m68k_op_cas_8_al(void) *compare = MASK_OUT_BELOW_8(*compare) | dest; else { - USE_CYCLES(3); + USE_CYCLES(21); m68ki_write_8(ea, MASK_OUT_ABOVE_8(REG_D[(word2 >> 6) & 7])); } return; @@ -8943,7 +8943,7 @@ static void m68k_op_cas_16_ai(void) *compare = MASK_OUT_BELOW_16(*compare) | dest; else { - USE_CYCLES(3); + USE_CYCLES(21); m68ki_write_16(ea, MASK_OUT_ABOVE_16(REG_D[(word2 >> 6) & 7])); } return; @@ -8972,7 +8972,7 @@ static void m68k_op_cas_16_pi(void) *compare = MASK_OUT_BELOW_16(*compare) | dest; else { - USE_CYCLES(3); + USE_CYCLES(21); m68ki_write_16(ea, MASK_OUT_ABOVE_16(REG_D[(word2 >> 6) & 7])); } return; @@ -9001,7 +9001,7 @@ static void m68k_op_cas_16_pd(void) *compare = MASK_OUT_BELOW_16(*compare) | dest; else { - USE_CYCLES(3); + USE_CYCLES(21); m68ki_write_16(ea, MASK_OUT_ABOVE_16(REG_D[(word2 >> 6) & 7])); } return; @@ -9030,7 +9030,7 @@ static void m68k_op_cas_16_di(void) *compare = MASK_OUT_BELOW_16(*compare) | dest; else { - USE_CYCLES(3); + USE_CYCLES(21); m68ki_write_16(ea, MASK_OUT_ABOVE_16(REG_D[(word2 >> 6) & 7])); } return; @@ -9059,7 +9059,7 @@ static void m68k_op_cas_16_ix(void) *compare = MASK_OUT_BELOW_16(*compare) | dest; else { - USE_CYCLES(3); + USE_CYCLES(21); m68ki_write_16(ea, MASK_OUT_ABOVE_16(REG_D[(word2 >> 6) & 7])); } return; @@ -9088,7 +9088,7 @@ static void m68k_op_cas_16_aw(void) *compare = MASK_OUT_BELOW_16(*compare) | dest; else { - USE_CYCLES(3); + USE_CYCLES(21); m68ki_write_16(ea, MASK_OUT_ABOVE_16(REG_D[(word2 >> 6) & 7])); } return; @@ -9117,7 +9117,7 @@ static void m68k_op_cas_16_al(void) *compare = MASK_OUT_BELOW_16(*compare) | dest; else { - USE_CYCLES(3); + USE_CYCLES(21); m68ki_write_16(ea, MASK_OUT_ABOVE_16(REG_D[(word2 >> 6) & 7])); } return; @@ -9146,7 +9146,7 @@ static void m68k_op_cas_32_ai(void) *compare = dest; else { - USE_CYCLES(3); + USE_CYCLES(21); m68ki_write_32(ea, REG_D[(word2 >> 6) & 7]); } return; @@ -9175,7 +9175,7 @@ static void m68k_op_cas_32_pi(void) *compare = dest; else { - USE_CYCLES(3); + USE_CYCLES(21); m68ki_write_32(ea, REG_D[(word2 >> 6) & 7]); } return; @@ -9204,7 +9204,7 @@ static void m68k_op_cas_32_pd(void) *compare = dest; else { - USE_CYCLES(3); + USE_CYCLES(21); m68ki_write_32(ea, REG_D[(word2 >> 6) & 7]); } return; @@ -9233,7 +9233,7 @@ static void m68k_op_cas_32_di(void) *compare = dest; else { - USE_CYCLES(3); + USE_CYCLES(21); m68ki_write_32(ea, REG_D[(word2 >> 6) & 7]); } return; @@ -9262,7 +9262,7 @@ static void m68k_op_cas_32_ix(void) *compare = dest; else { - USE_CYCLES(3); + USE_CYCLES(21); m68ki_write_32(ea, REG_D[(word2 >> 6) & 7]); } return; @@ -9291,7 +9291,7 @@ static void m68k_op_cas_32_aw(void) *compare = dest; else { - USE_CYCLES(3); + USE_CYCLES(21); m68ki_write_32(ea, REG_D[(word2 >> 6) & 7]); } return; @@ -9320,7 +9320,7 @@ static void m68k_op_cas_32_al(void) *compare = dest; else { - USE_CYCLES(3); + USE_CYCLES(21); m68ki_write_32(ea, REG_D[(word2 >> 6) & 7]); } return; @@ -9360,7 +9360,7 @@ static void m68k_op_cas2_16(void) if(COND_EQ()) { - USE_CYCLES(3); + USE_CYCLES(21); m68ki_write_16(ea1, REG_D[(word2 >> 22) & 7]); m68ki_write_16(ea2, REG_D[(word2 >> 6) & 7]); return; @@ -9405,7 +9405,7 @@ static void m68k_op_cas2_32(void) if(COND_EQ()) { - USE_CYCLES(3); + USE_CYCLES(21); m68ki_write_32(ea1, REG_D[(word2 >> 22) & 7]); m68ki_write_32(ea2, REG_D[(word2 >> 6) & 7]); return; @@ -13073,7 +13073,7 @@ static void m68k_op_divu_16_d(void) *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); return; } - USE_CYCLES(10); + USE_CYCLES(70); FLAG_V = VFLAG_SET; return; } @@ -13103,7 +13103,7 @@ static void m68k_op_divu_16_ai(void) *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); return; } - USE_CYCLES(10); + USE_CYCLES(70); FLAG_V = VFLAG_SET; return; } @@ -13133,7 +13133,7 @@ static void m68k_op_divu_16_pi(void) *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); return; } - USE_CYCLES(10); + USE_CYCLES(70); FLAG_V = VFLAG_SET; return; } @@ -13163,7 +13163,7 @@ static void m68k_op_divu_16_pd(void) *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); return; } - USE_CYCLES(10); + USE_CYCLES(70); FLAG_V = VFLAG_SET; return; } @@ -13193,7 +13193,7 @@ static void m68k_op_divu_16_di(void) *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); return; } - USE_CYCLES(10); + USE_CYCLES(70); FLAG_V = VFLAG_SET; return; } @@ -13223,7 +13223,7 @@ static void m68k_op_divu_16_ix(void) *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); return; } - USE_CYCLES(10); + USE_CYCLES(70); FLAG_V = VFLAG_SET; return; } @@ -13253,7 +13253,7 @@ static void m68k_op_divu_16_aw(void) *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); return; } - USE_CYCLES(10); + USE_CYCLES(70); FLAG_V = VFLAG_SET; return; } @@ -13283,7 +13283,7 @@ static void m68k_op_divu_16_al(void) *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); return; } - USE_CYCLES(10); + USE_CYCLES(70); FLAG_V = VFLAG_SET; return; } @@ -13313,7 +13313,7 @@ static void m68k_op_divu_16_pcdi(void) *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); return; } - USE_CYCLES(10); + USE_CYCLES(70); FLAG_V = VFLAG_SET; return; } @@ -13343,7 +13343,7 @@ static void m68k_op_divu_16_pcix(void) *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); return; } - USE_CYCLES(10); + USE_CYCLES(70); FLAG_V = VFLAG_SET; return; } @@ -13373,7 +13373,7 @@ static void m68k_op_divu_16_i(void) *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); return; } - USE_CYCLES(10); + USE_CYCLES(70); FLAG_V = VFLAG_SET; return; } @@ -16749,7 +16749,7 @@ static void m68k_op_lsr_8_s(void) uint res = src >> shift; if(shift != 0) - USE_CYCLES(shift<> shift; if(shift != 0) - USE_CYCLES(shift<> shift; if(shift != 0) - USE_CYCLES(shift<> 12) & 7] = MAKE_INT_8(m68ki_read_8_fc(ea, REG_SFC)); if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); + USE_CYCLES(14); return; } /* Memory to data register */ REG_D[(word2 >> 12) & 7] = MASK_OUT_BELOW_8(REG_D[(word2 >> 12) & 7]) | m68ki_read_8_fc(ea, REG_SFC); if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); + USE_CYCLES(14); return; } m68ki_exception_privilege_violation(); @@ -23273,13 +23273,13 @@ static void m68k_op_moves_8_pi(void) { REG_A[(word2 >> 12) & 7] = MAKE_INT_8(m68ki_read_8_fc(ea, REG_SFC)); if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); + USE_CYCLES(14); return; } /* Memory to data register */ REG_D[(word2 >> 12) & 7] = MASK_OUT_BELOW_8(REG_D[(word2 >> 12) & 7]) | m68ki_read_8_fc(ea, REG_SFC); if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); + USE_CYCLES(14); return; } m68ki_exception_privilege_violation(); @@ -23308,13 +23308,13 @@ static void m68k_op_moves_8_pi7(void) { REG_A[(word2 >> 12) & 7] = MAKE_INT_8(m68ki_read_8_fc(ea, REG_SFC)); if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); + USE_CYCLES(14); return; } /* Memory to data register */ REG_D[(word2 >> 12) & 7] = MASK_OUT_BELOW_8(REG_D[(word2 >> 12) & 7]) | m68ki_read_8_fc(ea, REG_SFC); if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); + USE_CYCLES(14); return; } m68ki_exception_privilege_violation(); @@ -23343,13 +23343,13 @@ static void m68k_op_moves_8_pd(void) { REG_A[(word2 >> 12) & 7] = MAKE_INT_8(m68ki_read_8_fc(ea, REG_SFC)); if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); + USE_CYCLES(14); return; } /* Memory to data register */ REG_D[(word2 >> 12) & 7] = MASK_OUT_BELOW_8(REG_D[(word2 >> 12) & 7]) | m68ki_read_8_fc(ea, REG_SFC); if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); + USE_CYCLES(14); return; } m68ki_exception_privilege_violation(); @@ -23378,13 +23378,13 @@ static void m68k_op_moves_8_pd7(void) { REG_A[(word2 >> 12) & 7] = MAKE_INT_8(m68ki_read_8_fc(ea, REG_SFC)); if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); + USE_CYCLES(14); return; } /* Memory to data register */ REG_D[(word2 >> 12) & 7] = MASK_OUT_BELOW_8(REG_D[(word2 >> 12) & 7]) | m68ki_read_8_fc(ea, REG_SFC); if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); + USE_CYCLES(14); return; } m68ki_exception_privilege_violation(); @@ -23413,13 +23413,13 @@ static void m68k_op_moves_8_di(void) { REG_A[(word2 >> 12) & 7] = MAKE_INT_8(m68ki_read_8_fc(ea, REG_SFC)); if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); + USE_CYCLES(14); return; } /* Memory to data register */ REG_D[(word2 >> 12) & 7] = MASK_OUT_BELOW_8(REG_D[(word2 >> 12) & 7]) | m68ki_read_8_fc(ea, REG_SFC); if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); + USE_CYCLES(14); return; } m68ki_exception_privilege_violation(); @@ -23448,13 +23448,13 @@ static void m68k_op_moves_8_ix(void) { REG_A[(word2 >> 12) & 7] = MAKE_INT_8(m68ki_read_8_fc(ea, REG_SFC)); if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); + USE_CYCLES(14); return; } /* Memory to data register */ REG_D[(word2 >> 12) & 7] = MASK_OUT_BELOW_8(REG_D[(word2 >> 12) & 7]) | m68ki_read_8_fc(ea, REG_SFC); if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); + USE_CYCLES(14); return; } m68ki_exception_privilege_violation(); @@ -23483,13 +23483,13 @@ static void m68k_op_moves_8_aw(void) { REG_A[(word2 >> 12) & 7] = MAKE_INT_8(m68ki_read_8_fc(ea, REG_SFC)); if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); + USE_CYCLES(14); return; } /* Memory to data register */ REG_D[(word2 >> 12) & 7] = MASK_OUT_BELOW_8(REG_D[(word2 >> 12) & 7]) | m68ki_read_8_fc(ea, REG_SFC); if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); + USE_CYCLES(14); return; } m68ki_exception_privilege_violation(); @@ -23518,13 +23518,13 @@ static void m68k_op_moves_8_al(void) { REG_A[(word2 >> 12) & 7] = MAKE_INT_8(m68ki_read_8_fc(ea, REG_SFC)); if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); + USE_CYCLES(14); return; } /* Memory to data register */ REG_D[(word2 >> 12) & 7] = MASK_OUT_BELOW_8(REG_D[(word2 >> 12) & 7]) | m68ki_read_8_fc(ea, REG_SFC); if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); + USE_CYCLES(14); return; } m68ki_exception_privilege_violation(); @@ -23553,13 +23553,13 @@ static void m68k_op_moves_16_ai(void) { REG_A[(word2 >> 12) & 7] = MAKE_INT_16(m68ki_read_16_fc(ea, REG_SFC)); if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); + USE_CYCLES(14); return; } /* Memory to data register */ REG_D[(word2 >> 12) & 7] = MASK_OUT_BELOW_16(REG_D[(word2 >> 12) & 7]) | m68ki_read_16_fc(ea, REG_SFC); if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); + USE_CYCLES(14); return; } m68ki_exception_privilege_violation(); @@ -23588,13 +23588,13 @@ static void m68k_op_moves_16_pi(void) { REG_A[(word2 >> 12) & 7] = MAKE_INT_16(m68ki_read_16_fc(ea, REG_SFC)); if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); + USE_CYCLES(14); return; } /* Memory to data register */ REG_D[(word2 >> 12) & 7] = MASK_OUT_BELOW_16(REG_D[(word2 >> 12) & 7]) | m68ki_read_16_fc(ea, REG_SFC); if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); + USE_CYCLES(14); return; } m68ki_exception_privilege_violation(); @@ -23623,13 +23623,13 @@ static void m68k_op_moves_16_pd(void) { REG_A[(word2 >> 12) & 7] = MAKE_INT_16(m68ki_read_16_fc(ea, REG_SFC)); if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); + USE_CYCLES(14); return; } /* Memory to data register */ REG_D[(word2 >> 12) & 7] = MASK_OUT_BELOW_16(REG_D[(word2 >> 12) & 7]) | m68ki_read_16_fc(ea, REG_SFC); if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); + USE_CYCLES(14); return; } m68ki_exception_privilege_violation(); @@ -23658,13 +23658,13 @@ static void m68k_op_moves_16_di(void) { REG_A[(word2 >> 12) & 7] = MAKE_INT_16(m68ki_read_16_fc(ea, REG_SFC)); if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); + USE_CYCLES(14); return; } /* Memory to data register */ REG_D[(word2 >> 12) & 7] = MASK_OUT_BELOW_16(REG_D[(word2 >> 12) & 7]) | m68ki_read_16_fc(ea, REG_SFC); if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); + USE_CYCLES(14); return; } m68ki_exception_privilege_violation(); @@ -23693,13 +23693,13 @@ static void m68k_op_moves_16_ix(void) { REG_A[(word2 >> 12) & 7] = MAKE_INT_16(m68ki_read_16_fc(ea, REG_SFC)); if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); + USE_CYCLES(14); return; } /* Memory to data register */ REG_D[(word2 >> 12) & 7] = MASK_OUT_BELOW_16(REG_D[(word2 >> 12) & 7]) | m68ki_read_16_fc(ea, REG_SFC); if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); + USE_CYCLES(14); return; } m68ki_exception_privilege_violation(); @@ -23728,13 +23728,13 @@ static void m68k_op_moves_16_aw(void) { REG_A[(word2 >> 12) & 7] = MAKE_INT_16(m68ki_read_16_fc(ea, REG_SFC)); if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); + USE_CYCLES(14); return; } /* Memory to data register */ REG_D[(word2 >> 12) & 7] = MASK_OUT_BELOW_16(REG_D[(word2 >> 12) & 7]) | m68ki_read_16_fc(ea, REG_SFC); if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); + USE_CYCLES(14); return; } m68ki_exception_privilege_violation(); @@ -23763,13 +23763,13 @@ static void m68k_op_moves_16_al(void) { REG_A[(word2 >> 12) & 7] = MAKE_INT_16(m68ki_read_16_fc(ea, REG_SFC)); if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); + USE_CYCLES(14); return; } /* Memory to data register */ REG_D[(word2 >> 12) & 7] = MASK_OUT_BELOW_16(REG_D[(word2 >> 12) & 7]) | m68ki_read_16_fc(ea, REG_SFC); if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); + USE_CYCLES(14); return; } m68ki_exception_privilege_violation(); @@ -23793,13 +23793,13 @@ static void m68k_op_moves_32_ai(void) { m68ki_write_32_fc(ea, REG_DFC, REG_DA[(word2 >> 12) & 15]); if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); + USE_CYCLES(14); return; } /* Memory to register */ REG_DA[(word2 >> 12) & 15] = m68ki_read_32_fc(ea, REG_SFC); if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); + USE_CYCLES(14); return; } m68ki_exception_privilege_violation(); @@ -23823,13 +23823,13 @@ static void m68k_op_moves_32_pi(void) { m68ki_write_32_fc(ea, REG_DFC, REG_DA[(word2 >> 12) & 15]); if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); + USE_CYCLES(14); return; } /* Memory to register */ REG_DA[(word2 >> 12) & 15] = m68ki_read_32_fc(ea, REG_SFC); if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); + USE_CYCLES(14); return; } m68ki_exception_privilege_violation(); @@ -23853,13 +23853,13 @@ static void m68k_op_moves_32_pd(void) { m68ki_write_32_fc(ea, REG_DFC, REG_DA[(word2 >> 12) & 15]); if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); + USE_CYCLES(14); return; } /* Memory to register */ REG_DA[(word2 >> 12) & 15] = m68ki_read_32_fc(ea, REG_SFC); if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); + USE_CYCLES(14); return; } m68ki_exception_privilege_violation(); @@ -23883,13 +23883,13 @@ static void m68k_op_moves_32_di(void) { m68ki_write_32_fc(ea, REG_DFC, REG_DA[(word2 >> 12) & 15]); if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); + USE_CYCLES(14); return; } /* Memory to register */ REG_DA[(word2 >> 12) & 15] = m68ki_read_32_fc(ea, REG_SFC); if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); + USE_CYCLES(14); return; } m68ki_exception_privilege_violation(); @@ -23913,13 +23913,13 @@ static void m68k_op_moves_32_ix(void) { m68ki_write_32_fc(ea, REG_DFC, REG_DA[(word2 >> 12) & 15]); if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); + USE_CYCLES(14); return; } /* Memory to register */ REG_DA[(word2 >> 12) & 15] = m68ki_read_32_fc(ea, REG_SFC); if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); + USE_CYCLES(14); return; } m68ki_exception_privilege_violation(); @@ -23943,13 +23943,13 @@ static void m68k_op_moves_32_aw(void) { m68ki_write_32_fc(ea, REG_DFC, REG_DA[(word2 >> 12) & 15]); if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); + USE_CYCLES(14); return; } /* Memory to register */ REG_DA[(word2 >> 12) & 15] = m68ki_read_32_fc(ea, REG_SFC); if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); + USE_CYCLES(14); return; } m68ki_exception_privilege_violation(); @@ -23973,13 +23973,13 @@ static void m68k_op_moves_32_al(void) { m68ki_write_32_fc(ea, REG_DFC, REG_DA[(word2 >> 12) & 15]); if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); + USE_CYCLES(14); return; } /* Memory to register */ REG_DA[(word2 >> 12) & 15] = m68ki_read_32_fc(ea, REG_SFC); if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); + USE_CYCLES(14); return; } m68ki_exception_privilege_violation(); @@ -28574,7 +28574,7 @@ static void m68k_op_ror_8_s(void) uint res = ROR_8(src, shift); if(orig_shift != 0) - USE_CYCLES(orig_shift<> ((shift - 1) & 15)) << 8; @@ -28687,7 +28687,7 @@ static void m68k_op_ror_32_r(void) if(orig_shift != 0) { - USE_CYCLES(orig_shift<> ((shift - 1) & 31)) << 8; @@ -28818,7 +28818,7 @@ static void m68k_op_rol_8_s(void) uint res = ROL_8(src, shift); if(orig_shift != 0) - USE_CYCLES(orig_shift<> 8; res = MASK_OUT_ABOVE_16(res); @@ -29122,7 +29122,7 @@ static void m68k_op_roxr_32_s(void) uint64 res = src | (((uint64)XFLAG_AS_1()) << 32); if(shift != 0) - USE_CYCLES(shift<> 8; res = MASK_OUT_ABOVE_16(res); @@ -29232,7 +29232,7 @@ static void m68k_op_roxr_32_r(void) res = ROR_33_64(res, shift); - USE_CYCLES(orig_shift<> 24; res = MASK_OUT_ABOVE_32(res); @@ -29259,7 +29259,7 @@ static void m68k_op_roxr_32_r(void) uint new_x_flag = src & (1 << (shift - 1)); if(orig_shift != 0) - USE_CYCLES(orig_shift<> 8; res = MASK_OUT_ABOVE_16(res); @@ -29448,7 +29448,7 @@ static void m68k_op_roxl_32_s(void) uint64 res = src | (((uint64)XFLAG_AS_1()) << 32); if(shift != 0) - USE_CYCLES(shift<> 8; res = MASK_OUT_ABOVE_16(res); @@ -29559,7 +29559,7 @@ static void m68k_op_roxl_32_r(void) res = ROL_33_64(res, shift); - USE_CYCLES(orig_shift<> 24; res = MASK_OUT_ABOVE_32(res); @@ -29586,7 +29586,7 @@ static void m68k_op_roxl_32_r(void) uint new_x_flag = src & (1 << (32 - shift)); if(orig_shift != 0) - USE_CYCLES(orig_shift<opcode_handler; for(k=0;kcycles[k]; + m68ki_cycles[k][i] = ostruct->cycles[k]*7; } } ostruct++; @@ -36773,7 +36781,7 @@ void m68ki_build_opcode_table(void) { m68ki_instruction_jump_table[ostruct->match | i] = ostruct->opcode_handler; for(k=0;kmatch | i] = ostruct->cycles[k]; + m68ki_cycles[k][ostruct->match | i] = ostruct->cycles[k]*7; } ostruct++; } @@ -36786,7 +36794,7 @@ void m68ki_build_opcode_table(void) instr = ostruct->match | (i << 9) | j; m68ki_instruction_jump_table[instr] = ostruct->opcode_handler; for(k=0;kcycles[k]; + m68ki_cycles[k][instr] = ostruct->cycles[k]*7; } } ostruct++; @@ -36797,7 +36805,7 @@ void m68ki_build_opcode_table(void) { m68ki_instruction_jump_table[ostruct->match | i] = ostruct->opcode_handler; for(k=0;kmatch | i] = ostruct->cycles[k]; + m68ki_cycles[k][ostruct->match | i] = ostruct->cycles[k]*7; } ostruct++; } @@ -36807,7 +36815,7 @@ void m68ki_build_opcode_table(void) { m68ki_instruction_jump_table[ostruct->match | (i << 9)] = ostruct->opcode_handler; for(k=0;kmatch | (i << 9)] = ostruct->cycles[k]; + m68ki_cycles[k][ostruct->match | (i << 9)] = ostruct->cycles[k]*7; } ostruct++; } @@ -36817,7 +36825,7 @@ void m68ki_build_opcode_table(void) { m68ki_instruction_jump_table[ostruct->match | i] = ostruct->opcode_handler; for(k=0;kmatch | i] = ostruct->cycles[k]; + m68ki_cycles[k][ostruct->match | i] = ostruct->cycles[k]*7; } ostruct++; } @@ -36825,7 +36833,7 @@ void m68ki_build_opcode_table(void) { m68ki_instruction_jump_table[ostruct->match] = ostruct->opcode_handler; for(k=0;kmatch] = ostruct->cycles[k]; + m68ki_cycles[k][ostruct->match] = ostruct->cycles[k]*7; ostruct++; } } diff --git a/source/z80/z80.c b/source/z80/z80.c index 2232926..9f99966 100644 --- a/source/z80/z80.c +++ b/source/z80/z80.c @@ -216,136 +216,136 @@ static UINT8 SZHV_dec[256]; /* zero, sign, half carry and overflow flags DEC r8 static UINT8 *SZHVC_add = 0; static UINT8 *SZHVC_sub = 0; -static const UINT8 cc_op[0x100] = { - 4,10, 7, 6, 4, 4, 7, 4, 4,11, 7, 6, 4, 4, 7, 4, - 8,10, 7, 6, 4, 4, 7, 4,12,11, 7, 6, 4, 4, 7, 4, - 7,10,16, 6, 4, 4, 7, 4, 7,11,16, 6, 4, 4, 7, 4, - 7,10,13, 6,11,11,10, 4, 7,11,13, 6, 4, 4, 7, 4, - 4, 4, 4, 4, 4, 4, 7, 4, 4, 4, 4, 4, 4, 4, 7, 4, - 4, 4, 4, 4, 4, 4, 7, 4, 4, 4, 4, 4, 4, 4, 7, 4, - 4, 4, 4, 4, 4, 4, 7, 4, 4, 4, 4, 4, 4, 4, 7, 4, - 7, 7, 7, 7, 7, 7, 4, 7, 4, 4, 4, 4, 4, 4, 7, 4, - 4, 4, 4, 4, 4, 4, 7, 4, 4, 4, 4, 4, 4, 4, 7, 4, - 4, 4, 4, 4, 4, 4, 7, 4, 4, 4, 4, 4, 4, 4, 7, 4, - 4, 4, 4, 4, 4, 4, 7, 4, 4, 4, 4, 4, 4, 4, 7, 4, - 4, 4, 4, 4, 4, 4, 7, 4, 4, 4, 4, 4, 4, 4, 7, 4, - 5,10,10,10,10,11, 7,11, 5,10,10, 0,10,17, 7,11, - 5,10,10,11,10,11, 7,11, 5, 4,10,11,10, 0, 7,11, - 5,10,10,19,10,11, 7,11, 5, 4,10, 4,10, 0, 7,11, - 5,10,10, 4,10,11, 7,11, 5, 6,10, 4,10, 0, 7,11}; +static const UINT16 cc_op[0x100] = { + 4*15,10*15, 7*15, 6*15, 4*15, 4*15, 7*15, 4*15, 4*15,11*15, 7*15, 6*15, 4*15, 4*15, 7*15, 4*15, + 8*15,10*15, 7*15, 6*15, 4*15, 4*15, 7*15, 4*15,12*15,11*15, 7*15, 6*15, 4*15, 4*15, 7*15, 4*15, + 7*15,10*15,16*15, 6*15, 4*15, 4*15, 7*15, 4*15, 7*15,11*15,16*15, 6*15, 4*15, 4*15, 7*15, 4*15, + 7*15,10*15,13*15, 6*15,11*15,11*15,10*15, 4*15, 7*15,11*15,13*15, 6*15, 4*15, 4*15, 7*15, 4*15, + 4*15, 4*15, 4*15, 4*15, 4*15, 4*15, 7*15, 4*15, 4*15, 4*15, 4*15, 4*15, 4*15, 4*15, 7*15, 4*15, + 4*15, 4*15, 4*15, 4*15, 4*15, 4*15, 7*15, 4*15, 4*15, 4*15, 4*15, 4*15, 4*15, 4*15, 7*15, 4*15, + 4*15, 4*15, 4*15, 4*15, 4*15, 4*15, 7*15, 4*15, 4*15, 4*15, 4*15, 4*15, 4*15, 4*15, 7*15, 4*15, + 7*15, 7*15, 7*15, 7*15, 7*15, 7*15, 4*15, 7*15, 4*15, 4*15, 4*15, 4*15, 4*15, 4*15, 7*15, 4*15, + 4*15, 4*15, 4*15, 4*15, 4*15, 4*15, 7*15, 4*15, 4*15, 4*15, 4*15, 4*15, 4*15, 4*15, 7*15, 4*15, + 4*15, 4*15, 4*15, 4*15, 4*15, 4*15, 7*15, 4*15, 4*15, 4*15, 4*15, 4*15, 4*15, 4*15, 7*15, 4*15, + 4*15, 4*15, 4*15, 4*15, 4*15, 4*15, 7*15, 4*15, 4*15, 4*15, 4*15, 4*15, 4*15, 4*15, 7*15, 4*15, + 4*15, 4*15, 4*15, 4*15, 4*15, 4*15, 7*15, 4*15, 4*15, 4*15, 4*15, 4*15, 4*15, 4*15, 7*15, 4*15, + 5*15,10*15,10*15,10*15,10*15,11*15, 7*15,11*15, 5*15,10*15,10*15, 0*15,10*15,17*15, 7*15,11*15, + 5*15,10*15,10*15,11*15,10*15,11*15, 7*15,11*15, 5*15, 4*15,10*15,11*15,10*15, 0*15, 7*15,11*15, + 5*15,10*15,10*15,19*15,10*15,11*15, 7*15,11*15, 5*15, 4*15,10*15, 4*15,10*15, 0*15, 7*15,11*15, + 5*15,10*15,10*15, 4*15,10*15,11*15, 7*15,11*15, 5*15, 6*15,10*15, 4*15,10*15, 0*15, 7*15,11*15}; -static const UINT8 cc_cb[0x100] = { - 8, 8, 8, 8, 8, 8,15, 8, 8, 8, 8, 8, 8, 8,15, 8, - 8, 8, 8, 8, 8, 8,15, 8, 8, 8, 8, 8, 8, 8,15, 8, - 8, 8, 8, 8, 8, 8,15, 8, 8, 8, 8, 8, 8, 8,15, 8, - 8, 8, 8, 8, 8, 8,15, 8, 8, 8, 8, 8, 8, 8,15, 8, - 8, 8, 8, 8, 8, 8,12, 8, 8, 8, 8, 8, 8, 8,12, 8, - 8, 8, 8, 8, 8, 8,12, 8, 8, 8, 8, 8, 8, 8,12, 8, - 8, 8, 8, 8, 8, 8,12, 8, 8, 8, 8, 8, 8, 8,12, 8, - 8, 8, 8, 8, 8, 8,12, 8, 8, 8, 8, 8, 8, 8,12, 8, - 8, 8, 8, 8, 8, 8,15, 8, 8, 8, 8, 8, 8, 8,15, 8, - 8, 8, 8, 8, 8, 8,15, 8, 8, 8, 8, 8, 8, 8,15, 8, - 8, 8, 8, 8, 8, 8,15, 8, 8, 8, 8, 8, 8, 8,15, 8, - 8, 8, 8, 8, 8, 8,15, 8, 8, 8, 8, 8, 8, 8,15, 8, - 8, 8, 8, 8, 8, 8,15, 8, 8, 8, 8, 8, 8, 8,15, 8, - 8, 8, 8, 8, 8, 8,15, 8, 8, 8, 8, 8, 8, 8,15, 8, - 8, 8, 8, 8, 8, 8,15, 8, 8, 8, 8, 8, 8, 8,15, 8, - 8, 8, 8, 8, 8, 8,15, 8, 8, 8, 8, 8, 8, 8,15, 8}; +static const UINT16 cc_cb[0x100] = { + 8*15, 8*15, 8*15, 8*15, 8*15, 8*15,15*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15,15*15, 8*15, + 8*15, 8*15, 8*15, 8*15, 8*15, 8*15,15*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15,15*15, 8*15, + 8*15, 8*15, 8*15, 8*15, 8*15, 8*15,15*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15,15*15, 8*15, + 8*15, 8*15, 8*15, 8*15, 8*15, 8*15,15*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15,15*15, 8*15, + 8*15, 8*15, 8*15, 8*15, 8*15, 8*15,12*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15,12*15, 8*15, + 8*15, 8*15, 8*15, 8*15, 8*15, 8*15,12*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15,12*15, 8*15, + 8*15, 8*15, 8*15, 8*15, 8*15, 8*15,12*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15,12*15, 8*15, + 8*15, 8*15, 8*15, 8*15, 8*15, 8*15,12*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15,12*15, 8*15, + 8*15, 8*15, 8*15, 8*15, 8*15, 8*15,15*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15,15*15, 8*15, + 8*15, 8*15, 8*15, 8*15, 8*15, 8*15,15*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15,15*15, 8*15, + 8*15, 8*15, 8*15, 8*15, 8*15, 8*15,15*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15,15*15, 8*15, + 8*15, 8*15, 8*15, 8*15, 8*15, 8*15,15*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15,15*15, 8*15, + 8*15, 8*15, 8*15, 8*15, 8*15, 8*15,15*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15,15*15, 8*15, + 8*15, 8*15, 8*15, 8*15, 8*15, 8*15,15*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15,15*15, 8*15, + 8*15, 8*15, 8*15, 8*15, 8*15, 8*15,15*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15,15*15, 8*15, + 8*15, 8*15, 8*15, 8*15, 8*15, 8*15,15*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15,15*15, 8*15}; -static const UINT8 cc_ed[0x100] = { - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, -12,12,15,20, 8,14, 8, 9,12,12,15,20, 8,14, 8, 9, -12,12,15,20, 8,14, 8, 9,12,12,15,20, 8,14, 8, 9, -12,12,15,20, 8,14, 8,18,12,12,15,20, 8,14, 8,18, -12,12,15,20, 8,14, 8, 8,12,12,15,20, 8,14, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, -16,16,16,16, 8, 8, 8, 8,16,16,16,16, 8, 8, 8, 8, -16,16,16,16, 8, 8, 8, 8,16,16,16,16, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}; +static const UINT16 cc_ed[0x100] = { + 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, + 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, + 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, + 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, + 12*15,12*15,15*15,20*15, 8*15,14*15, 8*15, 9*15,12*15,12*15,15*15,20*15, 8*15,14*15, 8*15, 9*15, + 12*15,12*15,15*15,20*15, 8*15,14*15, 8*15, 9*15,12*15,12*15,15*15,20*15, 8*15,14*15, 8*15, 9*15, + 12*15,12*15,15*15,20*15, 8*15,14*15, 8*15,18*15,12*15,12*15,15*15,20*15, 8*15,14*15, 8*15,18*15, + 12*15,12*15,15*15,20*15, 8*15,14*15, 8*15, 8*15,12*15,12*15,15*15,20*15, 8*15,14*15, 8*15, 8*15, + 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, + 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, + 16*15,16*15,16*15,16*15, 8*15, 8*15, 8*15, 8*15,16*15,16*15,16*15,16*15, 8*15, 8*15, 8*15, 8*15, + 16*15,16*15,16*15,16*15, 8*15, 8*15, 8*15, 8*15,16*15,16*15,16*15,16*15, 8*15, 8*15, 8*15, 8*15, + 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, + 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, + 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, + 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15}; /*static const UINT8 cc_xy[0x100] = { - 4, 4, 4, 4, 4, 4, 4, 4, 4,15, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4,15, 4, 4, 4, 4, 4, 4, - 4,14,20,10, 9, 9,11, 4, 4,15,20,10, 9, 9,11, 4, - 4, 4, 4, 4,23,23,19, 4, 4,15, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 9, 9,19, 4, 4, 4, 4, 4, 9, 9,19, 4, - 4, 4, 4, 4, 9, 9,19, 4, 4, 4, 4, 4, 9, 9,19, 4, - 9, 9, 9, 9, 9, 9,19, 9, 9, 9, 9, 9, 9, 9,19, 9, -19,19,19,19,19,19, 4,19, 4, 4, 4, 4, 9, 9,19, 4, - 4, 4, 4, 4, 9, 9,19, 4, 4, 4, 4, 4, 9, 9,19, 4, - 4, 4, 4, 4, 9, 9,19, 4, 4, 4, 4, 4, 9, 9,19, 4, - 4, 4, 4, 4, 9, 9,19, 4, 4, 4, 4, 4, 9, 9,19, 4, - 4, 4, 4, 4, 9, 9,19, 4, 4, 4, 4, 4, 9, 9,19, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4,14, 4,23, 4,15, 4, 4, 4, 8, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4,10, 4, 4, 4, 4, 4, 4}; + 4*15, 4*15, 4*15, 4*15, 4*15, 4*15, 4*15, 4*15, 4*15,15*15, 4*15, 4*15, 4*15, 4*15, 4*15, 4*15, + 4*15, 4*15, 4*15, 4*15, 4*15, 4*15, 4*15, 4*15, 4*15,15*15, 4*15, 4*15, 4*15, 4*15, 4*15, 4*15, + 4*15,14*15,20*15,10*15, 9*15, 9*15,11*15, 4*15, 4*15,15*15,20*15,10*15, 9*15, 9*15,11*15, 4*15, + 4*15, 4*15, 4*15, 4*15,23*15,23*15,19*15, 4*15, 4*15,15*15, 4*15, 4*15, 4*15, 4*15, 4*15, 4*15, + 4*15, 4*15, 4*15, 4*15, 9*15, 9*15,19*15, 4*15, 4*15, 4*15, 4*15, 4*15, 9*15, 9*15,19*15, 4*15, + 4*15, 4*15, 4*15, 4*15, 9*15, 9*15,19*15, 4*15, 4*15, 4*15, 4*15, 4*15, 9*15, 9*15,19*15, 4*15, + 9*15, 9*15, 9*15, 9*15, 9*15, 9*15,19*15, 9*15, 9*15, 9*15, 9*15, 9*15, 9*15, 9*15,19*15, 9*15, +19*15,19*15,19*15,19*15,19*15,19*15, 4*15,19*15, 4*15, 4*15, 4*15, 4*15, 9*15, 9*15,19*15, 4*15, + 4*15, 4*15, 4*15, 4*15, 9*15, 9*15,19*15, 4*15, 4*15, 4*15, 4*15, 4*15, 9*15, 9*15,19*15, 4*15, + 4*15, 4*15, 4*15, 4*15, 9*15, 9*15,19*15, 4*15, 4*15, 4*15, 4*15, 4*15, 9*15, 9*15,19*15, 4*15, + 4*15, 4*15, 4*15, 4*15, 9*15, 9*15,19*15, 4*15, 4*15, 4*15, 4*15, 4*15, 9*15, 9*15,19*15, 4*15, + 4*15, 4*15, 4*15, 4*15, 9*15, 9*15,19*15, 4*15, 4*15, 4*15, 4*15, 4*15, 9*15, 9*15,19*15, 4*15, + 4*15, 4*15, 4*15, 4*15, 4*15, 4*15, 4*15, 4*15, 4*15, 4*15, 4*15, 0*15, 4*15, 4*15, 4*15, 4*15, + 4*15, 4*15, 4*15, 4*15, 4*15, 4*15, 4*15, 4*15, 4*15, 4*15, 4*15, 4*15, 4*15, 4*15, 4*15, 4*15, + 4*15,14*15, 4*15,23*15, 4*15,15*15, 4*15, 4*15, 4*15, 8*15, 4*15, 4*15, 4*15, 4*15, 4*15, 4*15, + 4*15, 4*15, 4*15, 4*15, 4*15, 4*15, 4*15, 4*15, 4*15,10*15, 4*15, 4*15, 4*15, 4*15, 4*15, 4*15}; */ /* illegal combo should return 4 + cc_op[i] */ -static const UINT8 cc_xy[0x100] ={ - 8,14,11,10, 8, 8,11, 8, 8,15,11,10, 8, 8,11, 8, -12,14,11,10, 8, 8,11, 8,16,15,11,10, 8, 8,11, 8, -11,14,20,10, 9, 9,12, 8,11,15,20,10, 9, 9,12, 8, -11,14,17,10,23,23,19, 8,11,15,17,10, 8, 8,11, 8, - 8, 8, 8, 8, 9, 9,19, 8, 8, 8, 8, 8, 9, 9,19, 8, - 8, 8, 8, 8, 9, 9,19, 8, 8, 8, 8, 8, 9, 9,19, 8, - 9, 9, 9, 9, 9, 9,19, 9, 9, 9, 9, 9, 9, 9,19, 9, -19,19,19,19,19,19, 8,19, 8, 8, 8, 8, 9, 9,19, 8, - 8, 8, 8, 8, 9, 9,19, 8, 8, 8, 8, 8, 9, 9,19, 8, - 8, 8, 8, 8, 9, 9,19, 8, 8, 8, 8, 8, 9, 9,19, 8, - 8, 8, 8, 8, 9, 9,19, 8, 8, 8, 8, 8, 9, 9,19, 8, - 8, 8, 8, 8, 9, 9,19, 8, 8, 8, 8, 8, 9, 9,19, 8, - 9,14,14,14,14,15,11,15, 9,14,14, 0,14,21,11,15, - 9,14,14,15,14,15,11,15, 9, 8,14,15,14, 4,11,15, - 9,14,14,23,14,15,11,15, 9, 8,14, 8,14, 4,11,15, - 9,14,14, 8,14,15,11,15, 9,10,14, 8,14, 4,11,15}; +static const UINT16 cc_xy[0x100] ={ + 8*15,14*15,11*15,10*15, 8*15, 8*15,11*15, 8*15, 8*15,15*15,11*15,10*15, 8*15, 8*15,11*15, 8*15, + 12*15,14*15,11*15,10*15, 8*15, 8*15,11*15, 8*15,16*15,15*15,11*15,10*15, 8*15, 8*15,11*15, 8*15, + 11*15,14*15,20*15,10*15, 9*15, 9*15,12*15, 8*15,11*15,15*15,20*15,10*15, 9*15, 9*15,12*15, 8*15, + 11*15,14*15,17*15,10*15,23*15,23*15,19*15, 8*15,11*15,15*15,17*15,10*15, 8*15, 8*15,11*15, 8*15, + 8*15, 8*15, 8*15, 8*15, 9*15, 9*15,19*15, 8*15, 8*15, 8*15, 8*15, 8*15, 9*15, 9*15,19*15, 8*15, + 8*15, 8*15, 8*15, 8*15, 9*15, 9*15,19*15, 8*15, 8*15, 8*15, 8*15, 8*15, 9*15, 9*15,19*15, 8*15, + 9*15, 9*15, 9*15, 9*15, 9*15, 9*15,19*15, 9*15, 9*15, 9*15, 9*15, 9*15, 9*15, 9*15,19*15, 9*15, + 19*15,19*15,19*15,19*15,19*15,19*15, 8*15,19*15, 8*15, 8*15, 8*15, 8*15, 9*15, 9*15,19*15, 8*15, + 8*15, 8*15, 8*15, 8*15, 9*15, 9*15,19*15, 8*15, 8*15, 8*15, 8*15, 8*15, 9*15, 9*15,19*15, 8*15, + 8*15, 8*15, 8*15, 8*15, 9*15, 9*15,19*15, 8*15, 8*15, 8*15, 8*15, 8*15, 9*15, 9*15,19*15, 8*15, + 8*15, 8*15, 8*15, 8*15, 9*15, 9*15,19*15, 8*15, 8*15, 8*15, 8*15, 8*15, 9*15, 9*15,19*15, 8*15, + 8*15, 8*15, 8*15, 8*15, 9*15, 9*15,19*15, 8*15, 8*15, 8*15, 8*15, 8*15, 9*15, 9*15,19*15, 8*15, + 9*15,14*15,14*15,14*15,14*15,15*15,11*15,15*15, 9*15,14*15,14*15, 0*15,14*15,21*15,11*15,15*15, + 9*15,14*15,14*15,15*15,14*15,15*15,11*15,15*15, 9*15, 8*15,14*15,15*15,14*15, 4*15,11*15,15*15, + 9*15,14*15,14*15,23*15,14*15,15*15,11*15,15*15, 9*15, 8*15,14*15, 8*15,14*15, 4*15,11*15,15*15, + 9*15,14*15,14*15, 8*15,14*15,15*15,11*15,15*15, 9*15,10*15,14*15, 8*15,14*15, 4*15,11*15,15*15}; -static const UINT8 cc_xycb[0x100] = { -23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23, -23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23, -23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23, -23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23, -20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20, -20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20, -20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20, -20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20, -23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23, -23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23, -23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23, -23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23, -23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23, -23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23, -23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23, -23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23}; +static const UINT16 cc_xycb[0x100] = { + 23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15, + 23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15, + 23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15, + 23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15, + 20*15,20*15,20*15,20*15,20*15,20*15,20*15,20*15,20*15,20*15,20*15,20*15,20*15,20*15,20*15,20*15, + 20*15,20*15,20*15,20*15,20*15,20*15,20*15,20*15,20*15,20*15,20*15,20*15,20*15,20*15,20*15,20*15, + 20*15,20*15,20*15,20*15,20*15,20*15,20*15,20*15,20*15,20*15,20*15,20*15,20*15,20*15,20*15,20*15, + 20*15,20*15,20*15,20*15,20*15,20*15,20*15,20*15,20*15,20*15,20*15,20*15,20*15,20*15,20*15,20*15, + 23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15, + 23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15, + 23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15, + 23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15, + 23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15, + 23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15, + 23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15, + 23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15}; /* extra cycles if jr/jp/call taken and 'interrupt latency' on rst 0-7 */ -static const UINT8 cc_ex[0x100] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* DJNZ */ - 5, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, /* JR NZ/JR Z */ - 5, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, /* JR NC/JR C */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, /* INI/IND (cycle-accurate I/O port reads) */ - 5, 5, 5, 5, 0, 0, 0, 0, 5, 5, 5, 5, 0, 0, 0, 0, /* LDIR/CPIR/INIR/OTIR LDDR/CPDR/INDR/OTDR */ - 6, 0, 0, 0, 7, 0, 0, 2, 6, 0, 0, 0, 7, 0, 0, 2, - 6, 0, 0, 0, 7, 0, 0, 2, 6, 0, 0, 0, 7, 0, 0, 2, - 6, 0, 0, 0, 7, 0, 0, 2, 6, 0, 0, 0, 7, 0, 0, 2, - 6, 0, 0, 0, 7, 0, 0, 2, 6, 0, 0, 0, 7, 0, 0, 2}; +static const UINT16 cc_ex[0x100] = { + 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, + 5*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, /* DJNZ */ + 5*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 5*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, /* JR NZ/JR Z */ + 5*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 5*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, /* JR NC/JR C */ + 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, + 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, + 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, + 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, + 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, + 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, + 0*15, 0*15, 4*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 4*15, 0*15, 0*15, 0*15, 0*15, 0*15, /* INI/IND (cycle-accurate I/O port reads) */ + 5*15, 5*15, 5*15, 5*15, 0*15, 0*15, 0*15, 0*15, 5*15, 5*15, 5*15, 5*15, 0*15, 0*15, 0*15, 0*15, /* LDIR/CPIR/INIR/OTIR LDDR/CPDR/INDR/OTDR */ + 6*15, 0*15, 0*15, 0*15, 7*15, 0*15, 0*15, 2*15, 6*15, 0*15, 0*15, 0*15, 7*15, 0*15, 0*15, 2*15, + 6*15, 0*15, 0*15, 0*15, 7*15, 0*15, 0*15, 2*15, 6*15, 0*15, 0*15, 0*15, 7*15, 0*15, 0*15, 2*15, + 6*15, 0*15, 0*15, 0*15, 7*15, 0*15, 0*15, 2*15, 6*15, 0*15, 0*15, 0*15, 7*15, 0*15, 0*15, 2*15, + 6*15, 0*15, 0*15, 0*15, 7*15, 0*15, 0*15, 2*15, 6*15, 0*15, 0*15, 0*15, 7*15, 0*15, 0*15, 2*15}; -static const UINT8 *cc[6]; +static const UINT16 *cc[6]; #define Z80_TABLE_dd Z80_TABLE_xy #define Z80_TABLE_fd Z80_TABLE_xy @@ -479,7 +479,7 @@ INLINE void BURNODD(int cycles, int opcodes, int cyclesum) /*************************************************************** * adjust cycle count by n T-states ***************************************************************/ -#define CC(prefix,opcode) mcycles_z80 += cc[Z80_TABLE_##prefix][opcode] * 15 +#define CC(prefix,opcode) mcycles_z80 += cc[Z80_TABLE_##prefix][opcode] /*************************************************************** * execute an opcode @@ -3225,7 +3225,7 @@ static void take_interrupt(void) RM16( irq_vector, &Z80.pc ); LOG(("Z80 #%d IM2 [$%04x] = $%04x\n",cpu_getactivecpu() , irq_vector, PCD)); /* CALL $xxxx + 'interrupt latency' cycles */ - mcycles_z80 += (cc[Z80_TABLE_op][0xcd] + cc[Z80_TABLE_ex][0xff]) * 15; + mcycles_z80 += cc[Z80_TABLE_op][0xcd] + cc[Z80_TABLE_ex][0xff]; } else /* Interrupt mode 1. RST 38h */ @@ -3235,7 +3235,7 @@ static void take_interrupt(void) PUSH( pc ); PCD = 0x0038; /* RST $38 + 'interrupt latency' cycles */ - mcycles_z80 += (cc[Z80_TABLE_op][0xff] + cc[Z80_TABLE_ex][0xff]) * 15; + mcycles_z80 += cc[Z80_TABLE_op][0xff] + cc[Z80_TABLE_ex][0xff]; } else { @@ -3249,18 +3249,18 @@ static void take_interrupt(void) PUSH( pc ); PCD = irq_vector & 0xffff; /* CALL $xxxx + 'interrupt latency' cycles */ - mcycles_z80 += (cc[Z80_TABLE_op][0xcd] + cc[Z80_TABLE_ex][0xff]) * 15; + mcycles_z80 += cc[Z80_TABLE_op][0xcd] + cc[Z80_TABLE_ex][0xff]; break; case 0xc30000: /* jump */ PCD = irq_vector & 0xffff; /* JP $xxxx + 2 cycles */ - mcycles_z80 += (cc[Z80_TABLE_op][0xc3] + cc[Z80_TABLE_ex][0xff]) * 15; + mcycles_z80 += cc[Z80_TABLE_op][0xc3] + cc[Z80_TABLE_ex][0xff]; break; default: /* rst (or other opcodes?) */ PUSH( pc ); PCD = irq_vector & 0x0038; /* RST $xx + 2 cycles */ - mcycles_z80 += (cc[Z80_TABLE_op][0xff] + cc[Z80_TABLE_ex][0xff]) * 15; + mcycles_z80 += cc[Z80_TABLE_op][0xff] + cc[Z80_TABLE_ex][0xff]; break; } }