Video register dump tweaks

This commit is contained in:
Jeff Parsons 2015-05-30 11:17:31 -07:00
commit 77abe04465

View file

@ -2034,6 +2034,38 @@ Card.prototype.saveEGA = function()
return data; return data;
}; };
/**
* dumpRegs()
*
* Since we don't pre-allocate the register arrays (eg, ATC, CRTC, GRC, etc) on a Card, we can't
* rely on their array length, so we instead rely on the number of register names supplied in asRegs.
*
* @this {Card}
* @param {string} sName
* @param {number} iReg
* @param {Array} [aRegs]
* @param {Array} [asRegs]
*/
Card.prototype.dumpRegs = function(sName, iReg, aRegs, asRegs)
{
if (DEBUGGER) {
if (!aRegs) {
this.dbg.println(sName + ": " + str.toHexByte(iReg));
return;
}
var s = "", i, cchMax = 0;
for (i = 0; i < asRegs.length; i++) {
if (cchMax < asRegs[i].length) cchMax = asRegs[i].length;
}
cchMax++;
for (i = 0; i < asRegs.length; i++) {
if (s) s += '\n';
s += sName + "[" + str.toHexByte(i) + "]: " + str.pad(asRegs[i], cchMax) + str.toHexByte(aRegs[i]) + (i === iReg? "*" : "");
}
this.dbg.println(s);
}
};
/** /**
* dumpCard() * dumpCard()
* *
@ -2049,9 +2081,10 @@ Card.prototype.dumpCard = function()
if (this.nCard == Video.CARD.MDA || this.nCard == Video.CARD.CGA) { if (this.nCard == Video.CARD.MDA || this.nCard == Video.CARD.CGA) {
this.dumpRegs(" MODEREG", this.regMode); this.dumpRegs(" MODEREG", this.regMode);
this.dumpRegs(" STATUS1", this.regStatus);
} }
this.dumpRegs(" STATUS1", this.regStatus);
if (this.nCard == Video.CARD.CGA) { if (this.nCard == Video.CARD.CGA) {
this.dumpRegs(" COLOR", this.regColor); this.dumpRegs(" COLOR", this.regColor);
} }
@ -2105,38 +2138,6 @@ Card.prototype.dumpBuffer = function(sParm)
} }
}; };
/**
* dumpRegs()
*
* Since we don't pre-allocate the register arrays (eg, ATC, CRTC, GRC, etc) on a Card, we can't
* rely on their array length, so we instead rely on the number of register names supplied in asRegs.
*
* @this {Card}
* @param {string} sName
* @param {number} iReg
* @param {Array} [aRegs]
* @param {Array} [asRegs]
*/
Card.prototype.dumpRegs = function(sName, iReg, aRegs, asRegs)
{
if (DEBUGGER) {
if (!aRegs) {
this.dbg.println(sName + ": " + str.toHexByte(iReg));
return;
}
var s = "", i, cchMax = 0;
for (i = 0; i < asRegs.length; i++) {
if (cchMax < asRegs[i].length) cchMax = asRegs[i].length;
}
cchMax++;
for (i = 0; i < asRegs.length; i++) {
if (s) s += '\n';
s += sName + "[" + str.toHexByte(i) + "]: " + str.pad(asRegs[i], cchMax) + str.toHexByte(aRegs[i]) + (i === iReg? "*" : "");
}
this.dbg.println(s);
}
};
/** /**
* getMemoryBuffer(addr) * getMemoryBuffer(addr)
* *
@ -3955,7 +3956,7 @@ Video.prototype.checkMode = function(fForce)
if (card.nCard == Video.CARD.MDA) { if (card.nCard == Video.CARD.MDA) {
nMode = Video.MODE.MDA_80X25; nMode = Video.MODE.MDA_80X25;
} }
else if (card.nCard == Video.CARD.EGA) { else if (card.nCard >= Video.CARD.EGA) {
/* /*
* The sizeBuffer we choose reflects the amount of physical address space that all 4 planes * The sizeBuffer we choose reflects the amount of physical address space that all 4 planes
* of EGA memory normally span, NOT the total amount of EGA memory. So for a 64Kb EGA card, * of EGA memory normally span, NOT the total amount of EGA memory. So for a 64Kb EGA card,