comparison vdp.c @ 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 34d3cb05014d
children 6ad59a62e656
comparison
equal deleted inserted replaced
1284:82838d4c84d9 1285:76e47254596b
2480 //printf("New Address: %X, New CD: %X\n", context->address, context->cd); 2480 //printf("New Address: %X, New CD: %X\n", context->address, context->cd);
2481 if (context->cd & 0x20) { 2481 if (context->cd & 0x20) {
2482 // 2482 //
2483 if((context->regs[REG_DMASRC_H] & 0xC0) != 0x80) { 2483 if((context->regs[REG_DMASRC_H] & 0xC0) != 0x80) {
2484 //DMA copy or 68K -> VDP, transfer starts immediately 2484 //DMA copy or 68K -> VDP, transfer starts immediately
2485 context->flags |= FLAG_DMA_RUN;
2486 context->dma_cd = context->cd; 2485 context->dma_cd = context->cd;
2487 //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); 2486 //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);
2488 if (!(context->regs[REG_DMASRC_H] & 0x80)) { 2487 if (!(context->regs[REG_DMASRC_H] & 0x80)) {
2489 //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]); 2488 //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]);
2489 //68K -> VDP DMA takes 4 slots to actually start reading even though it acquires the bus immediately
2490 vdp_run_context(context, context->cycles + 16 * ((context->regs[REG_MODE_2] & BIT_MODE_5) && (context->regs[REG_MODE_4] & BIT_H40) ? 4 : 5));
2491 context->flags |= FLAG_DMA_RUN;
2490 return 1; 2492 return 1;
2491 } else { 2493 } else {
2494 context->flags |= FLAG_DMA_RUN;
2492 //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]); 2495 //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]);
2493 } 2496 }
2494 } else { 2497 } else {
2495 //printf("DMA Fill Address: %X, New CD: %X\n", context->address, context->cd); 2498 //printf("DMA Fill Address: %X, New CD: %X\n", context->address, context->cd);
2496 } 2499 }