handle 'bad' dma better

This commit is contained in:
notaz 2017-10-21 00:02:38 +03:00
parent ee5d41a1ed
commit eef77d7a8b
2 changed files with 11 additions and 8 deletions

View file

@ -253,10 +253,9 @@ PICO_INTERNAL int CheckDMA(void)
xfers_can = dma_timings[dma_op]; xfers_can = dma_timings[dma_op];
if(xfers <= xfers_can) if(xfers <= xfers_can)
{ {
if(dma_op&2) Pico.video.status&=~2; // dma no longer busy Pico.video.status &= ~SR_DMA;
else { if (!(dma_op & 2))
burn = xfers * dma_bsycles[dma_op] >> 8; // have to be approximate because can't afford division.. burn = xfers * dma_bsycles[dma_op] >> 8; // have to be approximate because can't afford division..
}
Pico.m.dma_xfers = 0; Pico.m.dma_xfers = 0;
} else { } else {
if(!(dma_op&2)) burn = 488; if(!(dma_op&2)) burn = 488;

View file

@ -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), Pico.video.type, source, a, len, inc, (Pico.video.status&8)||!(Pico.video.reg[1]&0x40),
SekCyclesDone(), SekPc); SekCyclesDone(), SekPc);
Pico.m.dma_xfers += len; Pico.m.dma_xfers = len;
if (Pico.m.dma_xfers < len) // lame 16bit var if (Pico.m.dma_xfers < len) // lame 16bit var
Pico.m.dma_xfers = ~0; Pico.m.dma_xfers = ~0;
SekCyclesBurnRun(CheckDMA()); SekCyclesBurnRun(CheckDMA());
@ -225,10 +225,10 @@ static void DmaCopy(int len)
int source; int source;
elprintf(EL_VDPDMA, "DmaCopy len %i [%u]", len, SekCyclesDone()); 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) if (Pico.m.dma_xfers < len)
Pico.m.dma_xfers = ~0; 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[0x15];
source|=Pico.video.reg[0x16]<<8; source|=Pico.video.reg[0x16]<<8;
@ -256,10 +256,10 @@ static NOINLINE void DmaFill(int data)
len = GetDmaLength(); len = GetDmaLength();
elprintf(EL_VDPDMA, "DmaFill len %i inc %i [%u]", len, inc, SekCyclesDone()); 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 if (Pico.m.dma_xfers < len) // lame 16bit var
Pico.m.dma_xfers = ~0; Pico.m.dma_xfers = ~0;
Pico.video.status |= 2; // dma busy Pico.video.status |= SR_DMA;
switch (Pico.video.type) switch (Pico.video.type)
{ {
@ -306,6 +306,10 @@ static NOINLINE void CommandDma(void)
if ((pvid->reg[1]&0x10)==0) return; // DMA not enabled 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(); len = GetDmaLength();
source =Pico.video.reg[0x15]; source =Pico.video.reg[0x15];
source|=Pico.video.reg[0x16] << 8; source|=Pico.video.reg[0x16] << 8;