Debugger refinements

This commit is contained in:
Jeff Parsons 2016-02-01 14:25:58 -08:00
commit e71f8c096a
9 changed files with 111 additions and 61 deletions

View file

@ -32,7 +32,7 @@ gems:
pcjs:
domain: pcjs.org # whereas site.url is used for linking purposes, site.pcjs.domain is used for display purposes
version: 1.20.8 # IMPORTANT: keep pcjs.version in sync with package.json:version
compiled: false # by default, the compiled pcjs.version scripts will be used (eg, pc.js or pc-dbg.js)
compiled: true # by default, the compiled pcjs.version scripts will be used (eg, pc.js or pc-dbg.js)
pc_scripts: # if pcjs.compiled is false, the following scripts will be included instead, in the order listed
- /modules/shared/lib/defines.js
- /modules/shared/lib/diskapi.js

View file

@ -2,7 +2,7 @@
layout: page
title: Machine Configurations
menu_title: Machines
menu_order: 5
menu_order: 6
permalink: /devices/pc/machine/
redirect_from:
- /configs/pc/machines/

View file

@ -1,14 +1,16 @@
---
layout: page
title: IBM PC Disk Archive
menu_title: Disks
menu_order: 4
permalink: /disks/pc/
---
IBM PC Disk Archive
---
This is a list of disks available to any of the [IBM PC Machines](/devices/pc/machine/) that use the
[library.xml](/disks/pc/library.xml) disk configuration file.
This is a list of disks available to any of the [IBM PC Machines](/devices/pc/machine/) that use our
[Library](/disks/pc/library.xml) XML disk configuration file.
For some of the disks below, we have provided more information about the software, and in some cases, machines
that automatically run the software.

View file

@ -12,7 +12,7 @@ Windows 1.03 was released in August 1986.
Directory listings of the six 360Kb distribution diskettes are provided below.
It's been noted on [WinWorld](https://winworldpc.com/product/windows-10/103) that version 1.03 disks have
been found with `USER.EXE` dated either `05-22-86` *or* `08-24-86`. The latter is available as
been found with `USER.EXE` dated either `05-22-86` *or* `08-24-86`. The latter is available here as
[Windows 1.03b](../1.03b/).
These disks were dumped from the PCjs private collection. Differences include:

View file

@ -2,7 +2,7 @@
layout: page
title: Documentation
menu_title: Docs
menu_order: 6
menu_order: 8
permalink: /docs/
---

View file

