From a3a2cd60c3f020a3e600404b4ae445d2c3f7b634 Mon Sep 17 00:00:00 2001 From: Jeff Parsons Date: Tue, 28 Jul 2015 14:13:34 -0700 Subject: [PATCH] Fixed video address reporting, and added expression support to the Debugger's "r" command --- modules/pcjs/lib/debugger.js | 12 +++++++++--- modules/pcjs/lib/memory.js | 16 ++++++++-------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/modules/pcjs/lib/debugger.js b/modules/pcjs/lib/debugger.js index 1f3b2c462..ee9347c14 100644 --- a/modules/pcjs/lib/debugger.js +++ b/modules/pcjs/lib/debugger.js @@ -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()); diff --git a/modules/pcjs/lib/memory.js b/modules/pcjs/lib/memory.js index 628a417b5..b7f018b5a 100644 --- a/modules/pcjs/lib/memory.js +++ b/modules/pcjs/lib/memory.js @@ -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)