diff options
-rw-r--r-- | render_sdl.c | 12 | ||||
-rw-r--r-- | vdp.c | 16 |
2 files changed, 25 insertions, 3 deletions
diff --git a/render_sdl.c b/render_sdl.c index f2f15c0..c2acef7 100644 --- a/render_sdl.c +++ b/render_sdl.c @@ -73,13 +73,21 @@ void render_context(vdp_context * context) } } for (int y = 224; y < 240; y++, buf_32 += (screen->pitch/4 - 320)) { - for (int x = 0; x < 320; x++, buf_32++) { - uint16_t gen_color = context->cram[x/10 + ((y-224)/8)*32]; + for (int x = 0; x < 256; x++, buf_32++) { + uint16_t gen_color = context->cram[x/8 + ((y-224)/8)*32]; b = ((gen_color >> 8) & 0xE) * 18; g = ((gen_color >> 4) & 0xE) * 18; r = (gen_color& 0xE) * 18; *buf_32 = SDL_MapRGB(screen->format, r, g, b); } + for (int x = 256; x < 320; x++, buf_32++) { + if ((x/8 & 1) ^ (y/8 & 1)) { + b = g = r = 255; + } else { + b = g = r = 0; + } + *buf_32 = SDL_MapRGB(screen->format, r, g, b); + } } break; } @@ -178,6 +178,7 @@ void read_map_scroll(uint16_t column, uint16_t vsram_off, uint32_t line, uint16_ v_mul = 256; break; } + /* uint16_t hscroll = (hscroll_val + (column-2) * 8) & hscroll_mask; uint16_t offset = address + ((vscroll * v_mul + hscroll/4) & 0x1FFF); //printf("%s | line: %d, col: %d, x: %d, hs_mask %X, v_mul: %d, scr reg: %X, tbl addr: %X\n", (vsram_off ? "B" : "A"), line, column, hscroll, hscroll_mask, v_mul, context->regs[REG_SCROLL], offset); @@ -185,6 +186,19 @@ void read_map_scroll(uint16_t column, uint16_t vsram_off, uint32_t line, uint16_ hscroll = (hscroll_val + (column-1) * 8) & hscroll_mask; offset = address + ((vscroll * v_mul + hscroll/4) & 0x1FFF); context->col_2 = (context->vdpmem[offset] << 8) | context->vdpmem[offset+1]; + */ + uint16_t hscroll, offset; + for (int i = 0; i < 2; i++) { + hscroll = (hscroll_val + (column-(2-i)) * 8) & hscroll_mask; + offset = address + ((vscroll * v_mul + hscroll/4) & 0x1FFF); + //printf("%s | line: %d, col: %d, x: %d, hs_mask %X, v_mul: %d, scr reg: %X, tbl addr: %X\n", (vsram_off ? "B" : "A"), line, column, hscroll, hscroll_mask, v_mul, context->regs[REG_SCROLL], offset); + uint16_t col_val = (context->vdpmem[offset] << 8) | context->vdpmem[offset+1]; + if (i) { + context->col_2 = col_val; + } else { + context->col_1 = col_val; + } + } } void read_map_scroll_a(uint16_t column, uint32_t line, vdp_context * context) @@ -288,7 +302,7 @@ void render_map_output(uint32_t line, int32_t col, vdp_context * context) uint16_t remaining = context->hscroll_a & 0x7; memcpy(context->tmp_buf_a + 8 - remaining, context->tmp_buf_a + 24 - remaining, remaining); remaining = context->hscroll_b & 0x7; - memcpy(context->tmp_buf_b + 8 - remaining, context->tmp_buf_a + 24 - remaining, remaining); + memcpy(context->tmp_buf_b + 8 - remaining, context->tmp_buf_b + 24 - remaining, remaining); } #define COLUMN_RENDER_BLOCK(column, startcyc) \ |