# HG changeset patch # User Michael Pavone # Date 1484847154 28800 # Node ID 9de9d2c6ebe551327a3796bae1b506f5aabb82ca # Parent b1147418254a123a245f3c6945fcebf86260722c 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. diff -r b1147418254a -r 9de9d2c6ebe5 vdp.c --- a/vdp.c Wed Jan 18 23:43:36 2017 -0800 +++ b/vdp.c Thu Jan 19 09:32:34 2017 -0800 @@ -1677,6 +1677,16 @@ { 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 @@ 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 @@ 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 @@ { 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 @@ 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 @@ 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);