X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=Pico%2FVideoPort.c;h=997b938aedcb2a7a2ee58ab6354011ca716524d6;hb=7336a99a49268970e0df89d15210b98dd7798f1e;hp=e3643df8879b88f330d4df68bee7e1ec3f0093e9;hpb=cea6590346640236914eeff840401c55db8a77ce;p=picodrive.git diff --git a/Pico/VideoPort.c b/Pico/VideoPort.c index e3643df..997b938 100644 --- a/Pico/VideoPort.c +++ b/Pico/VideoPort.c @@ -8,6 +8,7 @@ #include "PicoInt.h" +#include "cd/gfx_cd.h" extern const unsigned char hcounts_32[]; extern const unsigned char hcounts_40[]; @@ -88,7 +89,8 @@ static void DmaSlow(int len) if(Pico.m.scanline != -1) { Pico.m.dma_bytes += len; - SekSetCyclesLeft(SekCyclesLeft - CheckDMA()); + if ((PicoMCD&1) && (PicoOpt & 0x2000)) SekCycleCnt+=CheckDMA(); + else SekSetCyclesLeftNoMCD(SekCyclesLeftNoMCD - CheckDMA()); } else { // be approximate in non-accurate mode SekSetCyclesLeft(SekCyclesLeft - (len*(((488<<8)/167))>>8)); @@ -98,25 +100,31 @@ static void DmaSlow(int len) pd=(u16 *)(Pico.ram+(source&0xfffe)); pdend=(u16 *)(Pico.ram+0x10000); } else if(PicoMCD & 1) { - dprintf("DmaSlow CD"); + dprintf("DmaSlow CD, r3=%02x", Pico_mcd->s68k_regs[3]); if(source<0x20000) { // Bios area pd=(u16 *)(Pico_mcd->bios+(source&~1)); pdend=(u16 *)(Pico_mcd->bios+0x20000); - } else if ((source&0xfc0000)==0x200000 && (!(Pico_mcd->s68k_regs[3]&4))) { // Word Ram + } else if ((source&0xfc0000)==0x200000) { // Word Ram + source -= 2; if (!(Pico_mcd->s68k_regs[3]&4)) { // 2M mode - source -= 2; - pd=(u16 *)(Pico_mcd->word_ram+(source&0x3fffe)); - pdend=(u16 *)(Pico_mcd->word_ram+0x40000); + pd=(u16 *)(Pico_mcd->word_ram2M+(source&0x3fffe)); + pdend=(u16 *)(Pico_mcd->word_ram2M+0x40000); } else { - dprintf("DmaSlow: unsupported src"); - return; + if (source < 0x220000) { // 1M mode + int bank = Pico_mcd->s68k_regs[3]&1; + pd=(u16 *)(Pico_mcd->word_ram1M[bank]+(source&0x1fffe)); + pdend=(u16 *)(Pico_mcd->word_ram1M[bank]+0x20000); + } else { + DmaSlowCell(source, a, len, inc); + return; + } } } else if ((source&0xfe0000)==0x020000) { // Prg Ram u8 *prg_ram = Pico_mcd->prg_ram_b[Pico_mcd->s68k_regs[3]>>6]; pd=(u16 *)(prg_ram+(source&0x1fffe)); pdend=(u16 *)(prg_ram+0x20000); } else { - dprintf("DmaSlow: unsupported src"); + dprintf("DmaSlow FIXME: unsupported src"); return; } } else { @@ -142,8 +150,8 @@ static void DmaSlow(int len) if (inc == 2 && !(a&1) && a+len*2 < 0x10000) { // most used DMA mode - memcpy16(r + (a>>1), pd, len); - a += len*2; + memcpy16(r + (a>>1), pd, len); + a += len*2; } else { @@ -166,7 +174,7 @@ static void DmaSlow(int len) r = Pico.cram; for(a2=a&0x7f; len; len--) { - r[a2>>1] = (u16)*pd++;; // bit 0 is ignored + r[a2>>1] = (u16)*pd++; // bit 0 is ignored // AutoIncrement a2+=inc; // didn't src overlap?