Added some more disk configurations

This commit is contained in:
Jeff Parsons 2017-08-27 11:25:02 -07:00 committed by Jeff Parsons
commit b730b915bf
31 changed files with 1002 additions and 963 deletions

View file

@ -5358,7 +5358,7 @@ class DebuggerX86 extends Debugger {
* get "inflated" with use. See the dump() method in the Disk component for more details.
*/
this.doClear();
this.println(drive.disk.toJSON());
this.println(drive.disk.convertToJSON());
return;
}
if (dc.seekDrive(drive, iSector, nSectors)) {

View file

@ -49,7 +49,7 @@ if (NODE) {
* 6) writing data to a sector: write()
* 7) save disk deltas: save()
* 8) restore disk deltas: restore()
* 9) converting disk contents: toJSON()
* 9) converting disk contents: convertToJSON()
*
* More functionality may be factored out of the FDC and HDC components later and moved here, to
* further reduce some of the duplication between them, but the above functionality is a good start.
@ -2212,10 +2212,11 @@ class Disk extends Component {
}
/**
* toJSON()
* convertToJSON(fFormatted)
*
* We perform some RegExp massaging on the JSON data to eliminate unnecessary properties
* (eg, 'length' values of 512, 'pattern' values of 0, since those are defaults).
* (eg, 'length' values of 512, 'pattern' values of 0, and empty 'data' arrays, since those
* are defaults).
*
* In addition, we first check every sector to see if it can be "deflated". Sectors that were
* initially "deflated" should remain that way unless/until they were modified, so technically,
@ -2223,9 +2224,10 @@ class Disk extends Component {
* so it doesn't hurt to check every sector.
*
* @this {Disk}
* @param {boolean} [fFormatted]
* @return {string} containing the entire disk image as JSON-encoded data
*/
toJSON()
convertToJSON(fFormatted)
{
var s, pba = 0, sector, sectorLast;
@ -2245,9 +2247,9 @@ class Disk extends Component {
});
/*
* Eliminate unnecessary default properties (eg, 'length' values of 512, 'pattern' values of 0).
* Eliminate unnecessary default properties (eg, 'length' values of 512, 'pattern' values of 0, etc).
*/
s = s.replace(/,"length":512/gm, "").replace(/,"pattern":0/gm, "");
s = s.replace(/,"length":512/g, "").replace(/,"pattern":0/g, "").replace(/,"data":\[]/g, "");
/*
* I don't really want to strip quotes from disk image property names, since I would have to put them
@ -2256,19 +2258,20 @@ class Disk extends Component {
* easily be stripped out, by virtue of their being the only quoted properties left. We then "requote"
* all the property names that remain.
*/
s = s.replace(/"(sector|length|data|pattern)":/gm, "$1:");
s = s.replace(/"(sector|length|data|pattern)":/g, "$1:");
/*
* The next line will remove any other numeric or boolean properties that were added at runtime, although
* they may have completely different ("minified") names if the code has been compiled.
*/
s = s.replace(/,"[^"]*":([0-9]+|true|false)/gm, "");
s = s.replace(/(sector|length|data|pattern):/gm, "\"$1\":");
s = s.replace(/,"[^"]*":([0-9]+|true|false)/g, "");
s = s.replace(/(sector|length|data|pattern):/g, "\"$1\":");
/*
* Last but not least, insert line breaks after every object definition, to ease the pain on text editors.
* Last but not least, insert line breaks after every object definition, to improve human readability
* (but only if the caller asks for it).
*/
s = s.replace(/([\]}]),/gm, "$1,\n");
if (fFormatted) s = s.replace(/([\]}]),/g, "$1,\n");
return s;
}

View file

@ -60,9 +60,9 @@ class HDC extends Component {
* HDC supports the following component-specific properties:
*
* drives: an array of driveConfig objects, each containing 'name', 'path', 'size' and 'type' properties
* type: either 'xt' (for the PC XT Xebec controller) or 'at' (for the PC AT Western Digital controller)
* type: either 'XT' (for the PC XT Xebec controller) or 'AT' (for the PC AT Western Digital controller)
*
* The 'type' parameter defaults to 'xt'. All ports for the PC XT controller are referred to as XTC ports,
* The 'type' parameter defaults to 'XT'. All ports for the PC XT controller are referred to as XTC ports,
* and similarly, all PC AT controller ports are referred to as ATC ports.
*
* If 'path' is empty, a scratch disk image is created; otherwise, we make a note of the path, but we will NOT
@ -103,7 +103,8 @@ class HDC extends Component {
* defaults. For example, the default XT drive type is 3 (for a 10Mb disk drive), whereas the default
* AT drive type is 2 (for a 20Mb disk drive).
*/
this.fATC = (parmsHDC['type'] == "at");
var sType = parmsHDC['type'];
this.fATC = sType && sType.toUpperCase() == "AT" || false;
/*
* Support for local disk images is currently limited to desktop browsers with FileReader support;

View file

@ -195,8 +195,9 @@ class Mouse extends Component {
* However, syncMouse() seems unnecessary, given that SerialPort initializes its MCR to an "inactive"
* state, and even when restoring a previous state, if we've done our job properly, both SerialPort
* and Mouse should be restored in sync, making any explicit attempt at sync'ing unnecessary (or so I hope).
*
* this.componentDevice.syncMouse();
*/
// this.componentDevice.syncMouse();
break;
}
}

