return d;\r
}\r
\r
-#if 0\r
-// calculate the number of cycles 68k->VDP dma operation would take\r
-static int DmaSlowBurn(int len)\r
-{\r
- // test: Legend of Galahad, Time Killers\r
- int burn,maxlen,line=Pico.m.scanline;\r
-\r
- if(line == -1) line=vcounts[SekCyclesDone()>>8];\r
- maxlen=(224-line)*18;\r
- if(len <= maxlen)\r
- burn = len*(((488<<8)/18))>>8;\r
- else {\r
- burn = maxlen*(((488<<8)/18))>>8;\r
- burn += (len-maxlen)*(((488<<8)/180))>>8;\r
- }\r
-\r
- return burn;\r
-}\r
-#endif\r
-\r
static int GetDmaLength()\r
{\r
struct PicoVideo *pvid=&Pico.video;\r
u16 *pd=0, *pdend, *r;\r
unsigned int a=Pico.video.addr, a2, d;\r
unsigned char inc=Pico.video.reg[0xf];\r
- unsigned int source; // , burn;\r
+ unsigned int source;\r
\r
source =Pico.video.reg[0x15]<<1;\r
source|=Pico.video.reg[0x16]<<9;\r
Pico.video.type, source, a, len, inc, (Pico.video.status&8)||!(Pico.video.reg[1]&0x40),\r
Pico.m.scanline, SekCyclesDone(), SekPc);\r
\r
+ if(Pico.m.scanline != -1) {\r
+ Pico.m.dma_bytes += len;\r
+ SekSetCyclesLeft(SekCyclesLeft - CheckDMA());\r
+ } else {\r
+ // be approximate in non-accurate mode\r
+ SekSetCyclesLeft(SekCyclesLeft - (len*(((488<<8)/167))>>8));\r
+ }\r
+\r
if ((source&0xe00000)==0xe00000) { pd=(u16 *)(Pico.ram+(source&0xfffe)); pdend=(u16 *)(Pico.ram+0x10000); } // Ram\r
- else if(source<Pico.romsize) { pd=(u16 *)(Pico.rom+(source&~1)); pdend=(u16 *)(Pico.rom+Pico.romsize); } // Rom\r
- else return; // Invalid source address\r
-\r
-#if 0\r
- // CPU is stopped during DMA, so we burn some cycles to compensate that\r
- if((Pico.video.status&8)||!(Pico.video.reg[1]&0x40)) { // vblank?\r
- burn = (len*(((488<<8)/167))>>8); // very approximate\r
- if(!(Pico.video.status&8)) burn+=burn>>1; // a hack for Legend of Galahad\r
- } else burn = DmaSlowBurn(len);\r
- SekCyclesBurn(burn);\r
-#else\r
- Pico.m.dma_bytes += len;\r
-#endif\r
- //if(!(Pico.video.status&8))\r
-// SekEndRun(0);\r
- //Pico.m.dma_endcycles = 0;//SekCyclesLeft;\r
- //Pico.m.dma_endcycles -= Pico.m.dma_endcycles>>3; // hack\r
- SekSetCyclesLeft(SekCyclesLeft - CheckDMA());\r
-// CheckDMA();\r
-// dprintf("DmaSlow burn: %i @ %06x", burn, SekPc);\r
+ else if(PicoMCD & 1) {\r
+ if(source<0x20000) { pd=(u16 *)(Pico_mcd->bios+(source&~1)); pdend=(u16 *)(Pico_mcd->bios+0x20000); } // Bios area\r
+ else { dprintf("unsupported src"); return; } // Invalid source address\r
+ } else {\r
+ if(source<Pico.romsize) { pd=(u16 *)(Pico.rom+(source&~1)); pdend=(u16 *)(Pico.rom+Pico.romsize); } // Rom\r
+ else { dprintf("invalid dma src"); return; } // Invalid source address\r
+ }\r
\r
switch (Pico.video.type)\r
{\r