# HG changeset patch # User Michael Pavone # Date 1489116204 28800 # Node ID 6dedaa6458438f5b769b738d7db575b083e3042a # Parent be509813b2f2e19164ceb7d6a62d1ad48f785923 Fix graphical corruption and sprite flickering introduced into some games by the last change for horizontal border support diff -r be509813b2f2 -r 6dedaa645843 vdp.c --- a/vdp.c Tue Mar 07 20:17:12 2017 -0800 +++ b/vdp.c Thu Mar 09 19:23:24 2017 -0800 @@ -1497,6 +1497,7 @@ } else if (context->vcounter == 0xDB) { context->vcounter = 0x1D5; } + context->vcounter &= 0x1FF; if (context->vcounter > context->inactive_start) { context->hint_counter = context->regs[REG_HINT]; @@ -1517,7 +1518,7 @@ } context->vcounter &= 0x1FF; } else { - if (context->vcounter == context->inactive_start) { + if (context->vcounter == (context->inactive_start & 0x1FF)) { render_framebuffer_updated(context->flags2 & FLAG2_EVEN_FIELD ? FRAMEBUFFER_EVEN: FRAMEBUFFER_ODD, context->h40_lines > (context->inactive_start + context->border_top) / 2 ? LINEBUF_SIZE : (256+HORIZ_BORDER)); if (context->double_res) { context->flags2 ^= FLAG2_EVEN_FIELD; @@ -1526,7 +1527,6 @@ context->h40_lines = 0; context->frame++; } - context->vcounter &= 0x1FF; uint32_t output_line; if (context->vcounter < context->inactive_start + context->border_bot) { output_line = context->border_top + context->vcounter;