totalTicks = (sw+dw)*sc;
else { sw = 1+memoryWaitSeq[sm & 15] + ((((sm>=0x05) && (sm<=0x07)) && !blank) ? 1 : 0); dw = 1+memoryWaitSeq[dm & 15] + ((((dw>=0x05) && (dw<=0x07)) && !blank) ? 1 : 0); totalTicks = (sw+dw)*(sc-1) + 2 + 1 + memoryWait[sm & 15] + 1 + memoryWaitSeq[dm & 15]; }
void doDMA(u32 &s, u32 &d, u32 si, u32 di, u32 c, int transfer32){  int sm = s >> 24;  int dm = d >> 24;  int sc = c;  cpuDmaCount = c;    if(transfer32) {    s &= 0xFFFFFFFC;    if(s < 0x02000000 && (reg[15].I >> 24)) {      while(c != 0) {        CPUWriteMemory(d, 0);        d += di;        c--;      }    } else {      while(c != 0) {        cpuDmaLast = CPUReadMemory(s);        CPUWriteMemory(d, cpuDmaLast);        d += di;        s += si;        c--;      }    }  } else {    s &= 0xFFFFFFFE;    si = (int)si >> 1;    di = (int)di >> 1;    if(s < 0x02000000 && (reg[15].I >> 24)) {      while(c != 0) {        CPUWriteHalfWord(d, 0);        d += di;        c--;      }    } else {      while(c != 0) {        cpuDmaLast = CPUReadHalfWord(s);        CPUWriteHalfWord(d, cpuDmaLast);        cpuDmaLast |= (cpuDmaLast<<16);        d += di;        s += si;        c--;      }    }  }  cpuDmaCount = 0;    int sw = 1+memoryWaitSeq[sm & 15];  int dw = 1+memoryWaitSeq[dm & 15];  int totalTicks = 0;  if(transfer32) {    if(!memory32[sm & 15])      sw <<= 1;    if(!memory32[dm & 15])      dw <<= 1;  }    totalTicks = (sw+dw)*sc;  cpuDmaTicksToUpdate += totalTicks;  cpuNextEvent = 0;}