@ -2731,7 +2731,10 @@ if (DEBUGGER) {
Debugger.prototype.toHexAddr = function(dbgAddr)
{
var ch = this.getAddrPrefix(dbgAddr);
return dbgAddr.sel == null? (ch + str.toHex(dbgAddr.addr)) : (ch + this.toHexOffset(dbgAddr.off, dbgAddr.sel, dbgAddr.fAddr32));
/*
* TODO: Revisit the decision to check sel == null; I would rather see these decisions based on type.
*/
return (dbgAddr.type >= Debugger.ADDRTYPE.LINEAR || dbgAddr.sel == null)? (ch + str.toHex(dbgAddr.addr)) : (ch + this.toHexOffset(dbgAddr.off, dbgAddr.sel, dbgAddr.fAddr32));
};
/**
@ -2880,40 +2883,6 @@ if (DEBUGGER) {
this.dumpBlocks(this.cpu.aMemBlocks, asArgs[0], this.cpu.aMemBlocks !== this.cpu.aBusBlocks);
};
/**
* dumpInfo(asArgs)
*
* @this {Debugger}
* @param {Array.<string>} asArgs
*/
Debugger.prototype.dumpInfo = function(asArgs)
{
var sInfo = "no information";
if (BACKTRACK) {
var sAddr = asArgs[0];
var dbgAddr = this.parseAddr(sAddr, true, true, false);
if (dbgAddr) {
var addr = this.getAddr(dbgAddr);
sInfo = '%' + str.toHex(addr) + ": " + (this.bus.getSymbol(addr, true) || sInfo);
} else {
var component, componentPrev = null;
while (component = this.cmp.getMachineComponent("Disk", componentPrev)) {
var aInfo = component.getSymbolInfo(sAddr);
if (aInfo.length) {
sInfo = "";
for (var i in aInfo) {
var a = aInfo[i];
if (sInfo) sInfo += '\n';
sInfo += a[0] + ": " + a[1] + ' ' + str.toHex(a[2], 4) + ':' + str.toHex(a[3], 4) + " len " + str.toHexWord(a[4]);
}
}
componentPrev = component;
}
}
}
return sInfo;
};
/**
* getPageEntry(addrPE, lPE, fPTE)
*
@ -2934,6 +2903,77 @@ if (DEBUGGER) {
return s;
};
/**
* getPageInfo(addr)
*
* @this {Debugger}
* @param {number} addr
* @return {Object|null}
*/
Debugger.prototype.getPageInfo = function(addr)
{
var pageInfo = null;
if (I386 && this.cpu.model >= X86.MODEL_80386) {
var bus = this.bus;
/*
* Here begins code remarkably similar to mapPageBlock() (with fSuppress set).
*/
pageInfo = {};
pageInfo.offPDE = (addr & X86.LADDR.PDE.MASK) >>> X86.LADDR.PDE.SHIFT;
pageInfo.addrPDE = this.cpu.regCR3 + pageInfo.offPDE;
pageInfo.blockPDE = bus.aMemBlocks[(pageInfo.addrPDE & bus.nBusMask) >>> bus.nBlockShift];
pageInfo.lPDE = pageInfo.blockPDE.readLong(pageInfo.offPDE);
pageInfo.offPTE = (addr & X86.LADDR.PTE.MASK) >>> X86.LADDR.PTE.SHIFT;
pageInfo.addrPTE = (pageInfo.lPDE & X86.PTE.FRAME) + pageInfo.offPTE;
pageInfo.blockPTE = bus.aMemBlocks[(pageInfo.addrPTE & bus.nBusMask) >>> bus.nBlockShift];
pageInfo.lPTE = pageInfo.blockPTE.readLong(pageInfo.offPTE);
pageInfo.addrPhys = (pageInfo.lPTE & X86.PTE.FRAME) + (addr & X86.LADDR.OFFSET);
//var blockPhys = bus.aMemBlocks[(addrPhys & bus.nBusMask) >>> bus.nBlockShift];
}
return pageInfo;
};
/**
* dumpInfo(asArgs)
*
* @this {Debugger}
* @param {Array.<string>} asArgs
*/
Debugger.prototype.dumpInfo = function(asArgs)
{
var sInfo = "no information";
if (BACKTRACK) {
var sAddr = asArgs[0];
var dbgAddr = this.parseAddr(sAddr, true, true, false);
if (dbgAddr) {
var addr = this.getAddr(dbgAddr);
if (dbgAddr.type != Debugger.ADDRTYPE.PHYSICAL) {
var pageInfo = this.getPageInfo(addr);
if (pageInfo) {
dbgAddr.addr = pageInfo.addrPhys;
dbgAddr.type = Debugger.ADDRTYPE.PHYSICAL;
}
}
sInfo = this.toHexAddr(dbgAddr) + ": " + (this.bus.getSymbol(addr, true) || sInfo);
} else {
var component, componentPrev = null;
while (component = this.cmp.getMachineComponent("Disk", componentPrev)) {
var aInfo = component.getSymbolInfo(sAddr);
if (aInfo.length) {
sInfo = "";
for (var i in aInfo) {
var a = aInfo[i];
if (sInfo) sInfo += '\n';
sInfo += a[0] + ": " + a[1] + ' ' + str.toHex(a[2], 4) + ':' + str.toHex(a[3], 4) + " len " + str.toHexWord(a[4]);
}
}
componentPrev = component;
}
}
}
return sInfo;
};
/**
* dumpPage(asArgs)
*
@ -2956,30 +2996,18 @@ if (DEBUGGER) {
return;
}
/*
* Here begins the code that is remarkably similar to mapPageBlock(), with fSuppress set.
*/
var bus = this.bus;
var offPDE = (addr & X86.LADDR.PDE.MASK) >>> X86.LADDR.PDE.SHIFT;
var addrPDE = this.cpu.regCR3 + offPDE;
var blockPDE = bus.aMemBlocks[(addrPDE & bus.nBusMask) >>> bus.nBlockShift];
var lPDE = blockPDE.readLong(offPDE);
var offPTE = (addr & X86.LADDR.PTE.MASK) >>> X86.LADDR.PTE.SHIFT;
var addrPTE = (lPDE & X86.PTE.FRAME) + offPTE;
var blockPTE = bus.aMemBlocks[(addrPTE & bus.nBusMask) >>> bus.nBlockShift];
var lPTE = blockPTE.readLong(offPTE);
var addrPhys = (lPTE & X86.PTE.FRAME) + (addr & X86.LADDR.OFFSET);
//var blockPhys = bus.aMemBlocks[(addrPhys & bus.nBusMask) >>> bus.nBlockShift];
/*
* And here ends the code that is remarkably similar to mapPageBlock(), with fSuppress set.
*/
var pageInfo = this.getPageInfo(addr);
if (!pageInfo) {
this.println("unsupported operation");
return;
}
this.println("linear PDE addr PDE PTE addr PTE physical" );
this.println("--------- ---------- -------- ---------- -------- ----------");
var s = '%' + str.toHex(addr);
s += " %%" + this.getPageEntry(addrPDE, lPDE);
s += " %%" + this.getPageEntry(addrPTE, lPTE, true);
s += " %%" + str.toHex(addrPhys);
s += " %%" + this.getPageEntry(pageInfo.addrPDE, pageInfo.lPDE);
s += " %%" + this.getPageEntry(pageInfo.addrPTE, pageInfo.lPTE, true);
s += " %%" + str.toHex(pageInfo.addrPhys);
this.println(s);
};

