Skip to content

Commit

Permalink
enhancement: Protection against weird VPOSW writes incorrectly causin…
Browse files Browse the repository at this point in the history
…g continuous vblanks.
  • Loading branch information
midwan committed Nov 9, 2023
1 parent 9a2050c commit 71090fe
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/custom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ int maxvpos_display = MAXVPOS_PAL; // value used for display size
int maxhpos_display = AMIGA_WIDTH_MAX;
int maxvsize_display = AMIGA_HEIGHT_MAX;
int maxvpos_display_vsync; // extra lines from top visible in bottom
static bool maxvpos_display_vsync_next;
static int vblank_extraline;
static int maxhposm1;
int maxhposm0 = MAXHPOS_PAL;
Expand Down Expand Up @@ -7290,7 +7291,6 @@ static void init_beamcon0(bool fakehz)
minfirstline--;
hsstop_detect -= 1;
}

}

if (currprefs.gfx_extrawidth > 0) {
Expand Down Expand Up @@ -13046,6 +13046,7 @@ static void hsync_handler_pre(bool onvsync)

hdiw_counter += maxhpos * 2;
if (!hstrobe_conflict) {
// OCS Denise freerunning horizontal counter
if (!ecs_denise && vpos == get_equ_vblank_endline() - 1) {
hdiw_counter++;
}
Expand Down Expand Up @@ -14299,7 +14300,7 @@ static void hsync_handler(void)
events_schedule();

}
if (vpos == maxvpos_display_vsync) {
if (vpos == maxvpos_display_vsync && !maxvpos_display_vsync_next) {
hsync_record_line_state_last(next_lineno, nextline_how, 0);
inputdevice_read_msg(true);
vsync_display_render();
Expand All @@ -14309,6 +14310,10 @@ static void hsync_handler(void)
minfirstline_linear = minfirstline;
reset_autoscale();
display_vsync_counter++;
maxvpos_display_vsync_next = true;
} else if (vpos != maxvpos_display_vsync && maxvpos_display_vsync_next) {
// protect against weird VPOSW writes causing continuous vblanks
maxvpos_display_vsync_next = false;
}
vsync_line = vs;
hsync_handler_post(vs);
Expand Down Expand Up @@ -14431,6 +14436,7 @@ void custom_reset(bool hardreset, bool keyboardreset)
vt_old = 0;
ht_old = 0;
hdiwstate_blank = diw_states::DIW_waiting_start;
maxvpos_display_vsync_next = false;

irq_forced_delay = 0;
irq_forced = 0;
Expand Down

0 comments on commit 71090fe

Please sign in to comment.