--- xmil/ievent.c 2004/08/11 13:53:53 1.2 +++ xmil/ievent.c 2004/08/15 17:51:53 1.5 @@ -9,9 +9,6 @@ // ここでデイジーチェイン - IEVENT ievent; - - typedef BRESULT (*IEVENTFN)(UINT id); static BRESULT dummy(UINT id) { @@ -22,7 +19,7 @@ static BRESULT dummy(UINT id) { static const IEVENTFN ieventfn[IEVENT_MAX] = { dummy, // IEVENT_SIO - dummy, // IEVENT_DMA + ieitem_dmac, // IEVENT_DMA ieitem_ctc, // IEVENT_CTC0 ieitem_ctc, // IEVENT_CTC1 ieitem_ctc, // IEVENT_CTC2 @@ -31,21 +28,24 @@ static const IEVENTFN ieventfn[IEVENT_MA // ---- -void ievent_reset(void) { -} - void ievent_progress(void) { UINT i; UINT bit; - if ((CPU_REQIRQ == 0) || (!Z80_ABLEINTERRUPT())) { + if ((CPU_REQIRQ == 0) || (Z80_DI)) { return; } for (i=0, bit=1; i> 1; + if (!(r & bit)) { + return; + } + nevent_forceexit(); +} + +void ievent_eoi(void) { + + UINT i; + UINT bit; + +// CPU_IRQ = CPU_IRQ & (CPU_IRQ - 1); + + if (CPU_IRQ == 0) { + return; + } + for (i=0, bit=1; i= IEVENT_CTC0) && (i <= IEVENT_CTC2)) { + ieeoi_ctc(i); + } + break; + } + } + if ((!(Z80_IFF & ((1 << IFF_IFLAG) | (1 << IFF_NMI)))) && + (CPU_REQIRQ != 0)) { + CPU_BASECLOCK -= CPU_REMCLOCK; + CPU_REMCLOCK = 0; } }