View file

@ -93,7 +93,7 @@ var TYPEDARRAYS = (typeof ArrayBuffer !== 'undefined');
* TODO: BACKTRACK support is currently completely disabled until we have a chance to investigate the problem
* discussed in Bus.addBackTrackObject().
*/
var BACKTRACK = false;
var BACKTRACK = !COMPILED;
/**
* @define {boolean}

View file

@ -471,14 +471,18 @@ FileInfo.prototype.loadSegmentTable = function(offEntries, nEntries, nSegOffShif
this.aSegments = [];
this.aOrdinals = []; // this is an optional array for quick ordinal-to-segment lookup
if (MAXDEBUG) this.disk.println("loadSegmentTable(" + this.sPath + "," + str.toHexLong(offEntries) + "," + str.toHexWord(nEntries) + ")");
if (DEBUG && this.disk.messageEnabled(Messages.DISK | Messages.DATA)) {
this.disk.printMessage("loadSegmentTable(" + this.sPath + "," + str.toHexLong(offEntries) + "," + str.toHexWord(nEntries) + ")");
}
while (nEntries--) {
var offSegment = this.loadValue(offEntries) << nSegOffShift;
if (offSegment) {
var lenSegment = this.loadValue(offEntries + 2) || 0x10000; // 0 means 64K
if (MAXDEBUG) this.disk.println("segment " + iSegment + ": offStart=" + str.toHexLong(offSegment) + " offEnd=" + str.toHexLong(offSegment + lenSegment));
if (DEBUG && this.disk.messageEnabled(Messages.DISK | Messages.DATA)) {
this.disk.printMessage("segment " + iSegment + ": offStart=" + str.toHexLong(offSegment) + " offEnd=" + str.toHexLong(offSegment + lenSegment));
}
this.aSegments[iSegment++] = {offStart: offSegment, offEnd: offSegment + lenSegment - 1, aEntries: []};
}
@ -520,7 +524,9 @@ FileInfo.prototype.loadEntryTable = function(offEntries, offEntriesEnd)
{
var iOrdinal = 1;
if (MAXDEBUG) this.disk.println("loadEntryTable(" + str.toHexLong(offEntries) + "," + str.toHexLong(offEntriesEnd) + ")");
if (DEBUG && this.disk.messageEnabled(Messages.DISK | Messages.DATA)) {
this.disk.printMessage("loadEntryTable(" + str.toHexLong(offEntries) + "," + str.toHexLong(offEntriesEnd) + ")");
}
while (offEntries < offEntriesEnd) {
@ -529,7 +535,9 @@ FileInfo.prototype.loadEntryTable = function(offEntries, offEntriesEnd)
if (!bEntries) break;
var bSegment = w >> 8, iSegment;
if (MAXDEBUG) this.disk.println("bundle for segment " + bSegment + ": " + bEntries + " entries @" + str.toHex(offEntries));
if (DEBUG && this.disk.messageEnabled(Messages.DISK | Messages.DATA)) {
this.disk.printMessage("bundle for segment " + bSegment + ": " + bEntries + " entries @" + str.toHex(offEntries));
}
offEntries += 2;
@ -564,10 +572,14 @@ FileInfo.prototype.loadEntryTable = function(offEntries, offEntriesEnd)
offEntries += 6;
}
if (!this.aSegments[iSegment]) {
if (MAXDEBUG) this.disk.println("invalid segment: " + iSegment);
if (DEBUG && this.disk.messageEnabled(Messages.DISK | Messages.DATA)) {
this.disk.printMessage("invalid segment: " + iSegment);
}
} else {
this.aSegments[iSegment].aEntries[iOrdinal] = [offEntry];
if (MAXDEBUG) this.disk.println("ordinal " + iOrdinal + ": segment=" + iSegment + " offset=" + str.toHexLong(offEntry) + " @" + str.toHex(offDebug));
if (DEBUG && this.disk.messageEnabled(Messages.DISK | Messages.DATA)) {
this.disk.printMessage("ordinal " + iOrdinal + ": segment=" + iSegment + " offset=" + str.toHexLong(offEntry) + " @" + str.toHex(offDebug));
}
}
this.aOrdinals[iOrdinal] = [iSegment, offEntry];
iOrdinal++;
@ -590,7 +602,9 @@ FileInfo.prototype.loadNameTable = function(offEntries, offEntriesEnd)
{
var cNames = 0;
if (MAXDEBUG) this.disk.println("loadNameTable(" + str.toHexLong(offEntries) + (offEntriesEnd? ("," + str.toHexLong(offEntriesEnd)) : "") + ")");
if (DEBUG && this.disk.messageEnabled(Messages.DISK | Messages.DATA)) {
this.disk.printMessage("loadNameTable(" + str.toHexLong(offEntries) + (offEntriesEnd? ("," + str.toHexLong(offEntriesEnd)) : "") + ")");
}
while (!offEntriesEnd || offEntries < offEntriesEnd) {
@ -618,12 +632,18 @@ FileInfo.prototype.loadNameTable = function(offEntries, offEntriesEnd)
var aEntries = this.aSegments[iSegment].aEntries[iOrdinal];
this.disk.assert(aEntries && aEntries.length == 1);
aEntries.push(sSymbol);
if (MAXDEBUG) this.disk.println("segment " + iSegment + " offset " + str.toHexWord(aEntries[0]) + " ordinal " + iOrdinal + ": " + sSymbol + " @" + str.toHex(offDebug));
if (DEBUG && this.disk.messageEnabled(Messages.DISK | Messages.DATA)) {
this.disk.printMessage("segment " + iSegment + " offset " + str.toHexWord(aEntries[0]) + " ordinal " + iOrdinal + ": " + sSymbol + " @" + str.toHex(offDebug));
}
} else {
if (MAXDEBUG) this.disk.println(this.sPath + ": cannot find segment " + iSegment + " (offset " + str.toHexWord(tuple[1]) + ") for symbol " + sSymbol + " with ordinal " + iOrdinal + " @" + str.toHex(offDebug));
if (DEBUG && this.disk.messageEnabled(Messages.DISK | Messages.DATA)) {
this.disk.printMessage(this.sPath + ": cannot find segment " + iSegment + " (offset " + str.toHexWord(tuple[1]) + ") for symbol " + sSymbol + " with ordinal " + iOrdinal + " @" + str.toHex(offDebug));
}
}
} else {
if (MAXDEBUG) this.disk.println(this.sPath + ": cannot find ordinal " + iOrdinal + " for symbol " + sSymbol + " @" + str.toHex(offDebug));
if (DEBUG && this.disk.messageEnabled(Messages.DISK | Messages.DATA)) {
this.disk.printMessage(this.sPath + ": cannot find ordinal " + iOrdinal + " for symbol " + sSymbol + " @" + str.toHex(offDebug));
}
}
}
offEntries += 2;
@ -1268,7 +1288,7 @@ Disk.prototype.doneLoad = function(sURL, sDiskData, nErrorCode)
* conversion to a forward-compatible 'data' array.
*/
else {
if (MAXDEBUG && this.messageEnabled()) {
if (DEBUG && this.messageEnabled(Messages.DISK | Messages.DATA)) {
var sCylinders = aDiskData.length + " track" + (aDiskData.length > 1 ? "s" : "");
var nHeads = aDiskData[0].length;
var sHeads = nHeads + " head" + (nHeads > 1 ? "s" : "");

View file

@ -475,7 +475,7 @@ X86CPU.prototype.enablePageBlocks = function()
X86CPU.prototype.flushPageBlocks = function()
{
if (this.regCR0 & X86.CR0.PG) this.enablePageBlocks();
}
};
/**
* acquirePageBlock(addr)