summaryrefslogtreecommitdiff
path: root/vdp.c
diff options
context:
space:
mode:
authorMichael Pavone <pavone@retrodev.com>2017-03-07 20:17:12 -0800
committerMichael Pavone <pavone@retrodev.com>2017-03-07 20:17:12 -0800
commit85fc5a03bc006e3edcca16c40cfb974b5c80743b (patch)
treecb5c3b880ed39d175b3262f11dfb2001c3e92e5c /vdp.c
parent5fbdc3300ee34bf9133e15b6cf6cd533ed160a98 (diff)
Fill in the rest of the framebuffer holes created by horizontal border. Work remains for things to be seemless when display gets turned on and off mid frame
Diffstat (limited to 'vdp.c')
-rw-r--r--vdp.c46
1 files changed, 34 insertions, 12 deletions
diff --git a/vdp.c b/vdp.c
index b613f47..c36c2ab 100644
--- a/vdp.c
+++ b/vdp.c
@@ -1187,7 +1187,16 @@ static void render_map_output(uint32_t line, int32_t col, vdp_context * context)
return;
}
col -= 2;
- dst = context->output + BORDER_LEFT + col * 8;
+ if (col) {
+ dst = context->output + BORDER_LEFT + col * 8;
+ } else {
+ dst = context->output;
+ uint32_t bg_color = context->colors[context->regs[REG_BG_COLOR] & 0x3F];
+ for (int i = 0; i < BORDER_LEFT; i++, dst++)
+ {
+ *dst = bg_color;
+ }
+ }
uint32_t color = context->colors[context->regs[REG_BG_COLOR] & 0x3F];
for (int i = 0; i < 16; i++)
{
@@ -1488,6 +1497,20 @@ static void vdp_advance_line(vdp_context *context)
} else if (context->vcounter == 0xDB) {
context->vcounter = 0x1D5;
}
+
+ if (context->vcounter > context->inactive_start) {
+ context->hint_counter = context->regs[REG_HINT];
+ } else if (context->hint_counter) {
+ context->hint_counter--;
+ } else {
+ context->flags2 |= FLAG2_HINT_PENDING;
+ context->pending_hint_start = context->cycles;
+ context->hint_counter = context->regs[REG_HINT];
+ }
+}
+
+static void advance_output_line(vdp_context *context)
+{
if (headless) {
if (context->vcounter == context->inactive_start) {
context->frame++;
@@ -1518,21 +1541,11 @@ static void vdp_advance_line(vdp_context *context)
{
context->output[i] = 0xFFFF00FF;
}
-#endif
+#endif
if (output_line != INVALID_LINE && (context->regs[REG_MODE_4] & BIT_H40)) {
context->h40_lines++;
}
}
-
- if (context->vcounter > context->inactive_start) {
- context->hint_counter = context->regs[REG_HINT];
- } else if (context->hint_counter) {
- context->hint_counter--;
- } else {
- context->flags2 |= FLAG2_HINT_PENDING;
- context->pending_hint_start = context->cycles;
- context->hint_counter = context->regs[REG_HINT];
- }
}
#define CHECK_ONLY if (context->cycles >= target_cycles) { return; }
@@ -1626,12 +1639,20 @@ static void vdp_advance_line(vdp_context *context)
#define SPRITE_RENDER_H40(slot) \
case slot:\
+ if ((slot) == BG_START_SLOT + LINEBUF_SIZE/2) {\
+ advance_output_line(context);\
+ }\
render_sprite_cells( context);\
scan_sprite_table(context->vcounter, context);\
CHECK_LIMIT_HSYNC(slot)
+//Note that the line advancement check will fail if BG_START_SLOT is > 6
+//as we're bumping up against the hcounter jump
#define SPRITE_RENDER_H32(slot) \
case slot:\
+ if ((slot) == BG_START_SLOT + (256+HORIZ_BORDER)/2) {\
+ advance_output_line(context);\
+ }\
render_sprite_cells( context);\
scan_sprite_table(context->vcounter, context);\
if (context->flags & FLAG_DMA_RUN) { run_dma_src(context, -1); } \
@@ -2277,6 +2298,7 @@ static void vdp_inactive(vdp_context *context, uint32_t target_cycles, uint8_t i
)) {
dst = context->output + (context->hslot - BG_START_SLOT) * 2;
} else if (context->hslot == bg_end_slot) {
+ advance_output_line(context);
dst = NULL;
}