--- xmil/z80c/z80c.c 2004/08/01 05:31:32 1.1 +++ xmil/z80c/z80c.c 2004/08/14 12:16:18 1.7 @@ -11,7 +11,8 @@ #include "parts.h" #include "z80core.h" #include "z80c.h" -#include "x1_io.h" +#include "pccore.h" +#include "iocore.h" #include "z80c.mcr" @@ -123,12 +124,6 @@ void CPUCALL z80c_reset(void) { R_Z80R = rand_get(); } -REG8 CPUCALL z80c_ableinterrupt(void) { - - return((Z80_IFF & ((1 << IFF_IFLAG) | (1 << IFF_IRQ) | (1 << IFF_NMI))) - ?0:1); -} - void CPUCALL z80c_interrupt(REG8 vect) { REG16 pc; @@ -137,39 +132,6 @@ void CPUCALL z80c_interrupt(REG8 vect) { Z80_IFF ^= (1 << IFF_HALT); R_Z80PC++; } - Z80_IFF |= (1 << IFF_IRQ) | (1 << IFF_IFLAG); - switch(R_Z80IM) { - case 0: - if ((vect != 0xdd) && (vect != 0xed) && (vect != 0xfd)) { - Z80_COUNT(cycles_main[vect]); - z80c_mainop[vect](); - } - break; - - case 1: - Z80_COUNT(11); - R_Z80SP -= 2; - Z80_WRMEM_W(R_Z80SP, R_Z80PC); - R_Z80PC = 0x38; - break; - - case 2: - pc = Z80_RDMEM_W((R_Z80I << 8) + vect); - R_Z80SP -= 2; - Z80_WRMEM_W(R_Z80SP, R_Z80PC); - R_Z80PC = pc; - break; - } -} - -void CPUCALL z80c_interrupt2(REG8 vect) { - - REG16 pc; - - if (Z80_IFF & (1 << IFF_HALT)) { - Z80_IFF ^= (1 << IFF_HALT); - R_Z80PC++; - } Z80_IFF |= (1 << IFF_IFLAG); switch(R_Z80IM) { case 0: @@ -182,14 +144,14 @@ void CPUCALL z80c_interrupt2(REG8 vect) case 1: Z80_COUNT(11); R_Z80SP -= 2; - Z80_WRMEM_W(R_Z80SP, R_Z80PC); + mem_write16(R_Z80SP, R_Z80PC); R_Z80PC = 0x38; break; case 2: - pc = Z80_RDMEM_W((R_Z80I << 8) + vect); + pc = mem_read16((R_Z80I << 8) + vect); R_Z80SP -= 2; - Z80_WRMEM_W(R_Z80SP, R_Z80PC); + mem_write16(R_Z80SP, R_Z80PC); R_Z80PC = pc; break; } @@ -204,7 +166,7 @@ void CPUCALL z80c_nonmaskedinterrupt(voi R_Z80PC++; } R_Z80SP -= 2; - Z80_WRMEM_W(R_Z80SP, R_Z80PC); + mem_write16(R_Z80SP, R_Z80PC); R_Z80PC = 0x66; } } @@ -213,14 +175,33 @@ void CPUCALL z80c_execute(void) { UINT op; - R_Z80R++; - GET_PC_BYTE(op); - Z80_COUNT(cycles_main[op]); - z80c_mainop[op](); + if (!dma.working) { + do { + R_Z80R++; + GET_PC_BYTE(op); + Z80_COUNT(cycles_main[op]); + z80c_mainop[op](); + } while(CPU_REMCLOCK > 0); + } + else { + do { + R_Z80R++; + GET_PC_BYTE(op); + Z80_COUNT(cycles_main[op]); + z80c_mainop[op](); + z80dmap(); + } while(CPU_REMCLOCK > 0); + } +} + +void CPUCALL z80c_step(void) { + + UINT op; R_Z80R++; GET_PC_BYTE(op); Z80_COUNT(cycles_main[op]); z80c_mainop[op](); + z80dmap(); }