Added support for a Debugger "base" option that presets the default base (eg, 8, 10, 16) for most numeric input/output

This commit is contained in:
Jeff Parsons 2016-09-19 16:43:07 -07:00 committed by Jeff Parsons
commit a15e222076
4 changed files with 23 additions and 13 deletions

View file

@ -8,5 +8,5 @@
<rom id="rom" addr="0xC000" size="0x0570" file="/devices/pdp11/rom/custom/bootcode.json"/>
<ram id="ram" addr="0x10000" size="0x34000"/>
<panel ref="/devices/pdp11/panel/1170/wide.xml"/>
<debugger id="debugger"/>
<debugger id="debugger" base="8"/>
</machine>

View file

@ -69,10 +69,6 @@ var DbgAddrPDP11;
/**
* DebuggerPDP11(parmsDbg)
*
* @constructor
* @extends Debugger
* @param {Object} parmsDbg
*
* The DebuggerPDP11 component supports the following optional (parmsDbg) properties:
*
* commands: string containing zero or more commands, separated by ';'
@ -82,6 +78,10 @@ var DbgAddrPDP11;
*
* The DebuggerPDP11 component is an optional component that implements a variety of user
* commands for controlling the CPU, dumping and editing memory, etc.
*
* @constructor
* @extends Debugger
* @param {Object} parmsDbg
*/
function DebuggerPDP11(parmsDbg)
{
@ -1921,15 +1921,15 @@ if (DEBUGGER) {
}
var sOpcodes = "";
var sLine = this.toStrAddr(dbgAddrOp) + ": ";
var sLine = this.toStrAddr(dbgAddrOp) + ":";
if (dbgAddrOp.addr !== PDP11.ADDR_INVALID && dbgAddr.addr !== PDP11.ADDR_INVALID) {
do {
sOpcodes += this.toStrBase(this.getWord(dbgAddrOp, true));
sOpcodes += ' ' + this.toStrBase(this.getWord(dbgAddrOp, true));
if (dbgAddrOp.addr == null) break;
} while (dbgAddrOp.addr != dbgAddr.addr);
}
sLine += str.pad(sOpcodes, 10);
sLine += str.pad(sOpcodes, 15);
sLine += str.pad(sOpName, 7);
if (sOperands) sLine += ' ' + sOperands;

View file

@ -60,13 +60,17 @@ var DbgAddr;
/**
* Debugger(parmsDbg)
*
* @constructor
* @extends Component
* @param {Object} parmsDbg
* The Debugger component supports the following optional (parmsDbg) properties:
*
* base: the base to use for most numeric input/output (default is 16)
*
* The Debugger component is a shared component containing a subset of functionality used by
* the other CPU-specific Debuggers (eg, DebuggerX86). Over time, the goal is to factor out as
* much common debugging support as possible from those components into this one.
*
* @constructor
* @extends Component
* @param {Object} parmsDbg
*/
function Debugger(parmsDbg)
{
@ -77,7 +81,7 @@ function Debugger(parmsDbg)
/*
* Default base used to display all values; modified with the "s base" command.
*/
this.nBase = 16;
this.nBase = parmsDbg['base'] || 16;
/*
* These keep track of instruction activity, but only when tracing or when Debugger checks

View file

@ -1168,6 +1168,12 @@
<xsl:template match="debugger[not(@ref)]">
<xsl:param name="machine" select="''"/>
<xsl:variable name="base">
<xsl:choose>
<xsl:when test="@base"><xsl:value-of select="@base"/></xsl:when>
<xsl:otherwise>16</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="commands">
<xsl:choose>
<xsl:when test="@commands"><xsl:value-of select="@commands"/></xsl:when>
@ -1183,7 +1189,7 @@
<xsl:call-template name="component">
<xsl:with-param name="machine" select="$machine"/>
<xsl:with-param name="class">debugger</xsl:with-param>
<xsl:with-param name="parms">,commands:'<xsl:value-of select="$commands"/>',messages:'<xsl:value-of select="$messages"/>'</xsl:with-param>
<xsl:with-param name="parms">,base:<xsl:value-of select="$base"/>,commands:'<xsl:value-of select="$commands"/>',messages:'<xsl:value-of select="$messages"/>'</xsl:with-param>
</xsl:call-template>
</xsl:template>