diff options
-rw-r--r-- | render_sdl.c | 22 | ||||
-rw-r--r-- | vdp.c | 4 |
2 files changed, 23 insertions, 3 deletions
diff --git a/render_sdl.c b/render_sdl.c index 36c3241..ab9fd50 100644 --- a/render_sdl.c +++ b/render_sdl.c @@ -6,6 +6,7 @@ SDL_Surface *screen; uint8_t render_dbg = 0; +uint8_t debug_pal = 0; uint32_t last_frame = 0; @@ -122,6 +123,12 @@ void render_context(vdp_context * context) } else { if (render_dbg == 2) { gen_color = context->cram[(y/30)*8 + x/40]; + } else if(render_dbg == 3) { + if (x & 1) { + gen_color = context->cram[ (debug_pal << 4) | (context->vdpmem[(x/8)*32 + (y/8)*32*40 + (x%8)/2 + (y%8)*4] & 0xF) ]; + } else { + gen_color = context->cram[ (debug_pal << 4) | (context->vdpmem[(x/8)*32 + (y/8)*32*40 + (x%8)/2 + (y%8)*4] >> 4) ]; + } } b = ((gen_color >> 8) & 0xE) * 18; g = ((gen_color >> 4) & 0xE) * 18; @@ -149,10 +156,15 @@ void render_wait_quit(vdp_context * context) case SDL_KEYDOWN: if (event.key.keysym.sym == SDLK_LEFTBRACKET) { render_dbg++; - if (render_dbg == 3) { + if (render_dbg == 4) { render_dbg = 0; } render_context(context); + } else if(event.key.keysym.sym == SDLK_RIGHTBRACKET) { + debug_pal++; + if (debug_pal == 4) { + debug_pal = 0; + } } break; case SDL_QUIT: @@ -189,10 +201,16 @@ void wait_render_frame(vdp_context * context) { case SDLK_LEFTBRACKET: render_dbg++; - if (render_dbg == 3) { + if (render_dbg == 4) { render_dbg = 0; } break; + case SDLK_RIGHTBRACKET: + debug_pal++; + if (debug_pal == 4) { + debug_pal = 0; + } + break; case SDLK_t: outfile = fopen("state.gst", "wb"); fwrite("GST\0\0\0\xE0\x40", 1, 8, outfile); @@ -225,7 +225,6 @@ void external_slot(vdp_context * context) context->vdpmem[context->address ^ 1] = context->dma_val >> 8; context->flags &= ~FLAG_DMA_PROG; } else { - context->dma_val = read_dma_value((context->regs[REG_DMASRC_H] << 16) | (context->regs[REG_DMASRC_M] << 8) | context->regs[REG_DMASRC_L]); context->vdpmem[context->address] = context->dma_val; context->flags |= FLAG_DMA_PROG; } @@ -284,6 +283,9 @@ void external_slot(vdp_context * context) if (!(context->flags & FLAG_DMA_PROG)) { context->address += context->regs[REG_AUTOINC]; context->regs[REG_DMASRC_L] += 1; + if (!context->regs[REG_DMASRC_L]) { + context->regs[REG_DMASRC_M] += 1; + } dma_len = ((context->regs[REG_DMALEN_H] << 8) | context->regs[REG_DMALEN_L]) - 1; context->regs[REG_DMALEN_H] = dma_len >> 8; context->regs[REG_DMALEN_L] = dma_len; |