diff --git a/source/cd_hw/cdc.c b/source/cd_hw/cdc.c index cb0ae98..fdfe6b2 100644 --- a/source/cd_hw/cdc.c +++ b/source/cd_hw/cdc.c @@ -471,9 +471,6 @@ void cdc_reg_w(unsigned char data) unsigned char cdc_reg_r(void) { -#ifdef LOG_CDC - error("CDC register %X read (%X) ", scd.regs[0x04>>1].byte.l & 0x0F, s68k.pc); -#endif switch (scd.regs[0x04>>1].byte.l & 0x0F) { case 0x01: /* IFSTAT */ diff --git a/source/cd_hw/scd.c b/source/cd_hw/scd.c index 71160d2..6d3152c 100644 --- a/source/cd_hw/scd.c +++ b/source/cd_hw/scd.c @@ -190,6 +190,9 @@ INLINE void s68k_poll_detect(reg) if (s68k.pc == s68k.poll.pc) { /* stop SUB-CPU until register is modified by MAIN-CPU */ +#ifdef LOG_SCD + error("s68k stopped from %d cycles\n", s68k.cycles); +#endif s68k.cycles = s68k.cycle_end; s68k.stopped = 1 << reg; } @@ -226,6 +229,9 @@ INLINE void s68k_poll_sync(reg) /* restart MAIN-CPU */ m68k.stopped = 0; +#ifdef LOG_SCD + error("m68k started from %d cycles\n", cycles); +#endif } /* clear CPU register(s) access flags */ @@ -269,6 +275,9 @@ static unsigned int scd_read_byte(unsigned int address) if (address == 0xff8007) { unsigned int data = cdc_reg_r(); +#ifdef LOG_CDC + error("CDC register %X read 0x%02X (%X) ", scd.regs[0x04>>1].byte.l & 0x0F, data, s68k.pc); +#endif return data; } @@ -1667,9 +1676,6 @@ int scd_context_load(uint8 *state) load_param(&tmp32, 4); s68k_set_reg(M68K_REG_USP,tmp32); load_param(&tmp32, 4); s68k_set_reg(M68K_REG_ISP,tmp32); - /* update IRQ level */ - s68k_update_irq((scd.pending & scd.regs[0x32>>1].byte.l) >> 1); - return bufferptr; } diff --git a/source/m68k/m68kcpu.c b/source/m68k/m68kcpu.c index b1600f1..dd709b1 100644 --- a/source/m68k/m68kcpu.c +++ b/source/m68k/m68kcpu.c @@ -273,7 +273,11 @@ void m68k_run(unsigned int cycles) /* Save end cycles count for when CPU is stopped */ m68k.cycle_end = cycles; - + +#ifdef LOGVDP + error("[%d][%d] m68k run to %d cycles (%x)\n", v_counter, m68k.cycles, cycles, m68k.pc); +#endif + while (m68k.cycles < cycles) { /* Set tracing accodring to T1. */ diff --git a/source/m68k/s68kcpu.c b/source/m68k/s68kcpu.c index 48474ba..4fe7312 100644 --- a/source/m68k/s68kcpu.c +++ b/source/m68k/s68kcpu.c @@ -211,13 +211,13 @@ void s68k_update_irq(unsigned int mask) /* Set IRQ level */ CPU_INT_LEVEL = mask << 8; - - /* Check interrupt mask to process IRQ */ - m68ki_check_interrupts(); #ifdef LOG_SCD error("[%d][%d] IRQ Level = %d(0x%02x) (%x)\n", v_counter, s68k.cycles, CPU_INT_LEVEL>>8,FLAG_INT_MASK,s68k.pc); #endif + + /* Check interrupt mask to process IRQ */ + m68ki_check_interrupts(); } void s68k_run(unsigned int cycles) @@ -234,7 +234,10 @@ void s68k_run(unsigned int cycles) /* Save end cycles count for when CPU is stopped */ s68k.cycle_end = cycles; - +#ifdef LOG_SCD + error("[%d][%d] s68k run to %d cycles (%x), irq mask = %x (%x)\n", v_counter, s68k.cycles, cycles, s68k.pc,FLAG_INT_MASK, CPU_INT_LEVEL); +#endif + while (s68k.cycles < cycles) { /* Set tracing accodring to T1. */ diff --git a/source/mem68k.c b/source/mem68k.c index c14bb80..686ca40 100644 --- a/source/mem68k.c +++ b/source/mem68k.c @@ -233,6 +233,9 @@ INLINE void m68k_poll_detect(reg) if (m68k.pc == m68k.poll.pc) { /* stop MAIN-CPU until register is modified by SUB-CPU */ +#ifdef LOG_SCD + error("m68k stopped from %d cycles\n", m68k.cycles); +#endif m68k.cycles = m68k.cycle_end; m68k.stopped = 1 << reg; } @@ -269,6 +272,9 @@ INLINE void m68k_poll_sync(reg) /* restart SUB-CPU */ s68k.stopped = 0; +#ifdef LOG_SCD + error("s68k started from %d cycles\n", cycles); +#endif } /* clear CPU register(s) access flags */