Merge branch 'next-release'
This commit is contained in:
commit
d0480ecb90
297 changed files with 9645 additions and 2541 deletions
|
|
@ -771,7 +771,7 @@ FDC.prototype.initController = function(data)
|
|||
|
||||
if (this.aDrives === undefined) {
|
||||
this.nDrives = 4; // default to the maximum number of drives
|
||||
if (this.chipset) this.nDrives = this.chipset.getSWFloppyDrives();
|
||||
if (this.chipset) this.nDrives = this.chipset.getDIPFloppyDrives();
|
||||
/*
|
||||
* I would prefer to allocate only nDrives, but as discussed in the handling of the FDC.REG_DATA.CMD.SENSE_INT
|
||||
* command, we're faced with situations where the controller must respond to any drive in the range 0-3, regardless
|
||||
|
|
@ -789,7 +789,7 @@ FDC.prototype.initController = function(data)
|
|||
* the drive's physical limits accordingly (ie, max tracks, max heads, and max sectors/track).
|
||||
*/
|
||||
drive = this.aDrives[iDrive] = {};
|
||||
var nKb = (this.chipset? this.chipset.getSWFloppyDriveSize(iDrive) : 0);
|
||||
var nKb = (this.chipset? this.chipset.getDIPFloppyDriveSize(iDrive) : 0);
|
||||
switch(nKb) {
|
||||
case 160:
|
||||
case 180:
|
||||
|
|
@ -1279,7 +1279,7 @@ FDC.prototype.loadSelectedDrive = function(sDisketteName, sDiskettePath, file)
|
|||
|
||||
if (DEBUG) this.println("loading disk " + sDiskettePath + "...");
|
||||
|
||||
while (this.loadDiskette(iDrive, sDisketteName, sDiskettePath, false, file)) {
|
||||
while (this.loadDiskette(iDrive, sDisketteName, sDiskettePath, false, file) < 0) {
|
||||
if (!window.confirm("Click OK to reload the original disk.\n(WARNING: All disk changes will be discarded)")) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -1327,7 +1327,7 @@ FDC.prototype.mountDiskette = function(iDrive, sDisketteName, sDiskettePath)
|
|||
* @param {string} sDiskettePath
|
||||
* @param {boolean} [fAutoMount]
|
||||
* @param {File} [file] is set if there's an associated File object
|
||||
* @return {boolean} true if diskette (already) loaded, false if queued up (or busy)
|
||||
* @return {number} 1 if diskette loaded, 0 if queued up (or busy), -1 if already loaded
|
||||
*/
|
||||
FDC.prototype.loadDiskette = function(iDrive, sDisketteName, sDiskettePath, fAutoMount, file)
|
||||
{
|
||||
|
|
@ -1336,7 +1336,7 @@ FDC.prototype.loadDiskette = function(iDrive, sDisketteName, sDiskettePath, fAut
|
|||
this.unloadDrive(iDrive, fAutoMount, true);
|
||||
if (drive.fBusy) {
|
||||
this.notice("Drive " + iDrive + " busy");
|
||||
return true;
|
||||
return 0;
|
||||
}
|
||||
drive.fBusy = true;
|
||||
if (fAutoMount) {
|
||||
|
|
@ -1347,10 +1347,11 @@ FDC.prototype.loadDiskette = function(iDrive, sDisketteName, sDiskettePath, fAut
|
|||
drive.fLocal = !!file;
|
||||
var disk = new Disk(this, drive, DiskAPI.MODE.PRELOAD);
|
||||
if (!disk.load(sDisketteName, sDiskettePath, file, this.doneLoadDiskette)) {
|
||||
return false;
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
return true;
|
||||
return -1;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -1436,6 +1437,12 @@ FDC.prototype.doneLoadDiskette = function onFDCLoadNotify(drive, disk, sDiskette
|
|||
drive.nDiskCylinders = aDiskInfo[0];
|
||||
drive.nDiskHeads = aDiskInfo[1];
|
||||
drive.nDiskSectors = aDiskInfo[2];
|
||||
|
||||
/*
|
||||
* Since you usually want the Computer to have focus again after loading a new diskette, let's try automatically
|
||||
* updating the focus after a successful load.
|
||||
*/
|
||||
if (this.cmp) this.cmp.updateFocus();
|
||||
}
|
||||
else {
|
||||
drive.fLocal = false;
|
||||
|
|
@ -1733,6 +1740,85 @@ FDC.prototype.outFDCOutput = function(port, bOut, addrFrom)
|
|||
this.regOutput = bOut;
|
||||
};
|
||||
|
||||
/**
|
||||
* inFDCDiagnostic(port, addrFrom)
|
||||
*
|
||||
* It turns out that any 5170 configuration without an HDC component that attempts to use either the REV2 or REV3
|
||||
* PC AT ROM BIOS will fail with error "601-Diskette Error", unless we also provide this "D/S/P DIAGNOSTIC REGISTER".
|
||||
* The original 5170 REV1 BIOS didn't have this requirement.
|
||||
*
|
||||
* I'm unable to find any documentation on this so-called "D/S/P DIAGNOSTIC REGISTER" (port 0x3F1) or the "D/S/P CARD"
|
||||
* to which the ROM BIOS refers. But it seems clear that if we don't provide the expected response from the DIAGNOSTIC
|
||||
* REGISTER, and there's no HDC to respond to the MULTIPLE DATA RATE CAPABLE test that follows, then an error is inevitable.
|
||||
* Clearly, there is a very intimate relationship between the FDC and HDC portions of this card.
|
||||
*
|
||||
* Here's the relevant code from the REV3 PC AT ROM BIOS (TEST2.ASM):
|
||||
*
|
||||
* ;----- CHECK FOR MULTIPLE DATA RATE CAPABILITY
|
||||
*
|
||||
* J_OK:
|
||||
* MOV DX,03F1H ; D/S/P DIAGNOSTIC REGISTER
|
||||
* IN AL,DX ; READ D/S/P TYPE CODE
|
||||
* AND AL,11111000B ; KEEP ONLY UNIQUE CODE FOR D/S/P
|
||||
* CMP AL,01010000B ; D/S/P CARD - MULTIPLE DATA RATE?
|
||||
* JZ J_OK3 ; IF SO JUMP
|
||||
*
|
||||
* MOV DX,05F7H ; FIXED DISK DIAGNOSTIC REGISTER
|
||||
* IN AL,DX ; READ FIXED DISK TYPE CODE
|
||||
* AND AL,11110000B ; KEEP ONLY UNIQUE CODE FOR F/D
|
||||
* CMP AL,10100000B ; FIXED DISK ADAPTER ?
|
||||
* JZ J_FAIL ; MUST BE COMBO ELSE ERROR
|
||||
*
|
||||
* MOV BL,0FH ; OUTER LOOP COUNT WAIT FOR BUSY OFF
|
||||
* SUB CX,CX
|
||||
* MOV DX,01F7H ; HARD FILE STATUS PORT
|
||||
* J_OK1:
|
||||
* IN AL,DX ; GET THE STATUS
|
||||
* TEST AL,080H ; IS THE CONTROLLER BUSY?
|
||||
* JZ J_OK2 ; CONTINUE IF NOT
|
||||
* LOOP J_OK1 ; TRY AGAIN
|
||||
* DEC BL ; DECREMENT OUTER LOOP
|
||||
* JNZ J_OK1 ; TRY AGAIN IF NOT ZERO
|
||||
* AND AL,0CH ; BITS 2 & 3 = 0 IF MULTI DATA CAPABLE
|
||||
* JZ J_OK3 ; GO IF YES
|
||||
* JMP SHORT J_FAIL ; NO MULTIPLE DATA RATE CAPABILITY
|
||||
* J_OK2:
|
||||
* MOV DX,1F4H ; VERIFY MULTIPLE DATA RATE CAPABLE
|
||||
* MOV AL,055H ; WRITE TO THE CYLINDER BYTE
|
||||
* OUT DX,AL
|
||||
* JMP $+2 ; I/O DELAY
|
||||
* IN AL,DX ; CHECK DATA WRITTEN = DATA READ
|
||||
* CMP AL,055H
|
||||
* JNZ J_FAIL ; GO IF NOT
|
||||
* MOV AL,0AAH ; WRITE ANOTHER PATTERN
|
||||
* OUT DX,AL
|
||||
* JMP $+2 ; I/O DELAY
|
||||
* IN AL,DX
|
||||
* CMP AL,0AAH ; IS DATA PATTERN THE SAME?
|
||||
* JZ J_OK3 ; GO IF SO
|
||||
*
|
||||
* J_FAIL:
|
||||
* OR @MFG_ERR_FLAG+1,DSK_FAIL; <><><><><><><><><><><><><>
|
||||
* ; <><> DISKETTE FAILED <><>
|
||||
* MOV SI,OFFSET E601 ; GET ADDRESS OF MESSAGE
|
||||
* CALL E_MSG ; GO PRINT ERROR MESSAGE
|
||||
* JMP SHORT F15C ; SKIP SETUP IF ERROR
|
||||
*
|
||||
* J_OK3:
|
||||
* OR @LASTRATE,DUAL ; TURN ON DSP/COMBO FLAG
|
||||
*
|
||||
* @this {FDC}
|
||||
* @param {number} port (0x3F1, input only)
|
||||
* @param {number} [addrFrom] (not defined whenever the Debugger tries to read the specified port)
|
||||
* @return {number} simulated port value
|
||||
*/
|
||||
FDC.prototype.inFDCDiagnostic = function(port, addrFrom)
|
||||
{
|
||||
var b = 0x50; // we simply return the expected pattern (01010000B); see code excerpt above
|
||||
this.printMessageIO(port, null, addrFrom, "DIAG", b);
|
||||
return b;
|
||||
};
|
||||
|
||||
/**
|
||||
* inFDCStatus(port, addrFrom)
|
||||
*
|
||||
|
|
@ -2539,6 +2625,7 @@ FDC.prototype.writeFormat = function(drive, b)
|
|||
* way out and always emulating it. So, consider an FDC parameter to disable that feature for stricter compatibility.
|
||||
*/
|
||||
FDC.aPortInput = {
|
||||
0x3F1: FDC.prototype.inFDCDiagnostic,
|
||||
0x3F4: FDC.prototype.inFDCStatus,
|
||||
0x3F5: FDC.prototype.inFDCData,
|
||||
0x3F7: FDC.prototype.inFDCInput
|
||||
|
|
|
|||
Loading…
Reference in a new issue