# HG changeset patch # User Michael Pavone # Date 1493963271 25200 # Node ID 033dda2d45984cab336de7e1cb1e4c72fbd2d885 # Parent 4ea094d15ccee5f3ca45e5ba2aa7cb6f2ba506d9 Fix transition from active to inactive display diff -r 4ea094d15cce -r 033dda2d4598 vdp.c --- a/vdp.c Thu May 04 22:14:12 2017 -0700 +++ b/vdp.c Thu May 04 22:47:51 2017 -0700 @@ -1541,6 +1541,7 @@ } } } + context->done_output = dst; context->buf_a_off = (context->buf_a_off + SCROLL_BUFFER_DRAW) & SCROLL_BUFFER_MASK; context->buf_b_off = (context->buf_b_off + SCROLL_BUFFER_DRAW) & SCROLL_BUFFER_MASK; } @@ -1735,6 +1736,7 @@ output_line = INVALID_LINE; } context->output = (uint32_t *)(((char *)context->fb) + context->output_pitch * output_line); + context->done_output = context->output; #ifdef DEBUG_FB_FILL for (int i = 0; i < LINEBUF_SIZE; i++) { @@ -2710,8 +2712,16 @@ } else if (context->regs[REG_MODE_1] & BIT_MODE_4) { bg_color = context->colors[CRAM_SIZE * 3 + 0x10 + (context->regs[REG_BG_COLOR] & 0xF)]; } - *(dst++) = bg_color; - *(dst++) = bg_color; + if (dst >= context->done_output) { + *(dst++) = bg_color; + } else { + dst++; + } + if (dst >= context->done_output) { + *(dst++) = bg_color; + } else { + dst++; + } if (context->hslot == (bg_end_slot-1)) { *(dst++) = bg_color; } diff -r 4ea094d15cce -r 033dda2d4598 vdp.h --- a/vdp.h Thu May 04 22:14:12 2017 -0700 +++ b/vdp.h Thu May 04 22:47:51 2017 -0700 @@ -163,6 +163,7 @@ uint8_t *linebuf; //pointer to current line in framebuffer uint32_t *output; + uint32_t *done_output; uint32_t *fb; system_header *system; uint16_t cram[CRAM_SIZE];