Diff for /np2/sound/fmtimer.c between versions 1.9 and 1.12

version 1.9, 2004/02/19 11:32:12 version 1.12, 2007/10/26 14:38:33
Line 9 Line 9
 static const UINT8 irqtable[4] = {0x03, 0x0d, 0x0a, 0x0c};  static const UINT8 irqtable[4] = {0x03, 0x0d, 0x0a, 0x0c};
   
   
   static void set_fmtimeraevent(BOOL absolute) {
   
           SINT32  l;
   
           l = 18 * (1024 - fmtimer.timera);
           if (pccore.cpumode & CPUMODE_8MHZ) {            // 4MHz
                   l = (l * 1248 / 625) * pccore.multiple;
           }
           else {                                                                          // 5MHz
                   l = (l * 1536 / 625) * pccore.multiple;
           }
   //      TRACEOUT(("FMTIMER-A: %08x-%d", l, absolute));
           nevent_set(NEVENT_FMTIMERA, l, fmport_a, absolute);
   }
   
   static void set_fmtimerbevent(BOOL absolute) {
   
           SINT32  l;
   
           l = 288 * (256 - fmtimer.timerb);
           if (pccore.cpumode & CPUMODE_8MHZ) {            // 4MHz
                   l = (l * 1248 / 625) * pccore.multiple;
           }
           else {                                                                          // 5MHz
                   l = (l * 1536 / 625) * pccore.multiple;
           }
   //      TRACEOUT(("FMTIMER-B: %08x-%d", l, absolute));
           nevent_set(NEVENT_FMTIMERB, l, fmport_b, absolute);
   }
   
   
 void fmport_a(NEVENTITEM item) {  void fmport_a(NEVENTITEM item) {
   
         BOOL    intreq = FALSE;          BOOL    intreq = FALSE;
   
         if (item->flag & NEVENT_SETEVENT) {          if (item->flag & NEVENT_SETEVENT) {
                   intreq = pcm86gen_intrq();
                 if (fmtimer.reg & 0x04) {                  if (fmtimer.reg & 0x04) {
                         fmtimer.status |= 0x01;                          fmtimer.status |= 0x01;
                         intreq = TRUE;                          intreq = TRUE;
                 }                  }
                 if (pcm86.fifo & 0x20) {  
                         sound_sync();  
                         if (pcm86.virbuf <= pcm86.fifosize) {  
                                 intreq = TRUE;  
                         }  
                 }  
                 if (intreq) {                  if (intreq) {
                         pcm86.write = 1;  
                         pic_setirq(fmtimer.irq);                          pic_setirq(fmtimer.irq);
 //                      TRACEOUT(("fm int-A"));  //                      TRACEOUT(("fm int-A"));
                 }                  }
 //              TRACE_("A: fifo = ", pcm86.fifo);  
 //              TRACE_("A: virbuf = ", pcm86.virbuf);                  set_fmtimeraevent(FALSE);
 //              TRACE_("A: fifosize = ", pcm86.fifosize);  
         }          }
 }  }
   
Line 40  void fmport_b(NEVENTITEM item) { Line 64  void fmport_b(NEVENTITEM item) {
         BOOL    intreq = FALSE;          BOOL    intreq = FALSE;
   
         if (item->flag & NEVENT_SETEVENT) {          if (item->flag & NEVENT_SETEVENT) {
                   intreq = pcm86gen_intrq();
                 if (fmtimer.reg & 0x08) {                  if (fmtimer.reg & 0x08) {
                         fmtimer.status |= 0x02;                          fmtimer.status |= 0x02;
                         intreq = TRUE;                          intreq = TRUE;
                 }                  }
                 if (pcm86.fifo & 0x20) {  
                         sound_sync();  
                         if (pcm86.virbuf <= pcm86.fifosize) {  
                                 intreq = TRUE;  
                         }  
                 }  
                 if (intreq) {                  if (intreq) {
                         pcm86.write = 1;  
                         pic_setirq(fmtimer.irq);                          pic_setirq(fmtimer.irq);
 //                      TRACEOUT(("fm int-B"));  //                      TRACEOUT(("fm int-B"));
                 }                  }
 //              TRACE_("B: fifo = ", pcm86.fifo);  
 //              TRACE_("B: virbuf = ", pcm86.virbuf);  
 //              TRACE_("B: fifosize = ", pcm86.fifosize);  
         }  
 }  
   
 static void set_fmtimeraevent(BOOL absolute) {  
   
         SINT32  l;  
   
         l = 18 * (1024 - fmtimer.timera);                  set_fmtimerbevent(FALSE);
         if (pccore.cpumode & CPUMODE_8MHZ) {            // 4MHz  
                 l = (l * 1248 / 625) * pccore.multiple;  
         }  
         else {                                                                          // 5MHz  
                 l = (l * 1536 / 625) * pccore.multiple;  
         }          }
         nevent_set(NEVENT_FMTIMERA, l, fmport_a, absolute);  
 }  
   
 static void set_fmtimerbevent(BOOL absolute) {  
   
         SINT32  l;  
   
         l = 288 * (256 - fmtimer.timerb);  
         if (pccore.cpumode & CPUMODE_8MHZ) {            // 4MHz  
                 l = (l * 1248 / 625) * pccore.multiple;  
         }  
         else {                                                                          // 5MHz  
                 l = (l * 1536 / 625) * pccore.multiple;  
         }  
         nevent_set(NEVENT_FMTIMERB, l, fmport_b, absolute);  
 }  }
   
 void fmtimer_reset(UINT irq) {  void fmtimer_reset(UINT irq) {
Line 98  void fmtimer_reset(UINT irq) { Line 87  void fmtimer_reset(UINT irq) {
 //      pic_registext(fmtimer.irq);  //      pic_registext(fmtimer.irq);
 }  }
   
 void fmtimer_setreg(REG8 reg, REG8 value) {  void fmtimer_setreg(UINT reg, REG8 value) {
   
 //      TRACEOUT(("fm %x %x [%.4x:%.4x]", reg, value, CPU_CS, CPU_IP));  //      TRACEOUT(("fm %x %x [%.4x:%.4x]", reg, value, CPU_CS, CPU_IP));
   
Line 126  void fmtimer_setreg(REG8 reg, REG8 value Line 115  void fmtimer_setreg(REG8 reg, REG8 value
                         else {                          else {
                                 nevent_reset(NEVENT_FMTIMERA);                                  nevent_reset(NEVENT_FMTIMERA);
                         }                          }
   
                         if (value & 0x02) {                          if (value & 0x02) {
                                 if (!nevent_iswork(NEVENT_FMTIMERB)) {                                  if (!nevent_iswork(NEVENT_FMTIMERB)) {
                                         set_fmtimerbevent(NEVENT_ABSOLUTE);                                          set_fmtimerbevent(NEVENT_ABSOLUTE);
Line 134  void fmtimer_setreg(REG8 reg, REG8 value Line 124  void fmtimer_setreg(REG8 reg, REG8 value
                         else {                          else {
                                 nevent_reset(NEVENT_FMTIMERB);                                  nevent_reset(NEVENT_FMTIMERB);
                         }                          }
   
                         if (!(value & 0x03)) {                          if (!(value & 0x03)) {
                                 pic_resetirq(fmtimer.irq);                                  pic_resetirq(fmtimer.irq);
                         }                          }

Removed from v.1.9  
changed lines
  Added in v.1.12


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