Diff for /np2/io/dmac.c between versions 1.9 and 1.12

version 1.9, 2004/03/06 18:25:36 version 1.12, 2005/02/07 14:46:11
Line 1 Line 1
 #include        "compiler.h"  #include        "compiler.h"
   #include        "cpucore.h"
 #include        "pccore.h"  #include        "pccore.h"
 #include        "iocore.h"  #include        "iocore.h"
 #include        "sound.h"  #include        "sound.h"
Line 32  static const DMAPROC dmaproc[] = { Line 33  static const DMAPROC dmaproc[] = {
                 {dma_dummyout,          dma_dummyin,            dma_dummyproc},         // SASI                  {dma_dummyout,          dma_dummyin,            dma_dummyproc},         // SASI
 #endif  #endif
                 {dma_dummyout,          dma_dummyin,            dma_dummyproc},         // SCSI                  {dma_dummyout,          dma_dummyin,            dma_dummyproc},         // SCSI
   #if !defined(DISABLE_SOUND)
                 {dma_dummyout,          dma_dummyin,            cs4231dmafunc},         // CS4231                  {dma_dummyout,          dma_dummyin,            cs4231dmafunc},         // CS4231
   #else
                   {dma_dummyout,          dma_dummyin,            dma_dummyproc},         // SASI
   #endif
 };  };
   
   
Line 52  void dmac_check(void) { Line 57  void dmac_check(void) {
                         if (!(dmac.work & bit)) {                          if (!(dmac.work & bit)) {
                                 dmac.work |= bit;                                  dmac.work |= bit;
                                 if (ch->proc.extproc(DMAEXT_START)) {                                  if (ch->proc.extproc(DMAEXT_START)) {
                                         dmac.stat &= ~bit;                                              // ver0.27                                          dmac.stat &= ~bit;
                                         dmac.working |= bit;                                          dmac.working |= bit;
                                         workchg = TRUE;                                          workchg = TRUE;
                                 }                                  }
Line 74  void dmac_check(void) { Line 79  void dmac_check(void) {
         }          }
 }  }
   
   UINT dmac_getdatas(DMACH dmach, UINT8 *buf, UINT size) {
   
           UINT    leng;
           UINT32  addr;
           UINT    i;
   
           leng = min(dmach->leng.w, size);
           if (leng) {
                   addr = dmach->adrs.d;                                   // + mask
                   if (!(dmach->mode & 0x20)) {                    // dir +
                           for (i=0; i<leng; i++) {
                                   buf[i] = MEMP_READ8(addr + i);
                           }
                           dmach->adrs.d += leng;
                   }
                   else {                                                                  // dir -
                           for (i=0; i<leng; i++) {
                                   buf[i] = MEMP_READ8(addr - i);
                           }
                           dmach->adrs.d -= leng;
                   }
                   dmach->leng.w -= leng;
                   if (dmach->leng.w == 0) {
                           dmach->proc.extproc(DMAEXT_END);
                   }
           }
           return(leng);
   }
   
   
 // ---- I/O  // ---- I/O
   
Line 252  static void dmacset(REG8 channel) { Line 286  static void dmacset(REG8 channel) {
                 }                  }
                 dev++;                  dev++;
         }          }
         if (dmadev >= sizeof(dmaproc) / sizeof(DMAPROC)) {          if (dmadev >= NELEMENTS(dmaproc)) {
                 dmadev = 0;                  dmadev = 0;
         }          }
 //      TRACEOUT(("dmac set %d - %d", channel, dmadev));  //      TRACEOUT(("dmac set %d - %d", channel, dmadev));
Line 272  void dmac_attach(REG8 device, REG8 chann Line 306  void dmac_attach(REG8 device, REG8 chann
   
         dmac_detach(device);          dmac_detach(device);
   
         if (dmac.devices < (sizeof(dmac.device) / sizeof(DMADEV))) {          if (dmac.devices < NELEMENTS(dmac.device)) {
                 dmac.device[dmac.devices].device = device;                  dmac.device[dmac.devices].device = device;
                 dmac.device[dmac.devices].channel = channel;                  dmac.device[dmac.devices].channel = channel;
                 dmac.devices++;                  dmac.devices++;

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


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