summaryrefslogtreecommitdiff
path: root/vdp.c
diff options
context:
space:
mode:
authorMike Pavone <pavone@retrodev.com>2012-12-08 19:42:07 -0800
committerMike Pavone <pavone@retrodev.com>2012-12-08 19:42:07 -0800
commit0847626aec31d90615b087817ff92344cc6a99b2 (patch)
tree9023971bac3a90e16d71ed2861d6ca2952fa5c0c /vdp.c
parentf2c1f98b9d52f71f5e382c3270c4a551f744bfb1 (diff)
Fix BG plane B render bug
Diffstat (limited to 'vdp.c')
-rw-r--r--vdp.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/vdp.c b/vdp.c
index bdf1e9a..77a0c7b 100644
--- a/vdp.c
+++ b/vdp.c
@@ -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) \