Archives
- April 2025
- March 2025
- February 2025
- January 2025
- December 2024
- November 2024
- October 2024
- September 2024
- August 2024
- July 2024
- June 2024
- May 2024
- April 2024
- March 2024
- February 2024
- January 2024
- October 2023
- September 2023
- August 2023
- July 2023
- June 2023
- May 2023
- April 2023
- March 2023
- January 2023
- December 2022
- November 2022
- October 2022
- September 2022
- July 2022
- June 2022
- May 2022
- April 2022
- March 2022
- February 2022
- January 2022
- December 2021
- November 2021
- October 2021
- September 2021
- August 2021
- July 2021
- June 2021
- May 2021
- April 2021
- March 2021
- February 2021
- January 2021
- December 2020
- November 2020
- October 2020
- September 2020
- August 2020
- July 2020
- June 2020
- May 2020
- April 2020
- March 2020
- February 2020
- January 2020
- December 2019
- November 2019
- October 2019
- September 2019
- August 2019
- July 2019
- June 2019
- May 2019
- April 2019
- March 2019
- February 2019
- January 2019
- December 2018
- November 2018
- October 2018
- August 2018
- July 2018
- June 2018
- May 2018
- April 2018
- March 2018
- February 2018
- January 2018
- December 2017
- November 2017
- October 2017
- August 2017
- July 2017
- June 2017
- May 2017
- April 2017
- March 2017
- February 2017
- January 2017
- December 2016
- November 2016
- October 2016
- September 2016
- August 2016
- July 2016
- June 2016
- May 2016
- April 2016
- March 2016
- February 2016
- January 2016
- December 2015
- November 2015
- October 2015
- September 2015
- August 2015
- July 2015
- June 2015
- May 2015
- April 2015
- March 2015
- February 2015
- January 2015
- December 2014
- November 2014
- October 2014
- September 2014
- August 2014
- July 2014
- June 2014
- May 2014
- April 2014
- March 2014
- February 2014
- January 2014
- December 2013
- November 2013
- October 2013
- September 2013
- August 2013
- July 2013
- June 2013
- May 2013
- April 2013
- March 2013
- February 2013
- January 2013
- December 2012
- November 2012
- October 2012
- September 2012
- August 2012
- July 2012
- June 2012
- May 2012
- April 2012
- March 2012
- February 2012
- January 2012
- December 2011
- November 2011
- October 2011
- September 2011
- August 2011
- July 2011
- June 2011
- May 2011
- April 2011
- March 2011
- January 2011
- November 2010
- October 2010
- August 2010
- July 2010
DOS/V graphics text modes and scrolling
I recently ran into an interesting difference in the way various DOS/V versions manage VGA memory. DOS/V of course refers to the Japanese versions of DOS which are capable of running on standard "Western" hardware.
Microsoft has a very long history of supporting the Far East (how they used to be called) markets, especially Japanese and Korean, going back to the early 1980s. At that time, standard PC hardware was simply not capable of displaying Kanji ideographs; MDA had no user-definable fonts, and CGA had woefully low resolution. Systems tailored to the Japanese market used custom hardware, more or less incompatible with IBM PCs.
Once the VGA appeared, the technology was capable of emulating text modes using a relatively high resolution (for the time) graphics mode. MS-DOS/V versions 5.0 and 6.2 (released in March and December 1993, respectively; further referred to as DOS/V) both used a 640×475 graphics mode, slightly unusual but logical. The character cell was 19 pixels high and 8 or 16 pixels wide (Kanji ideographs, usually encoded as two bytes, were also displayed twice as wide as standard ASCII characters). To display an 80×25 text mode using a 19 by 8 pixel character cell, a 640×475 resolution is required. That’s not quite the same as the standard 640×480 VGA resolution, but it’s the closest lower resolution usable for relatively detailed glyphs and 80×25 grid.
One of the challenges of emulating a text mode on top of graphics mode was performance, especially for scrolling. For true text modes, scrolling traditionally involves redrawing the entire screen; however, the amount of data involved is small enough that even very slow PCs can scroll text sufficiently fast.
For graphics modes, that wasn’t the case even in the early 1990s. Redrawing an entire 16-color VGA screen would take too long, especially on slower systems with ISA bus, very common at the time. DOS/V therefore used the capabilities of VGA hardware to scroll without having to copy large amounts of data. However, the approach taken by DOS/V 5.0 differs from DOS/V 6.2, even though the end effect is the same.
DOS/V 5.0 used scanline pitch of 80 bytes (single plane), which means scanlines were tightly packed in video memory without any intervening space. DOS/V started drawing text at the beginning of video memory (offset 0) and printed new lines of text until the entire screen was filled. Once the screen was full and the text needed to be scrolled up, DOS/V simply drew the next line in the same way and reprogrammed the CRTC start address (registers CR0C and CR0D) to position the display at the beginning of the second line. The screen scrolled up but no existing data had to be moved.
But what happened when the bottom of the screen went past the end of the available video memory? DOS/V 5.0 took advantage of the fact that VGA has a 16-bit CRTC address counter which simply wraps around once it goes past 64KB. The wrap-around would occur in the middle of a scanline with DOS/V, because 65,536 is not a multiple of 80; but that did not matter to the hardware. DOS/V simply continued drawing at the beginning of video memory, effectively mirroring the hardware.
In DOS/V 6.2, the scrolling method was changed. DOS/V 6.2 took advantage of a different VGA feature called split screen. The VGA hardware can be programmed to split the screen at a specified scanline. At the top of the screen, content is displayed from the given CRTC start address. At the split point (determined by the line compare register CR18, with overflow bits in CR07 and CR09), data begins to be taken from the start of video memory (address zero).
When DOS/V 6.2 started displaying text, the method was the same as with version 5.0. Scrolling also worked the same way (modifying the CRTC start address) as long as the entire displayed screen was contiguous in video memory. The difference was in handling the situation where the displayed content needed to wrap to the beginning of video memory.
Rather than relying on the CRTC circuitry chopping off high bits of the display address and wrapping around automatically, DOS/V 6.2 created a split screen. That in effect forced the same kind of wraparound to occur, though not necessarily at the end of video memory. To that end, DOS/V 6.2 used a larger scanline pitch, 128 bytes. That meant the video memory had unused "holes" at the end of each scanline, but contained an integral number of scanlines, a requirement for the split screen technique to work.
The split screen method need not utilize the entire video memory buffer; it can choose to use any subset large enough to display the entire screen plus one line, perhaps to reserve a portion of video memory for offscreen fonts. However, DOS/V 6.2 utilized the entire video memory.
In essence, DOS/V 6.2 did the same thing as DOS/V 5.0, only explicitly programming what DOS/V 5.0 expected to implicitly happen. I can only speculate why the scrolling method was changed in DOS/V 6.2, but I suspect that some VGA clones did not correctly implement the CRTC address wraparound. Most likely those were Super VGAs with more video memory than the original VGA (i.e. more than 256K). Software relying on the address wraparound was very rare and therefore the functionality was not necessarily correctly implemented in hardware. On the other hand, the split screen technique was relatively well documented and well understood, and commercial software (especially games) sometimes used it. It was therefore likely to be tested and properly implemented in hardware.
In fact the DOS/V 6.2 code may have been deliberately crafted such that the implicit wraparound and the explicit split screen setup did exactly the same thing. Thus as long as the hardware correctly implemented either the automatic address wraparound or split screens, DOS/V would display correctly. That led to increased compatibility at the cost of negligibly higher overhead (programming the split screen address once every time the screen needed to scroll).
This site uses Akismet to reduce spam. Learn how your comment data is processed.