Diff for /xmil/ievent.c between versions 1.1 and 1.6

version 1.1, 2004/08/11 12:08:16 version 1.6, 2008/06/02 20:07:30
Line 6 Line 6
 #include        "ievent.h"  #include        "ievent.h"
   
   
         IEVENT  ievent;  /* ここでデイジーチェイン */
   
   
 typedef BRESULT (*IEVENTFN)(UINT id);  typedef BRESULT (*IEVENTFN)(UINT id);
Line 18  static BRESULT dummy(UINT id) { Line 18  static BRESULT dummy(UINT id) {
 }  }
   
 static const IEVENTFN ieventfn[IEVENT_MAX] = {  static const IEVENTFN ieventfn[IEVENT_MAX] = {
                                 dummy,                  // IEVENT_SIO                                  dummy,                  /* IEVENT_SIO    */
                                 dummy,                  // IEVENT_DMA                                  ieitem_dmac,    /* IEVENT_DMA    */
                                 ieitem_ctc,             // IEVENT_CTC0                                  ieitem_ctc,             /* IEVENT_CTC0   */
                                 ieitem_ctc,             // IEVENT_CTC1                                  ieitem_ctc,             /* IEVENT_CTC1   */
                                 ieitem_ctc,             // IEVENT_CTC2                                  ieitem_ctc,             /* IEVENT_CTC2   */
                                 ieitem_scpu};   // IEVENT_SUBCPU                                  ieitem_scpu};   /* IEVENT_SUBCPU */
   
   
 // ----  /* ---- */
   
 void ievent_reset(void) {  
 }  
   
 void ievent_progress(void) {  void ievent_progress(void) {
   
         UINT    i;          UINT    i;
         UINT    bit;          UINT    bit;
   
         if ((CPU_REQIRQ == 0) || (!Z80_ABLEINTERRUPT())) {          if ((CPU_REQIRQ == 0) || (Z80_DI)) {
                 return;                  return;
         }          }
         for (i=0, bit=1; i<IEVENT_MAX; i++, bit<<=1) {          for (i=0, bit=1; i<IEVENT_MAX; i++, bit<<=1) {
                   if (CPU_IRQ & bit) {
                           break;
                   }
                 if (CPU_REQIRQ & bit) {                  if (CPU_REQIRQ & bit) {
                         CPU_REQIRQ ^= bit;                          CPU_REQIRQ ^= bit;
                         if (ieventfn[i](i)) {                          if (ieventfn[i](i)) {
                                   if (i != IEVENT_SUBCPU) {               /* サブCPUは別処理 */
                                           CPU_IRQ |= bit;
                                   }
                                 return;                                  return;
                         }                          }
                 }                  }
Line 51  void ievent_progress(void) { Line 54  void ievent_progress(void) {
   
 void ievent_setbit(UINT bit) {  void ievent_setbit(UINT bit) {
   
           UINT    r;
   
         if (CPU_REQIRQ & bit) {          if (CPU_REQIRQ & bit) {
                 return;                  return;
         }          }
         CPU_REQIRQ |= bit;          CPU_REQIRQ |= bit;
         if (Z80_ABLEINTERRUPT()) {          if (Z80_DI) {
                 nevent_forceexit();                  return;
           }
           r = CPU_IRQ;
           r = (r ^ (r - 1)) >> 1;
           if (!(r & bit)) {
                   return;
           }
           nevent_forceexit();
   }
   
   void ievent_eoi(void) {
   
           UINT    i;
           UINT    bit;
   
           if (CPU_IRQ == 0) {
                   return;
           }
           for (i=0, bit=1; i<IEVENT_MAX; i++, bit<<=1) {
                   if (CPU_IRQ & bit) {
                           CPU_IRQ ^= bit;
                           if ((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;
         }          }
 }  }
   

Removed from v.1.1  
changed lines
  Added in v.1.6


RetroPC.NET-CVS <cvs@retropc.net>