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

version 1.7, 2004/01/22 01:10:04 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 24  REG8 DMACCALL dma_dummyproc(REG8 func) { Line 25  REG8 DMACCALL dma_dummyproc(REG8 func) {
   
 static const DMAPROC dmaproc[] = {  static const DMAPROC dmaproc[] = {
                 {dma_dummyout,          dma_dummyin,            dma_dummyproc},         // NONE                  {dma_dummyout,          dma_dummyin,            dma_dummyproc},         // NONE
                 {fdc_datawrite,         fdc_dataread,           fdc_dmafunc},           // FDD                  {fdc_datawrite,         fdc_dataread,           fdc_dmafunc},           // 2HD
                   {fdc_datawrite,         fdc_dataread,           fdc_dmafunc},           // 2DD
 #if defined(SUPPORT_SASI)  #if defined(SUPPORT_SASI)
                 {sasi_datawrite,        sasi_dataread,          sasi_dmafunc},          // SASI                  {sasi_datawrite,        sasi_dataread,          sasi_dmafunc},          // SASI
 #else  #else
                 {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 51  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 73  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 83  static void IOOUTCALL dmac_o01(UINT port Line 118  static void IOOUTCALL dmac_o01(UINT port
   
         dmach = dmac.dmach + ((port >> 2) & 3);          dmach = dmac.dmach + ((port >> 2) & 3);
         lh = dmac.lh;          lh = dmac.lh;
         dmac.lh = lh ^ 1;          dmac.lh = (UINT8)(lh ^ 1);
         dmach->adrs.b[lh + DMA32_LOW] = dat;          dmach->adrs.b[lh + DMA32_LOW] = dat;
         dmach->adrsorg.b[lh] = dat;          dmach->adrsorg.b[lh] = dat;
 }  }
Line 153  static void IOOUTCALL dmac_o21(UINT port Line 188  static void IOOUTCALL dmac_o21(UINT port
         DMACH   dmach;          DMACH   dmach;
   
         dmach = dmac.dmach + (((port >> 1) + 1) & 3);          dmach = dmac.dmach + (((port >> 1) + 1) & 3);
   #if defined(CPUCORE_IA32)
           dmach->adrs.b[DMA32_HIGH + DMA16_LOW] = dat;
   #else
           // IA16では ver0.75で無効、ver0.76で修正
         dmach->adrs.b[DMA32_HIGH + DMA16_LOW] = dat & 0x0f;          dmach->adrs.b[DMA32_HIGH + DMA16_LOW] = dat & 0x0f;
   #endif
   }
   
   static void IOOUTCALL dmac_o29(UINT port, REG8 dat) {
   
           DMACH   dmach;
   
           dmach = dmac.dmach + (dat & 3);
           dmach->bound = dat;
           (void)port;
 }  }
   
 static REG8 IOINPCALL dmac_i01(UINT port) {  static REG8 IOINPCALL dmac_i01(UINT port) {
Line 199  static const IOINP dmaci00[16] = { Line 248  static const IOINP dmaci00[16] = {
                                         dmac_i11,       NULL,           NULL,           NULL,                                          dmac_i11,       NULL,           NULL,           NULL,
                                         NULL,           NULL,           NULL,           NULL};                                          NULL,           NULL,           NULL,           NULL};
   
 static const IOOUT dmaco21[4] = {  static const IOOUT dmaco21[8] = {
                                         dmac_o21,       dmac_o21,       dmac_o21,       dmac_o21};                                          dmac_o21,       dmac_o21,       dmac_o21,       dmac_o21,
                                           dmac_o29,       NULL,           NULL,           NULL};
   
 void dmac_reset(void) {  void dmac_reset(void) {
   
Line 215  void dmac_bind(void) { Line 265  void dmac_bind(void) {
   
         iocore_attachsysoutex(0x0001, 0x0ce1, dmaco00, 16);          iocore_attachsysoutex(0x0001, 0x0ce1, dmaco00, 16);
         iocore_attachsysinpex(0x0001, 0x0ce1, dmaci00, 16);          iocore_attachsysinpex(0x0001, 0x0ce1, dmaci00, 16);
         iocore_attachsysoutex(0x0021, 0x0cf1, dmaco21, 4);          iocore_attachsysoutex(0x0021, 0x0cf1, dmaco21, 8);
 }  }
   
   
Line 236  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));
         dmac.dmach[channel].proc = dmaproc[dmadev];          dmac.dmach[channel].proc = dmaproc[dmadev];
 }  }
   
Line 255  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.7  
changed lines
  Added in v.1.12


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