bogoc68_t mfp_nextinterrupt(const mfp_t * const mfp) { const mfp_timer_t * itimer = find_next_int(mfp); const bogoc68_t bogoc = (!itimer) ? IO68_NO_INT : itimer->cti; return bogoc; }
bogoc68_t mfp_nextinterrupt(const mfp_t * const mfp, const bogoc68_t bogoc) #endif { const mfp_timer_t * itimer = find_next_int(mfp); #ifdef _MSC_VER const bogoc68_t bogoc = (!itimer) ? IO68_NO_INT : itimer->cti; #endif return bogoc; }
interrupt68_t * mfp_interrupt(mfp_t * const mfp, const bogoc68_t bogoc) { mfp_timer_t * itimer; /* Better recheck which timer interrupts coz previous interrupt code may have modified timer. */ while ((itimer = find_next_int(mfp)) && itimer->cti < bogoc) { /* Have a candidate */ mfp_timer_t * const ptimer = itimer; /* Process interruption. */ timer_interrupt(mfp,ptimer); #ifndef _MFPIO68_SUPER_EMUL_ /* ======================== */ /* Simple Emulation Version */ /* ======================== */ if (mfp->map[0x07+ptimer->def.channel] & mfp->map[0x13+ptimer->def.channel] & ptimer->def.bit ) { ++ptimer->int_fall; return &ptimer->interrupt; } #else /* ========================== */ /* Accurate Emulation Version */ /* ========================== */ /* Test Interrupt Enable */ if ( mfp->map[0x07+ptimer->channel] & ptimer->bit ) { /* Set Interrupt Pending Bit */ mfp->map[0x0B+ptimer->channel] |= ptimer->bit; /* Test Interrupt In Service */ if (!(mfp->map[0x0F+ptimer->channel]&ptimer->bit)) { /* SEI : Set Interrupt In Service */ if (SEI) mfp->map[0x0B+ptimer->channel] |= ptimer->bit; /* Test Interrupt Mask */ if (mfp->map[0x13+ptimer->channel] & ptimer->bit) { ++ptimer->int_fall; return &ptimer->interrupt; } } } #endif /* For some reason interruption was cancelled. */ ++ptimer->int_mask; } return 0; }