diff options
author | Mike Pavone <pavone@retrodev.com> | 2012-12-30 01:15:16 -0800 |
---|---|---|
committer | Mike Pavone <pavone@retrodev.com> | 2012-12-30 01:15:16 -0800 |
commit | 763b7d62f09098bc730a94278d9f208918c5ee5a (patch) | |
tree | 54d55c8594096dd14ef5c6d5b7c2380e955a1b15 | |
parent | 6260a5271ccac01f19f9cc6c6a0ac8452f83362a (diff) |
Fix bug that was causing DMA fills to lock up under certain circumstances
-rw-r--r-- | vdp.c | 10 | ||||
-rw-r--r-- | vdp.h | 1 |
2 files changed, 7 insertions, 4 deletions
@@ -191,7 +191,7 @@ void external_slot(vdp_context * context) //68K -> VDP case 0: case 0x40: - switch(context->cd & 0xF) + switch(context->dma_cd & 0xF) { case VRAM_WRITE: if (context->flags & FLAG_DMA_PROG) { @@ -215,7 +215,7 @@ void external_slot(vdp_context * context) break; //Fill case 0x80: - switch(context->cd & 0xF) + switch(context->dma_cd & 0xF) { case VRAM_WRITE: //Charles MacDonald's VDP doc says that the low byte gets written first @@ -243,7 +243,7 @@ void external_slot(vdp_context * context) //Copy case 0xC0: if (context->flags & FLAG_DMA_PROG) { - switch(context->cd & 0xF) + switch(context->dma_cd & 0xF) { case VRAM_WRITE: context->vdpmem[context->address] = context->dma_val; @@ -261,7 +261,7 @@ void external_slot(vdp_context * context) } else { //I assume, that DMA copy copies from the same RAM as the destination //but it's possible I'm mistaken - switch(context->cd & 0xF) + switch(context->dma_cd & 0xF) { case VRAM_WRITE: context->dma_val = context->vdpmem[(context->regs[REG_DMASRC_M] << 8) | context->regs[REG_DMASRC_L]]; @@ -297,6 +297,7 @@ void external_slot(vdp_context * context) if ((context->regs[REG_MODE_2] & BIT_DMA_ENABLE) && (context->cd & DMA_START)) { context->flags |= FLAG_DMA_RUN; context->dma_val = start->value; + context->dma_cd = context->cd; } else { switch (context->cd & 0xF) { @@ -1034,6 +1035,7 @@ int vdp_control_port_write(vdp_context * context, uint16_t value) 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; if (!(context->regs[REG_DMASRC_H] & 0x80)) { return 1; } @@ -110,6 +110,7 @@ typedef struct { uint16_t col_2; uint16_t dma_val; uint8_t v_offset; + uint8_t dma_cd; uint8_t *tmp_buf_a; uint8_t *tmp_buf_b; } vdp_context; |