summaryrefslogtreecommitdiff
path: root/vdp.c
diff options
context:
space:
mode:
authorMichael Pavone <pavone@retrodev.com>2017-01-19 09:32:34 -0800
committerMichael Pavone <pavone@retrodev.com>2017-01-19 09:32:34 -0800
commit536c4fe3fc9a368d4defcd67c935ac0fd5520e51 (patch)
treee7307ed9113b35cfd936d807a08e5aeb2d945ba4 /vdp.c
parent1d8d7aa859fff168fd00be6851cda907bf4211d9 (diff)
Fix border rendering at end of line 1FE. vdp_inactive will probably need a small fixup for the edge case when we start between when the vcounter is incremented and the line is truly finished.
Diffstat (limited to 'vdp.c')
-rw-r--r--vdp.c68
1 files changed, 68 insertions, 0 deletions
diff --git a/vdp.c b/vdp.c
index d140420..d69fe81 100644
--- a/vdp.c
+++ b/vdp.c
@@ -1677,6 +1677,16 @@ static void vdp_h40(vdp_context * context, uint32_t target_cycles)
{
case 165:
if (context->vcounter == 0x1FF) {
+ uint32_t bg_color = context->colors[context->regs[REG_BG_COLOR] & 0x3F];
+ uint32_t *dst;
+ if (headless) {
+ dst = context->output;
+ } else {
+ dst = ((uint32_t *)(((char *)context->fb) + context->output_pitch * (context->border_top - 2)))
+ + (context->hslot - BG_START_SLOT) * 2;
+ }
+ *(dst++) = bg_color;
+ *dst = bg_color;
external_slot(context);
} else {
render_sprite_cells(context);
@@ -1684,6 +1694,16 @@ static void vdp_h40(vdp_context * context, uint32_t target_cycles)
CHECK_LIMIT
case 166:
if (context->vcounter == 0x1FF) {
+ uint32_t bg_color = context->colors[context->regs[REG_BG_COLOR] & 0x3F];
+ uint32_t *dst;
+ if (headless) {
+ dst = context->output;
+ } else {
+ dst = ((uint32_t *)(((char *)context->fb) + context->output_pitch * (context->border_top - 2)))
+ + (context->hslot - BG_START_SLOT) * 2;
+ }
+ *(dst++) = bg_color;
+ *dst = bg_color;
external_slot(context);
} else {
render_sprite_cells(context);
@@ -1691,6 +1711,20 @@ static void vdp_h40(vdp_context * context, uint32_t target_cycles)
CHECK_LIMIT
//sprite attribute table scan starts
case 167:
+ if (context->vcounter == 0x1FF) {
+ uint32_t bg_color = context->colors[context->regs[REG_BG_COLOR] & 0x3F];
+ uint32_t *dst;
+ if (headless) {
+ dst = context->output;
+ } else {
+ dst = ((uint32_t *)(((char *)context->fb) + context->output_pitch * (context->border_top - 2)))
+ + (context->hslot - BG_START_SLOT) * 2;
+ }
+ *(dst++) = bg_color;
+ *(dst++) = bg_color;
+ *(dst++) = bg_color;
+ *dst = bg_color;
+ }
context->sprite_index = 0x80;
context->slot_counter = MAX_SPRITES_LINE;
render_sprite_cells( context);
@@ -1844,6 +1878,16 @@ static void vdp_h32(vdp_context * context, uint32_t target_cycles)
{
case 133:
if (context->vcounter == 0x1FF) {
+ uint32_t bg_color = context->colors[context->regs[REG_BG_COLOR] & 0x3F];
+ uint32_t *dst;
+ if (headless) {
+ dst = context->output;
+ } else {
+ dst = ((uint32_t *)(((char *)context->fb) + context->output_pitch * (context->border_top - 2)))
+ + (context->hslot - BG_START_SLOT) * 2;
+ }
+ *(dst++) = bg_color;
+ *dst = bg_color;
external_slot(context);
} else {
render_sprite_cells(context);
@@ -1851,6 +1895,16 @@ static void vdp_h32(vdp_context * context, uint32_t target_cycles)
CHECK_LIMIT
case 134:
if (context->vcounter == 0x1FF) {
+ uint32_t bg_color = context->colors[context->regs[REG_BG_COLOR] & 0x3F];
+ uint32_t *dst;
+ if (headless) {
+ dst = context->output;
+ } else {
+ dst = ((uint32_t *)(((char *)context->fb) + context->output_pitch * (context->border_top - 2)))
+ + (context->hslot - BG_START_SLOT) * 2;
+ }
+ *(dst++) = bg_color;
+ *dst = bg_color;
external_slot(context);
} else {
render_sprite_cells(context);
@@ -1858,6 +1912,20 @@ static void vdp_h32(vdp_context * context, uint32_t target_cycles)
CHECK_LIMIT
//sprite attribute table scan starts
case 135: //FIXME - Here
+ if (context->vcounter == 0x1FF) {
+ uint32_t bg_color = context->colors[context->regs[REG_BG_COLOR] & 0x3F];
+ uint32_t *dst;
+ if (headless) {
+ dst = context->output;
+ } else {
+ dst = ((uint32_t *)(((char *)context->fb) + context->output_pitch * (context->border_top - 2)))
+ + (context->hslot - BG_START_SLOT) * 2;
+ }
+ *(dst++) = bg_color;
+ *(dst++) = bg_color;
+ *(dst++) = bg_color;
+ *dst = bg_color;
+ }
context->sprite_index = 0x80;
context->slot_counter = MAX_SPRITES_LINE_H32;
render_sprite_cells( context);