From: notaz Date: Fri, 20 Oct 2017 21:02:38 +0000 (+0300) Subject: handle 'bad' dma better X-Git-Tag: v1.93~30 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eef77d7a8b0b0d47e9559e40d8cb6407ea39b0f2;p=picodrive.git handle 'bad' dma better --- diff --git a/pico/pico.c b/pico/pico.c index 2e561c61..76c5fe92 100644 --- a/pico/pico.c +++ b/pico/pico.c @@ -253,10 +253,9 @@ PICO_INTERNAL int CheckDMA(void) xfers_can = dma_timings[dma_op]; if(xfers <= xfers_can) { - if(dma_op&2) Pico.video.status&=~2; // dma no longer busy - else { + Pico.video.status &= ~SR_DMA; + if (!(dma_op & 2)) burn = xfers * dma_bsycles[dma_op] >> 8; // have to be approximate because can't afford division.. - } Pico.m.dma_xfers = 0; } else { if(!(dma_op&2)) burn = 488; diff --git a/pico/videoport.c b/pico/videoport.c index 355489e9..9def819d 100644 --- a/pico/videoport.c +++ b/pico/videoport.c @@ -100,7 +100,7 @@ static void DmaSlow(int len, unsigned int source) Pico.video.type, source, a, len, inc, (Pico.video.status&8)||!(Pico.video.reg[1]&0x40), SekCyclesDone(), SekPc); - Pico.m.dma_xfers += len; + Pico.m.dma_xfers = len; if (Pico.m.dma_xfers < len) // lame 16bit var Pico.m.dma_xfers = ~0; SekCyclesBurnRun(CheckDMA()); @@ -225,10 +225,10 @@ static void DmaCopy(int len) int source; elprintf(EL_VDPDMA, "DmaCopy len %i [%u]", len, SekCyclesDone()); - Pico.m.dma_xfers += len; + Pico.m.dma_xfers = len; if (Pico.m.dma_xfers < len) Pico.m.dma_xfers = ~0; - Pico.video.status |= 2; // dma busy + Pico.video.status |= SR_DMA; source =Pico.video.reg[0x15]; source|=Pico.video.reg[0x16]<<8; @@ -256,10 +256,10 @@ static NOINLINE void DmaFill(int data) len = GetDmaLength(); elprintf(EL_VDPDMA, "DmaFill len %i inc %i [%u]", len, inc, SekCyclesDone()); - Pico.m.dma_xfers += len; + Pico.m.dma_xfers = len; if (Pico.m.dma_xfers < len) // lame 16bit var Pico.m.dma_xfers = ~0; - Pico.video.status |= 2; // dma busy + Pico.video.status |= SR_DMA; switch (Pico.video.type) { @@ -306,6 +306,10 @@ static NOINLINE void CommandDma(void) if ((pvid->reg[1]&0x10)==0) return; // DMA not enabled + if (Pico.m.dma_xfers) + elprintf(EL_VDPDMA|EL_ANOMALY, "Dma overlap, left=%d @ %06x", + Pico.m.dma_xfers, SekPc); + len = GetDmaLength(); source =Pico.video.reg[0x15]; source|=Pico.video.reg[0x16] << 8;