Skip to content

Commit

Permalink
Ugly bug fix for bug #2054.
Browse files Browse the repository at this point in the history
Essentially, when the screen length is set to N text lines plus 0 scan
line (CRTC_REG_VTOTALADJ == 0), the detection of getting to the end is
done 1 scan line too late. For other values of VTOTALADJ the detection
is ok.  Just the case of 0 is missed the first time around by an
apparently unfortunate order of cheking conditions.

The plan is to clean up the hack by rearranging the order of the code
into something nice and without goto.



git-svn-id: https://svn.code.sf.net/p/vice-emu/code/trunk@45219 379a1393-f5fb-40a0-bcee-ef074d9b53f7
  • Loading branch information
Rhialto committed Jul 11, 2024
1 parent 93e2eed commit 7abe1f6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions vice/src/crtc/crtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -734,6 +734,7 @@ static void crtc_raster_draw_alarm_handler(CLOCK offset, void *data)
#endif
/* The real end is VTOTALADJ scan lines futher down, for fine tuning */
if ((crtc.raster.ycounter + 1) >= crtc.regs[CRTC_REG_VTOTALADJ]) {
hack:
long cycles;

/* Do vsync stuff. Reset line counters to top (0). */
Expand Down Expand Up @@ -809,6 +810,14 @@ static void crtc_raster_draw_alarm_handler(CLOCK offset, void *data)
}
new_vsync++; /* compensate for the first decrease below */
}
/*
* This is a horrible hack and a better flow of control should
* be possible!
*/
if (crtc.regs[CRTC_REG_VTOTALADJ] == 0 &&
crtc.current_charline >= crtc.regs[CRTC_REG_VTOTAL] + 1) {
goto hack;
}
}
/* Enable or disable the cursor, if it is in the next character line */
if (crtc.raster.ycounter == (unsigned int)(crtc.regs[CRTC_REG_CURSORSTART] & 0x1f)) {
Expand Down

0 comments on commit 7abe1f6

Please sign in to comment.