Skip to content

Commit

Permalink
VGA: clip display end against vtotal (bugfix for "Monolith" by TSI).
Browse files Browse the repository at this point in the history
Part 4 of the demo allows you to select a nonstandard 320x570 to display
an image. Their routine however sets up the mode by programming
vtotal=594 vdend=1024 vblank=1024-1105 and vretrace=511-527, which
confuses DOSBox's calculations on active display area. It also causes
the demo to hang because the demo waits for vertical retrace, which no
longer functions because of the confusion. This fix limits the display
end against vtotal so the demo's strange VGA mode can work correctly.
  • Loading branch information
joncampbell123 committed Mar 22, 2015
1 parent 34c8b2c commit 1d22855
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/hardware/vga_draw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1718,6 +1718,13 @@ void VGA_SetupDrawing(Bitu /*val*/) {
fps=(double)clock/(vtotal*htotal);
LOG(LOG_VGA,LOG_NORMAL)("VGA refresh rate is now, %.3f",vga_force_refresh_rate);
}

/* clip display end to stay within vtotal ("Monolith" demo part 4 320x570 mode fix) */
if (vdend > vtotal) {
LOG(LOG_VGA,LOG_WARN)("VGA display end greater than vtotal!");
vdend = vtotal;
}

// Horizontal total (that's how long a line takes with whistles and bells)
vga.draw.delay.htotal = htotal*1000.0/clock; //in milliseconds
// Start and End of horizontal blanking
Expand Down

0 comments on commit 1d22855

Please sign in to comment.