View file

@ -1794,7 +1794,7 @@ class DebuggerPDP10 extends Debugger {
*
* Which means that an instruction like this (where AC is zero):
*
* 8839 037653 205 00 0 00 400000 MOVSI AC,(1B<^O<AC>>) ;INITIALIZE AC
* 8839 037653 205 00 0 00 400000 MOVSI AC,(1B<^O<AC>>) ;INITIALIZE AC
*
* produces an instruction that does NOT use indexing at all, even though it is coded as such. So my
* simplistic masking of the index operand with PDP10.OPCODE.X_MASK, while logical, was completely wrong:
@ -1848,7 +1848,7 @@ class DebuggerPDP10 extends Debugger {
/*
* I came across what I believe is a typo in the DEC "DAKAC" diagnostic:
*
* CAME [0,-1] ;PASS TEST IF C(AC)=0,,-1
* CAME [0,-1] ;PASS TEST IF C(AC)=0,,-1
*
* Based on the comment, it's clear what they really meant was either "[0,,-1]" or "[XWD 0,-1]".
* However, they still got the desired result, which means when the assembler parses an mnemonic-less

View file

@ -2094,14 +2094,14 @@ class CPUStatePDP11 extends CPUPDP11 {
* combination of the mode and whether the register is the Program Counter (R7).
*
* The eight modes are:-
* 0 R no valid virtual address
* 1 (R) operand from I/D depending if R = 7
* 2 (R)+ operand from I/D depending if R = 7
* 3 @(R)+ address from I/D depending if R = 7 and operand from D space
* 4 -(R) operand from I/D depending if R = 7
* 5 @-(R) address from I/D depending if R = 7 and operand from D space
* 6 x(R) x from I space but operand from D space
* 7 @x(R) x from I space but address and operand from D space
* 0 R no valid virtual address
* 1 (R) operand from I/D depending if R = 7
* 2 (R)+ operand from I/D depending if R = 7
* 3 @(R)+ address from I/D depending if R = 7 and operand from D space
* 4 -(R) operand from I/D depending if R = 7
* 5 @-(R) address from I/D depending if R = 7 and operand from D space
* 6 x(R) x from I space but operand from D space
* 7 @x(R) x from I space but address and operand from D space
*
* Also need to keep MMR1 updated as this stores which registers have been
* incremented and decremented so that the OS can reset and restart an instruction

View file

@ -39,7 +39,7 @@
* 6) writing data to a sector: write()
* 7) save disk deltas: save()
* 8) restore disk deltas: restore()
* 9) converting disk contents: toJSON()
* 9) converting disk contents: convertToJSON()
*
* More functionality may be factored out of the disk controller components later and moved here,
* to further reduce some of the duplication between them, but the above functionality is a good start.
@ -1110,7 +1110,7 @@ class DiskPDP11 extends Component {
}
/**
* toJSON()
* convertToJSON(fFormatted)
*
* We perform some RegExp massaging on the JSON data to eliminate unnecessary properties
* (eg, 'length' values of 512, 'pattern' values of 0, since those are defaults).
@ -1121,9 +1121,10 @@ class DiskPDP11 extends Component {
* so it doesn't hurt to check every sector.
*
* @this {DiskPDP11}
* @param {boolean} [fFormatted]
* @return {string} containing the entire disk image as JSON-encoded data
*/
toJSON()
convertToJSON(fFormatted)
{
var s, pba = 0, sector, sectorLast;
@ -1145,7 +1146,7 @@ class DiskPDP11 extends Component {
/*
* Eliminate unnecessary default properties (eg, 'length' values of 512, 'pattern' values of 0).
*/
s = s.replace(/,"length":512/gm, "").replace(/,"pattern":0/gm, "");
s = s.replace(/,"length":512/g, "").replace(/,"pattern":0/g, "");
/*
* I don't really want to strip quotes from disk image property names, since I would have to put them
@ -1154,19 +1155,20 @@ class DiskPDP11 extends Component {
* easily be stripped out, by virtue of their being the only quoted properties left. We then "requote"
* all the property names that remain.
*/
s = s.replace(/"(sector|length|data|pattern)":/gm, "$1:");
s = s.replace(/"(sector|length|data|pattern)":/g, "$1:");
/*
* The next line will remove any other numeric or boolean properties that were added at runtime, although
* they may have completely different ("minified") names if the code has been compiled.
*/
s = s.replace(/,"[^"]*":([0-9]+|true|false)/gm, "");
s = s.replace(/(sector|length|data|pattern):/gm, "\"$1\":");
s = s.replace(/,"[^"]*":([0-9]+|true|false)/g, "");
s = s.replace(/(sector|length|data|pattern):/g, "\"$1\":");
/*
* Last but not least, insert line breaks after every object definition, to ease the pain on text editors.
* Last but not least, insert line breaks after every object definition, to improve human readability
* (but only if the caller asks for it).
*/
s = s.replace(/([\]}]),/gm, "$1,\n");
if (fFormatted) s = s.replace(/([\]}]),/g, "$1,\n");
return s;
}

View file

@ -1010,7 +1010,7 @@
<xsl:variable name="type">
<xsl:choose>
<xsl:when test="@type"><xsl:value-of select="@type"/></xsl:when>
<xsl:otherwise>xt</xsl:otherwise>
<xsl:otherwise>XT</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:call-template name="component">