PC-DOS 7.00 SETUP is making progress, but XDF support is still lacking

This commit is contained in:
Jeff Parsons 2014-10-22 00:37:31 -05:00 committed by jeffpar
commit 3bbbd4e9b1
14 changed files with 648 additions and 570 deletions

View file

@ -659,6 +659,7 @@ Disk.prototype.onLoadDisk = function(sDiskFile, sDiskData, nErrorCode, sDiskPath
for (var iHead = 0; iHead < aDiskData[iCylinder].length; iHead++) {
for (var iSector = 0; iSector < aDiskData[iCylinder][iHead].length; iSector++) {
var sector = aDiskData[iCylinder][iHead][iSector];
if (!sector) continue; // non-standard (eg, XDF) disk images may have "unused" (null) sectors
var length = sector['length'];
if (length === undefined) { // provide backward-compatibility with older JSON...
length = sector['length'] = 512;
@ -1156,7 +1157,7 @@ Disk.prototype.seek = function(iCylinder, iHead, iSector, fWrite, done)
}
if (track) {
for (i = 0; i < track.length; i++) {
if (track[i]['sector'] == iSector) {
if (track[i] && track[i]['sector'] == iSector) {
/*
* If the sector's pattern is null, then this sector's true contents have not yet
* been fetched from the server.

View file

@ -1195,10 +1195,14 @@ FDC.prototype.mountDiskette = function(drive, disk, sDisketteName, sDiskettePath
if (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.
* drives cannot read DSHD (80-track) diskettes. However, I no longer require that the diskette's
* sectors/track fall within the drive's standard maximum, because XDF diskettes use 19 physical sectors/track
* on the first cylinder (1 more than the typical 18 sectors/track found on 1.44Mb diskettes) but declare
* a larger logical size (23 512-byte sectors/track) to reflect the actual capacity of XDF tracks beyond the
* first cylinder (ie, one 8Kb sector, one 2Kb sector, one 1Kb sector, and one 512-byte sector).
*/
aDiskInfo = disk.info();
if (disk && aDiskInfo[0] > drive.nCylinders || aDiskInfo[1] > drive.nHeads || aDiskInfo[2] > drive.nSectors) {
if (disk && aDiskInfo[0] > drive.nCylinders || aDiskInfo[1] > drive.nHeads /* || aDiskInfo[2] > drive.nSectors */) {
this.notice("Diskette \"" + sDisketteName + "\" too large for drive " + String.fromCharCode(0x41 + drive.iDrive));
disk = null;
}
@ -2255,7 +2259,7 @@ FDC.prototype.intBIOSDiskette = function(addr)
{
if (DEBUGGER) {
var DL = this.cpu.regDX & 0xff;
if (this.dbg && (this.dbg.messageEnabled(FDC.MESSAGE_FDC) || this.dbg.messageEnabled(FDC.MESSAGE_INT)) && DL < 0x80) {
if (this.dbg && this.dbg.messageEnabled(FDC.MESSAGE_FDC | FDC.MESSAGE_INT) && DL < 0x80) {
this.dbg.messageInt(FDC.BIOS.INT_DISKETTE, addr);
this.cpu.addIntReturn(addr, function(fdc, nCycles) {
return function onBIOSDisketteReturn(nLevel) {

View file

@ -1369,7 +1369,7 @@ HDC.prototype.inATCData = function(port, addrFrom)
if (this.drive) {
/*
* messagePort() calls, if enabled, can be too overwhelming for this port, so limit them to the first byte.
* messagePort() calls, if enabled, can be overwhelming for this port, so limit them to the first byte.
*/
fSuppress = (this.drive.ibSector > 0);
@ -1388,6 +1388,7 @@ HDC.prototype.inATCData = function(port, addrFrom)
*/
if (this.drive.ibSector == this.drive.cbSector) {
this.drive.nBytes -= this.drive.cbSector;
this.regSecCnt = (this.regSecCnt - 1) & 0xff;
/*
* TODO: If the WITH_ECC bit is set in the READ_DATA command, then we need to support "stuffing" 4
* additional bytes into the inATCData() stream. And we must first set DATA_REQ in the STATUS register.
@ -1398,7 +1399,7 @@ HDC.prototype.inATCData = function(port, addrFrom)
if (b >= 0) {
if (hdc.chipset) hdc.chipset.setIRR(ChipSet.IRQ.ATC);
/*
* I shouldn't have to set BUSY again, because it should still be set, no?
* I shouldn't have to set BUSY (or DATA_REQ) again, because it should still be set, no?
*/
Component.assert(!!(hdc.regStatus & HDC.ATC.STATUS.BUSY));
} else {
@ -1432,7 +1433,7 @@ HDC.prototype.inATCData = function(port, addrFrom)
HDC.prototype.outATCData = function(port, bOut, addrFrom)
{
/*
* messagePort() calls, if enabled, can be too overwhelming for this port, so limit them to the first byte.
* messagePort() calls, if enabled, can be overwhelming for this port, so limit them to the first byte.
*/
if (!this.drive || this.drive.ibSector == 0) this.messagePort(port, bOut, addrFrom, "DATA");
@ -1449,10 +1450,11 @@ HDC.prototype.outATCData = function(port, bOut, addrFrom)
}
else if (this.drive.ibSector == this.drive.cbSector) {
this.drive.nBytes -= this.drive.cbSector;
this.regSecCnt = (this.regSecCnt - 1) & 0xff;
if (this.chipset) this.chipset.setIRR(ChipSet.IRQ.ATC);
if (this.drive.nBytes >= this.drive.cbSector) {
/*
* I shouldn't have to set BUSY again, because it should still be set, no?
* I shouldn't have to set BUSY (or DATA_REQ) again, because it should still be set, no?
*/
Component.assert(!!(this.regStatus & HDC.ATC.STATUS.BUSY));
} else {
@ -1716,7 +1718,7 @@ HDC.prototype.doATCommand = function()
var nHead = this.regDrvHd & HDC.ATC.DRVHD.HEAD_MASK;
var nCylinder = this.regCylLo | ((this.regCylHi & HDC.ATC.CYLHI.MASK) << 8);
var nSector = this.regSecNum;
var nSectors = this.regSecCnt;
var nSectors = this.regSecCnt || 256;
this.drive = null;
this.regError = 0;
@ -1818,8 +1820,8 @@ HDC.prototype.doATCommand = function()
*
* WPREC: 0x4B
* SECCNT: 0x11 (for 17 sectors per track)
* CYL: 0x100 (256, uh, what?)
* SECNUM: 0x0C (12, uh, what?)
* CYL: 0x100 (256 -- uh, what?)
* SECNUM: 0x0C (12 -- uh, what?)
* DRVHD: 0xA3 (max head of 0x03, for 4 total heads)
*
* The importance of SECCNT (nSectors) and DRVHD (nHeads) is controlling how multi-sector operations
@ -2373,9 +2375,7 @@ HDC.prototype.readByte = function(drive, done, fAutoInc)
*/
if (done) {
var hdc = this;
drive.disk.seek(drive.wCylinder, drive.bHead, drive.bSector +
drive.bSectorBias, false, function (sector, fAsync)
{
drive.disk.seek(drive.wCylinder, drive.bHead, drive.bSector + drive.bSectorBias, false, function(sector, fAsync) {
var b = -1;
if ((drive.sector = sector)) {
drive.ibSector = 0;
@ -2577,7 +2577,7 @@ HDC.prototype.intBIOSDisk = function(addr)
var DL = this.cpu.regDX & 0xff;
if (!AH && DL > 0x80) this.iDriveAllowFail = DL - 0x80;
if (DEBUGGER) {
if (this.dbg && (this.dbg.messageEnabled(HDC.MESSAGE_HDC) || this.dbg.messageEnabled(HDC.MESSAGE_INT)) && DL >= 0x80) {
if (this.dbg && this.dbg.messageEnabled(HDC.MESSAGE_HDC | HDC.MESSAGE_INT) && DL >= 0x80) {
this.dbg.messageInt(HDC.BIOS.INT_DISK, addr);
this.cpu.addIntReturn(addr, function (hdc, nCycles) {
return function onBIOSDiskReturn(nLevel) {