Merge remote-tracking branch 'origin/master'

This commit is contained in:
Jeff Parsons 2015-07-29 10:35:13 -07:00
commit d6d5bcfc3f
9 changed files with 2113 additions and 2091 deletions

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1241,6 +1241,11 @@ Computer.prototype.getComponentByType = function(sType, componentPrev)
*/
Computer.init = function()
{
/*
* In DEBUG builds, embedMachine() may have set DEBUG_APPVERSION.
*/
if (DEBUG && DEBUG_APPVERSION) Computer.sAppVer = DEBUG_APPVERSION;
var aeMachines = Component.getElementsByClass(window.document, PCJSCLASS + "-machine");
for (var iMachine = 0; iMachine < aeMachines.length; iMachine++) {

View file

@ -384,6 +384,7 @@ if (DEBUGGER) {
Debugger.REG_TR0 = 0x30;
Debugger.REG_TR6 = 0x36;
Debugger.REG_TR7 = 0x37;
Debugger.REG_EIP = 0x38;
Debugger.REGS = [
"AL", "CL", "DL", "BL", "AH", "CH", "DH", "BH",
@ -392,7 +393,8 @@ if (DEBUGGER) {
"EAX", "ECX", "EDX", "EBX", "ESP", "EBP", "ESI", "EDI",
"CR0", "CR1", "CR2", "CR3", null, null, null, null, // register names used with TYPE_CTLREG
"DR0", "DR1", "DR2", "DR3", null, null, "DR6", "DR7", // register names used with TYPE_DBGREG
null, null, null, null, null, null, "TR6", "TR7" // register names used with TYPE_TSTREG
null, null, null, null, null, null, "TR6", "TR7", // register names used with TYPE_TSTREG
"EIP"
];
Debugger.REG_ES = 0x00; // bits 0-1 are standard SegReg encodings
@ -2276,7 +2278,7 @@ if (DEBUGGER) {
n = cpu.regEDI; cch = 4;
break;
case Debugger.REG_IP:
n = cpu.getIP(); cch = this.cchReg;
n = cpu.getIP(); cch = 4;
break;
case Debugger.REG_PS:
n = cpu.getPS(); cch = this.cchReg;
@ -2344,6 +2346,9 @@ if (DEBUGGER) {
case Debugger.REG_SEG + Debugger.REG_GS:
n = cpu.getGS(); cch = 4;
break;
case Debugger.REG_EIP:
n = cpu.getIP(); cch = 8;
break;
}
}
}
@ -5290,7 +5295,7 @@ if (DEBUGGER) {
return;
}
var fValid = false;
var w = str.parseInt(sValue, 16);
var w = this.parseExpression(sValue);
if (w !== undefined) {
fValid = true;
var sRegMatch = sReg.toUpperCase();
@ -5361,6 +5366,7 @@ if (DEBUGGER) {
this.dbgAddrNextCode = this.newAddr(this.cpu.getIP(), this.cpu.getCS());
break;
case "IP":
case "EIP":
// fIns = true;
this.cpu.setIP(w);
this.dbgAddrNextCode = this.newAddr(this.cpu.getIP(), this.cpu.getCS());

View file

@ -617,7 +617,7 @@ Memory.prototype = {
* @return {number}
*/
readShortDefault: function readShortDefault(off, addr) {
return this.readByte(off, addr) | (this.readByte(off + 1, addr) << 8);
return this.readByte(off++, addr++) | (this.readByte(off, addr) << 8);
},
/**
* readLongDefault(off, addr)
@ -628,7 +628,7 @@ Memory.prototype = {
* @return {number}
*/
readLongDefault: function readLongDefault(off, addr) {
return this.readByte(off, addr) | (this.readByte(off + 1, addr) << 8) | (this.readByte(off + 2, addr) << 16) | (this.readByte(off + 3, addr) << 24);
return this.readByte(off++, addr++) | (this.readByte(off++, addr++) << 8) | (this.readByte(off++, addr++) << 16) | (this.readByte(off, addr) << 24);
},
/**
* writeShortDefault(off, w, addr)
@ -640,8 +640,8 @@ Memory.prototype = {
*/
writeShortDefault: function writeShortDefault(off, w, addr) {
// DEBUG: Component.assert(!(w & ~0xffff));
this.writeByte(off, w & 0xff, addr);
this.writeByte(off + 1, w >> 8, addr);
this.writeByte(off++, w & 0xff, addr++);
this.writeByte(off, w >> 8, addr);
},
/**
* writeLongDefault(off, w, addr)
@ -652,10 +652,10 @@ Memory.prototype = {
* @param {number} addr
*/
writeLongDefault: function writeLongDefault(off, w, addr) {
this.writeByte(off, w & 0xff, addr);
this.writeByte(off + 1, (w >> 8) & 0xff, addr);
this.writeByte(off + 2, (w >> 16) & 0xff, addr);
this.writeByte(off + 3, (w >>> 24), addr);
this.writeByte(off++, w & 0xff, addr++);
this.writeByte(off++, (w >> 8) & 0xff, addr++);
this.writeByte(off++, (w >> 16) & 0xff, addr++);
this.writeByte(off, (w >>> 24), addr);
},
/**
* readByteMemory(off, addr)

View file

@ -42,6 +42,8 @@ var APPNAME = ""; // this @define is overridden by the Closure Com
*/
var APPVERSION = "1.x.x"; // this @define is overridden by the Closure Compiler with the version in package.json
var DEBUG_APPVERSION = null; // this is set in DEBUG builds by embedMachine() if a version number was found in the machine XML
/**
* @define {string}
*/

View file

@ -127,6 +127,13 @@ function parseXML(sXML, sXMLFile, idMachine, sStateFile, fResolve, display, done
if (sURL && sURL.indexOf('/') < 0) sURL = window.location.pathname + sURL;
sXML = sXML.replace(/(<machine[^>]*\sid=)(['"]).*?\2/, "$1$2" + idMachine + "$2" + (sStateFile? " state=$2" + sStateFile + "$2" : "") + (sURL? " url=$2" + sURL + "$2" : ""));
}
/*
* DEBUG-only kludge to replace the version number template in the XSL file (which we assume we're reading,
* since fResolve is false) with any APPVERSION we extracted from the XML file (see corresponding kludge below).
*/
if (DEBUG && !fResolve && DEBUG_APPVERSION) {
sXML = sXML.replace(/<xsl:variable name="APPVERSION">1.x.x<\/xsl:variable>/, '<xsl:variable name="APPVERSION">' + DEBUG_APPVERSION + '</xsl:variable>');
}
/*
* If the resource we requested is not really an XML file (or the file didn't exist and the server simply returned
* a message like "Cannot GET /devices/pc/machine/5150/cga/64kb/donkey/machine.xml"), we'd like to display a more
@ -339,6 +346,14 @@ function embedMachine(sName, sVersion, idElement, sXMLFile, sXSLFile, sStateFile
displayError(sXML);
return;
}
/*
* DEBUG-only kludge to extract the version number from the stylesheet path in the machine XML file;
* we don't need this code in COMPILED (non-DEBUG) releases, because APPVERSION is hard-coded into them.
*/
if (DEBUG) {
var aMatch = sXML.match(/<\?xml-stylesheet[^>]* href=(['"])[^'"]*?\/([0-9.]*)\/([^'"]*)\1/);
if (aMatch && APPVERSION == "1.x.x") DEBUG_APPVERSION = aMatch[2];
}
var transformXML = function(sXSL, xsl) {
if (!xsl) {
displayError(sXSL);

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff