Mercurial > repos > blastem
changeset 1285:76e47254596b
Remove hacky post-DMA delay add proper pre-DMA delay based on logic analyzer capture. 512 color screen is a bit messed up but mostly works. Needs investigation
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sat, 18 Mar 2017 17:09:14 -0700 |
parents | 82838d4c84d9 |
children | ca0383656a82 |
files | genesis.c vdp.c |
diffstat | 2 files changed, 4 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/genesis.c Fri Mar 17 08:05:55 2017 -0700 +++ b/genesis.c Sat Mar 18 17:09:14 2017 -0700 @@ -296,12 +296,6 @@ sync_components(context, 0); gen->bus_busy = 0; } - if (!(v_context->flags & FLAG_DMA_RUN)) { - //two more slots of delay are needed to kill sufficient sprite capacity in Overdrive - //TODO: Measure exact value with logic analyzer - vdp_run_context(v_context, v_context->cycles + 1); - vdp_run_context(v_context, v_context->cycles + 1); - } } if (blocked < 0) {
--- a/vdp.c Fri Mar 17 08:05:55 2017 -0700 +++ b/vdp.c Sat Mar 18 17:09:14 2017 -0700 @@ -2482,13 +2482,16 @@ // if((context->regs[REG_DMASRC_H] & 0xC0) != 0x80) { //DMA copy or 68K -> VDP, transfer starts immediately - context->flags |= FLAG_DMA_RUN; context->dma_cd = context->cd; //printf("DMA start (length: %X) at cycle %d, frame: %d, vcounter: %d, hslot: %d\n", (context->regs[REG_DMALEN_H] << 8) | context->regs[REG_DMALEN_L], context->cycles, context->frame, context->vcounter, context->hslot); if (!(context->regs[REG_DMASRC_H] & 0x80)) { //printf("DMA Address: %X, New CD: %X, Source: %X, Length: %X\n", context->address, context->cd, (context->regs[REG_DMASRC_H] << 17) | (context->regs[REG_DMASRC_M] << 9) | (context->regs[REG_DMASRC_L] << 1), context->regs[REG_DMALEN_H] << 8 | context->regs[REG_DMALEN_L]); + //68K -> VDP DMA takes 4 slots to actually start reading even though it acquires the bus immediately + vdp_run_context(context, context->cycles + 16 * ((context->regs[REG_MODE_2] & BIT_MODE_5) && (context->regs[REG_MODE_4] & BIT_H40) ? 4 : 5)); + context->flags |= FLAG_DMA_RUN; return 1; } else { + context->flags |= FLAG_DMA_RUN; //printf("DMA Copy Address: %X, New CD: %X, Source: %X\n", context->address, context->cd, (context->regs[REG_DMASRC_M] << 8) | context->regs[REG_DMASRC_L]); } } else {