Another 1.15.4 change: decline to mount diskette images too large for the floppy drive type

This commit is contained in:
Jeff Parsons 2014-10-10 18:43:27 -07:00 committed by jeffpar
commit e96f0eecd9
7 changed files with 1135 additions and 1105 deletions

View file

@ -1055,8 +1055,10 @@ ChipSet.prototype.reset = function()
* their CMOS information, we must not allow a reset() from powerUp() to toss that information, so
* we allocate abCMOSData only if it hasn't already been allocated.
*/
if (!this.abCMOSData) this.abCMOSData = new Array(ChipSet.CMOS.ADDR.TOTAL);
this.initRTCDate(this.sRTCDate);
if (!this.abCMOSData) {
this.abCMOSData = new Array(ChipSet.CMOS.ADDR.TOTAL);
this.initRTCDate(this.sRTCDate);
}
/*
* initCMOSData() will initialize a variety of "legacy" CMOS bytes, but it will NOT overwrite any memory
@ -1511,6 +1513,15 @@ ChipSet.prototype.restore = function(data)
this.bCMOSAddr = a[2];
this.abCMOSData = a[3];
this.nCyclesCMOSLastUpdate = a[4];
/*
* TODO: Decide whether restore() should faithfully preserve the RTC date/time that save() saved,
* or always reinitialize the date/time, or give the user (or the machine configuration) the option.
*
* For now, we're always reinitializing the RTC date. Alternatively, we could selectively update
* the CMOS bytes above, instead of overwriting them all, in which case this extra call to initRTCDate()
* could be avoided.
*/
this.initRTCDate();
}
return true;
};

View file

@ -1116,14 +1116,25 @@ FDC.prototype.loadDiskette = function(iDrive, sDisketteName, sDiskettePath, fAut
*
* @this {FDC}
* @param {Object} drive
* @param {Disk} disk is set if the disk was successfully mounted, null if not
* @param {Disk} disk is set if the disk was successfully loaded, null if not
* @param {string} sDisketteName
* @param {string} sDiskettePath
*/
FDC.prototype.mountDiskette = function(drive, disk, sDisketteName, sDiskettePath)
{
drive.fBusy = false;
if ((drive.disk = disk)) {
/*
* We shouldn't mount the diskette unless the drive is able to handle it; for example, DSDD (40-track)
* drives cannot read DSHD (80-track) diskettes.
*/
if (disk && disk.aDiskData.length > drive.nCylinders) {
this.notice("Diskette \"" + sDisketteName + "\" too large for drive " + String.fromCharCode(0x41 + drive.iDrive));
disk = null;
}
if (disk) {
drive.disk = disk;
drive.sDisketteName = sDisketteName;
drive.sDiskettePath = sDiskettePath;
this.addDiskHistory(sDisketteName, sDiskettePath, disk);
@ -1145,12 +1156,14 @@ FDC.prototype.mountDiskette = function(drive, disk, sDisketteName, sDiskettePath
* WARNING: This conversion of drive number to drive letter, starting with A:, is very simplistic
* and will not match the drive mappings that DOS ultimately uses (ie, for drives beyond B:).
*/
this.notice("Mounted disk \"" + sDisketteName + "\" in drive " + String.fromCharCode(0x41 + drive.iDrive), drive.fAutoMount);
this.notice("Mounted diskette \"" + sDisketteName + "\" in drive " + String.fromCharCode(0x41 + drive.iDrive), drive.fAutoMount);
}
if (drive.fAutoMount) {
drive.fAutoMount = false;
if (!--this.cAutoMount) this.setReady();
}
this.displayDiskette(drive.iDrive);
};