Rationalize font data offsets (first CGA, then MDA/EGA, then ultimately VGA)

This commit is contained in:
Jeff Parsons 2015-06-05 09:42:51 -07:00
commit 583d7584a4
2 changed files with 16 additions and 17 deletions

View file

@ -6,7 +6,7 @@
<ram id="ramLow" addr="0x00000" test="true" size="0xa0000" comment="ROM BIOS memory test has NOT been disabled"/>
<ram id="ramCPQ" addr="0xfa0000" size="0x60000" comment="Compaq memory at 0xFA0000"/>
<ram id="ramExt" addr="0x100000" size="0x100000" comment="Extended memory at 0x100000"/>
<rom id="romVGA" addr="0xc0000" size="0x6000" file="/devices/pc/video/ibm/vga/ibm-vga.json" notify="videoVGA[0x3f8d,0x378d]"/>
<rom id="romVGA" addr="0xc0000" size="0x6000" file="/devices/pc/video/ibm/vga/ibm-vga.json" notify="videoVGA[0x378d,0x3f8d]"/>
<rom id="romBIOS" addr="0xf8000" size="0x8000" alias="[0xf0000,0xffff0000,0xffff8000]" file="/devices/pc/bios/compaq/deskpro386/1988-01-28/1988-01-28.json"/>
<video ref="/devices/pc/video/ibm/vga/ibm-vga-lock.xml"/>
<keyboard ref="/devices/pc/keyboard/keyboard-minimal-functions.xml"/>

View file

@ -3164,11 +3164,11 @@ Video.prototype.onLoadSetFonts = function(sFontFile, sFontData, nErrorCode)
* font, unless overridden by a jumper setting on the CGA card, so it is our default CGA font as well (although
* someday we may provide a virtual jumper setting that allows you to select the thinner font).
*
* The first offset we pass to setFontData() is the offset of the MDA font. For the second (CGA) font offset,
* we choose the thicker "double dot" CGA font at 0x1800 (which was the PC's default font as well), instead
* of the thinner "single dot" font at 0x1000.
* The first offset we must pass to setFontData() is the offset of the CGA font; we choose the thicker "double dot"
* CGA font at 0x1800 (which was the PC's default font as well), instead of the thinner "single dot" font at 0x1000.
* The second offset is for the MDA font.
*/
this.setFontData(abFontData, [0x0000, 0x1800]);
this.setFontData(abFontData, [0x1800, 0x0000]);
}
else {
this.notice("Unrecognized font data length (" + abFontData.length + ")");
@ -3225,7 +3225,7 @@ Video.prototype.onROMLoad = function(abROM, aParms)
* font generation to support it (as opposed to "init-time" generation, which is all we do now).
* There's probably a similar need for user-defined fonts; for now, they're simply not supported.
*/
this.setFontData(abROM, aParms || [0x2230, 0x3160], 8);
this.setFontData(abROM, aParms || [0x3160, 0x2230], 8);
}
else if (this.nCard == Video.CARD.VGA) {
if (DEBUG) this.printMessage("onROMLoad(): VGA fonts loaded");
@ -3235,7 +3235,7 @@ Video.prototype.onROMLoad = function(abROM, aParms)
* and an 8x8 font at 0x378D; however, it also contains an 8x16 font at 0x4EBA (and corresponding
* supplemental table at 0x5EBA). See our reconstructed source code in ibm-vga.nasm.
*/
this.setFontData(abROM, aParms || [0x3f8d, 0x378d], 8);
this.setFontData(abROM, aParms || [0x378d, 0x3f8d], 8);
}
this.setReady();
};
@ -3324,7 +3324,7 @@ Video.prototype.getCardColors = function(nBitsPerPixel)
*
* @this {Video}
* @param {*} abFontData is the raw font data, from the ROM font file
* @param {Array.<number>} aFontOffsets contains offsets into abFontData: [0] for MDA, [1] for CGA
* @param {Array.<number>} aFontOffsets contains offsets into abFontData: [0] for CGA, [1] for MDA
* @param {number} [cxFontChar] is a fixed character width to use for all fonts; undefined to use MDA/CGA defaults
*/
Video.prototype.setFontData = function(abFontData, aFontOffsets, cxFontChar)
@ -3372,22 +3372,21 @@ Video.prototype.buildFonts = function()
*/
if (window && this.abFontData) {
var offSplit = this.cxFontChar? 0 : 0x0800;
var cxChar = this.cxFontChar? this.cxFontChar : 9;
if (this.buildFont(Video.FONT.MDA, this.aFontOffsets[0], offSplit, cxChar, 14, this.abFontData, Video.aMDAColors, Video.aMDAColorMap)) {
var aRGBColors = this.getCardColors();
var offSplit = 0x0000;
var cxChar = this.cxFontChar? this.cxFontChar : 8;
if (this.buildFont(Video.FONT.CGA, this.aFontOffsets[0], offSplit, cxChar, 8, this.abFontData, aRGBColors)) {
fChanges = true;
}
var aRGBColors = this.getCardColors();
offSplit = 0x0000;
cxChar = this.cxFontChar? this.cxFontChar : 8;
if (this.buildFont(Video.FONT.CGA, this.aFontOffsets[1], offSplit, cxChar, 8, this.abFontData, aRGBColors)) {
offSplit = this.cxFontChar? 0 : 0x0800;
cxChar = this.cxFontChar? this.cxFontChar : 9;
if (this.buildFont(Video.FONT.MDA, this.aFontOffsets[1], offSplit, cxChar, 14, this.abFontData, Video.aMDAColors, Video.aMDAColorMap)) {
fChanges = true;
}
if (this.cxFontChar) {
if (this.buildFont(this.nCard, this.aFontOffsets[0], 0, this.cxFontChar, 14, this.abFontData, aRGBColors)) {
if (this.buildFont(this.nCard, this.aFontOffsets[1], 0, this.cxFontChar, 14, this.abFontData, aRGBColors)) {
fChanges = true;
}
}