# HG changeset patch # User Michael Pavone # Date 1496290249 25200 # Node ID 1eded4f19910ecbf37bd41b7ae05cb23beebfc6f # Parent 1df16f5985f3b8f638e176b4f08d4c83eba1f3e5 Prevent emulated screen from "rolling" when the vertical resolution is changed at an inopportune time diff -r 1df16f5985f3 -r 1eded4f19910 vdp.c --- a/vdp.c Wed May 31 09:45:37 2017 -0700 +++ b/vdp.c Wed May 31 21:10:49 2017 -0700 @@ -1738,6 +1738,11 @@ if (output_line < context->inactive_start + context->border_bot && context->output_lines > 0) { output_line = context->output_lines++;//context->border_top + context->vcounter; } else if (output_line >= 0x200 - context->border_top) { + if (output_line == 0x200 - context->border_top) { + //We're at the top of the display, force context->output_lines to be zero to avoid + //potential screen rolling if the mode is changed at an inopportune time + context->output_lines = 0; + } output_line = context->output_lines++;//context->vcounter - (0x200 - context->border_top); } else { output_line = INVALID_LINE;