Fixed machine array demos, by permitting machine IDs with hyphenated numeric suffixes to use a machine state file created with an unhyphenated machine ID, and added a demo of Windows 1.0 (the "Premiere Edition")

This commit is contained in:
Jeff Parsons 2017-06-23 14:00:27 -07:00 committed by Jeff Parsons
commit 503cda40f7
27 changed files with 99 additions and 57 deletions

View file

@ -2686,11 +2686,15 @@ DiskDump.prototype.convertToJSON = function()
var bMediaTypeBPB = this.bufDisk.readUInt8(offBootSector + DiskAPI.BPB.MEDIA_TYPE);
var nSectorsTotalBPB = this.bufDisk.readUInt16LE(offBootSector + DiskAPI.BPB.TOTAL_SECS);
var nSectorsPerCylinderBPB = nSectorsPerTrackBPB * nHeadsBPB;
var nCylindersBPB = Math.floor(nSectorsTotalBPB / nSectorsPerCylinderBPB);
var nSectorsHiddenBPB = this.bufDisk.readUInt16LE(offBootSector + DiskAPI.BPB.HIDDEN_SECS);
var nCylindersBPB = (nSectorsHiddenBPB + nSectorsTotalBPB) / nSectorsPerCylinderBPB;
if (diskFormat) {
if (nCylinders != nCylindersBPB) {
DiskDump.logWarning("BPB cylinders (" + nCylindersBPB + ") do not match actual cylinders (" + nCylinders + ")");
if (nCylinders - nCylindersBPB == 1) {
DiskDump.logWarning("the BIOS may have reserved the last cylinder for diagnostics");
}
}
if (nHeads != nHeadsBPB) {
DiskDump.logWarning("BPB heads (" + nHeadsBPB + ") do not match actual heads (" + nHeads + ")");

View file

@ -645,15 +645,17 @@ class Computer extends Component {
if (!data) {
/*
* This is a hack that makes it possible for a machine whose ID has been
* supplemented with a suffix (a single letter or digit) to find object IDs
* in states created from a machine without the suffix.
* supplemented with a hyphenated numeric suffix to find object IDs in states
* created from a machine without such a suffix.
*
* For example, if a state file was created from a machine with ID "ibm5160"
* but the current machine is "ibm5160a", this attempts a second lookup with
* but the current machine is "ibm5160-1", this attempts a second lookup with
* "ibm5160", enabling us to find objects that match the original machine ID
* (eg, "ibm5160.romEGA").
*
* See /devices/pcx86/machine/5160/ega/640kb/array/ for examples of this.
*/
data = stateComputer.get(component.id.replace(/[a-z0-9]\./i, '.'));
data = stateComputer.get(component.id.replace(/-[0-9]+\./i, '.'));
}
}