VOGONS


First post, by superfury

User metadata
Rank l33t++
Rank
l33t++

The SLDIV and SD bits in the CRTC registers seem like they do the same(in UniPCemu, they're currently stacked together to divide the scanline input by 1,2 or 4 to calculate the row to index into the vertical character grid(which makes a character/inner character row out of that input).

So with a character height of 2, row 0 becomes 0.0. row 1 becomes 0.1, row 2 becomes 1.0, row 3 becomes 1.1 etc.. In the format row.innerrow, in much the same way horizontal timing works with character.innerx(where innerx is between 0-7 or 0-8, depending on the dot clocks per character).

Now, the freeVGA documentation says that:

SD -- Scan Doubling
"When this bit is set to 1, 200-scan-line video data is converted to 400-scan-line output. To do this, the clock in the row scan counter is divided by 2, which allows the 200-line modes to be displayed as 400 lines on the display (this is called double scanning; each line is displayed twice). When this bit is set to 0, the clock to the row scan counter is equal to the horizontal scan rate."

And:

SLDIV -- Divide Scan Line clock by 2
"This bit selects the clock that controls the vertical timing counter. The clocking is either the horizontal retrace clock or horizontal retrace clock divided by 2. When this bit is set to 1. the horizontal retrace clock is divided by 2. Dividing the clock effectively doubles the vertical resolution of the CRT controller. The vertical counter has a maximum resolution of 1024 scan lines because the vertical total value is 10-bits wide. If the vertical counter is clocked with the horizontal retrace divided by 2, the vertical resolution is doubled to 2048 scan lines."

Since the row scan counter(the row as mentioned for the input to the vertical character.innercharrow format) always runs at the same rate as the horizontal retrace clock(ticked up to the next line by htotal being reached in UniPCemu's VGA renderer), what's the difference between the two settings?

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io

Reply 1 of 1, by superfury

User metadata
Rank l33t++
Rank
l33t++

I've just seperated the two. The SD bit now doubles any scanline by rendering them twice.
SLDIV, on the other hand, now affects all vertical CRTC timing instead. So it has effect on the vertical display end, vertical total, vertical retrace start/end and vertical blanking start/end timings instead(the layer that determines the viewport on the screen instead of the contents of the viewport).

So SLDIV for example doubles the size of the active display and surrounding vertical areas(blanking, retrace). But SD instead focuses on the movement of the pointer into VRAM for each scanline(fetching each scanline twice during active display).

So you could set SD to 1, SLDIV to 1 and program vertical timings for 100 lines. SD would make it 400 lines from 200 lines of VRAM data. If you set SLDIV to 0 and program vertical display end to 100(assuming other vertical timings proper as well), only 100 of those 200 lines would be shown during active display. But setting the SLDIV bit would widen the rendering window into VRAM, showing the remainder as well. And of course setting SLDIV and clearing SD would result in the (S)VGA trying to render a e.g. 320x400 display from 400 VRAM rows(which requires 128KB of VRAM).

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io