Fixed PC-DOS 7.00 boot (diskette access still seems sluggish though)

This commit is contained in:
Jeff Parsons 2014-10-18 18:09:08 -05:00 • committed by jeffpar
commit f214b45da0
5 changed files with 1246 additions and 1242 deletions

View file

@ -1033,11 +1033,11 @@ if (DEBUGGER) {
0x13: {
0x00: "disk reset",
0x01: "get status",
0x02: "read drive DL, cyl CH, head DH, sec CL, AL total",
0x03: "write drive DL, cyl CH, head DH, sec CL, AL total",
0x04: "verify drive DL, cyl CH, head DH, sec CL, AL total",
0x05: "format drive DL",
0x08: "read drive DL parameters",
0x02: "read drive DL CH:DH:CL:AL into ES:BX",
0x03: "write drive DL CH:DH:CL:AL from ES:BX",
0x04: "verify drive DL CH:DH:CL:AL",
0x05: "format drive DL using ES:BX",
0x08: "read drive DL parameters into ES:DI",
0x15: "get drive DL DASD type",
0x16: "get drive DL change line status",
0x17: "set drive DL DASD type",
@ -1385,6 +1385,10 @@ if (DEBUGGER) {
*/
Debugger.prototype.messageInt = function(nInt, addr)
{
/*
* TODO: Filtering of interrupt numbers below should be user-definable; this is very quick-and-dirty.
*/
if (nInt < 0x20 && nInt != 0x10 && nInt != 0x15 && nInt != 0x16 && nInt != 0x1C) {
var AH = this.cpu.regAX >> 8;
var aFuncs = Debugger.INT_FUNCS[nInt];
var sFunc = (aFuncs && aFuncs[AH]) || "";
@ -1393,6 +1397,7 @@ if (DEBUGGER) {
sFunc = " " + str.replaceArray(this.aRegValues, sFunc);
}
this.message("INT 0x" + str.toHexByte(nInt) + ": AH=" + str.toHexByte(AH) + " at " + str.toHexAddr(addr - this.cpu.segCS.base, this.cpu.segCS.sel) + sFunc);
}
};
/**

View file

@ -172,13 +172,11 @@ function FDC(parmsFDC) {
this.aDiskHistory = [];
/*
* If we didn't need auto-mount support, we could defer controller initialization until we received a powerUp() notification,
* at which point reset() would call initController(), or restore() would restore the controller; in that case, all we'd need
* to do here is call setReady().
* The remainder of FDC initialization now takes place in our initBus() handler, largely because we
* want initController() to have access to the ChipSet component, so that it can query switches and/or CMOS
* settings that determine the number of drives and their characteristics (eg, 40-track vs. 80-track),
* which it can then pass on to initDrive().
*/
this.initController();
if (!this.autoMount()) this.setReady();
}
Component.subclass(Component, FDC);
@ -546,9 +544,18 @@ FDC.prototype.initBus = function(cmp, bus, cpu, dbg)
this.chipset = cmp.getComponentByType("ChipSet");
/*
* If we didn't need auto-mount support, we could defer controller initialization until we received a powerUp() notification,
* at which point reset() would call initController(), or restore() would restore the controller; in that case, all we'd need
* to do here is call setReady().
*/
this.initController();
bus.addPortInputTable(this, FDC.aPortInput);
bus.addPortOutputTable(this, FDC.aPortOutput);
if (DEBUGGER) cpu.addIntNotify(FDC.BIOS.INT_DISKETTE, this, this.intBIOSDiskette);
if (!this.autoMount()) this.setReady();
};
/**
@ -575,19 +582,8 @@ FDC.prototype.powerUp = function(data, fRepower)
} else {
if (!this.restore(data)) return false;
}
if (this.chipset) {
var iDrive;
this.nDrives = this.chipset.getSWFloppyDrives();
for (iDrive = 0; iDrive < this.nDrives; iDrive++) {
var drive = this.aDrives[iDrive];
drive.bType = this.chipset.getSWFloppyDriveType(iDrive);
if (drive.bType == ChipSet.CMOS.FDRIVE.DSHD) {
drive.nCylinders = 80;
}
}
/*
* Now that we finally have the SW1 settings, we can populate the HTML control
* to match the actual (well, um, specified) number of floppy drives in the system.
* Populate the HTML controls to match the actual (well, um, specified) number of floppy drives.
*/
var controlDrives;
if ((controlDrives = this.bindings['listDrives'])) {
@ -595,7 +591,7 @@ FDC.prototype.powerUp = function(data, fRepower)
controlDrives.removeChild(controlDrives.firstChild);
}
controlDrives.innerHTML = "";
for (iDrive = 0; iDrive < this.nDrives; iDrive++) {
for (var iDrive = 0; iDrive < this.nDrives; iDrive++) {
var controlOption = window.document.createElement("option");
controlOption['value'] = iDrive;
/*
@ -612,7 +608,6 @@ FDC.prototype.powerUp = function(data, fRepower)
}
}
}
}
return true;
};
@ -684,7 +679,7 @@ FDC.prototype.restore = function(data)
*/
FDC.prototype.initController = function(data)
{
var i = 0;
var i = 0, iDrive;
var fSuccess = true;
if (data === undefined) {
@ -728,19 +723,30 @@ FDC.prototype.initController = function(data)
var aDiskHistory = data[i++];
if (aDiskHistory != null) this.aDiskHistory = aDiskHistory;
/*
* We allocate the maximum number of drives; we won't know the actual number of drives until we're able to query
* the SW1 switch settings.
*/
if (this.aDrives === undefined) {
this.nDrives = 0; // this will be set later to the number of ACTUAL drives
this.nDrives = 4; // default to the maximum number of drives
if (this.chipset) this.nDrives = this.chipset.getSWFloppyDrives();
/*
* 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
* how many drives are actually installed. We still rely upon nDrives to determine the number of drives displayed
* to the user, however.
*/
this.aDrives = new Array(4);
}
for (var iDrive = 0; iDrive < this.aDrives.length; iDrive++) {
if (this.aDrives[iDrive] === undefined) {
this.aDrives[iDrive] = {};
}
for (iDrive = 0; iDrive < this.aDrives.length; iDrive++) {
var drive = this.aDrives[iDrive];
if (drive === undefined) {
drive = this.aDrives[iDrive] = {};
drive.bType = this.chipset.getSWFloppyDriveType(iDrive);
drive.nCylinders = 40;
drive.nSectors = 9;
if (drive.bType == ChipSet.CMOS.FDRIVE.DSHD) {
drive.nCylinders = 80;
drive.nSectors = 18; // 15 for 1.2Mb diskettes, 18 for 1.44Mb diskettes, 8/9 for everything else
}
}
if (!this.initDrive(drive, iDrive, dataDrives[iDrive])) {
fSuccess = false;
}
@ -816,14 +822,10 @@ FDC.prototype.initDrive = function(drive, iDrive, data)
if (typeof data[1] == "boolean") {
/*
* Note that when no data is provided (eg, when the controller is being reinitialized), we now take
* care to use drive.nCylinders as the default, falling back to a 40-track maximum ONLY when the drive
* hasn't been initialized. This preserves whatever maximum the powerUp() function may have obtained
* from the ChipSet component.
*
* TODO: We may need to make a similar accommodation for drive.nHeads and drive.nSectors down the road;
* they currently default to a maximum of 2 heads (see above) and 9 sectors/track (see below).
* care to preserve any drive defaults that initController() already obtained for us, falling back to
* bare minimums only when all else has failed.
*/
data[1] = [FDC.DEFAULT_DRIVE_NAME, drive.nCylinders || 40, data[3], 9, 512, data[1]];
data[1] = [FDC.DEFAULT_DRIVE_NAME, drive.nCylinders || 40, drive.nHeads || data[3], drive.nSectors || 9, drive.cbSector || 512, data[1]];
}
/*
@ -873,7 +875,6 @@ FDC.prototype.initDrive = function(drive, iDrive, data)
* To simulate this, bCylinder is now treated as the "physical" cylinder (since that's how it's ALWAYS been used here),
* and bCylinderSeek will now track (pun intended) the "logical" cylinder that's programmed via SEEK commands.
*/
drive.bType = ChipSet.CMOS.FDRIVE.DSDD; // default; updated later once we have the actual ChipSet object
drive.bHead = data[i++];
drive.bCylinderSeek = data[i++]; // the data[] slot where we used to store drive.nHeads (or -1)
drive.bCylinder = data[i++];
@ -1724,9 +1725,9 @@ FDC.prototype.doCmd = function()
* instead, we must calculate the delta between bCylinderSeek and the NCN, and adjust bCylinder
* by that amount. Then we simply move the NCN into bCylinderSeek without any range checking.
*
* Since bCylinder is now expressly defined as the "physical" cylinder number, it must never be
* allowed to exceed the physical boundaries of the drive (ie, never lower than 0, and never greater
* than or equal to nCylinders).
* Since bCylinder is now expressly defined as the "physical" cylinder number, it must never
* be allowed to exceed the physical boundaries of the drive (ie, never lower than 0, and never
* greater than or equal to nCylinders).
*/
bCylinder = this.popCmd(FDC.TERMS.NCN);
drive.bCylinder += bCylinder - drive.bCylinderSeek;

View file

@ -915,10 +915,7 @@ X86CPU.prototype.checkIntNotify = function(nInt)
* speed, check fDebugCheck first.
*/
if (DEBUGGER && this.fDebugCheck) {
/*
* TODO: Filtering out the hard-coded interrupt numbers below should be optional; this is very quick-and-dirty.
*/
if (nInt < 0x20 && nInt != 0x10 && nInt != 0x16 && nInt != 0x1C && this.dbg.messageEnabled(this.dbg.MESSAGE_INT)) {
if (this.dbg.messageEnabled(this.dbg.MESSAGE_INT)) {
this.dbg.messageInt(nInt, this.regEIP);
this.addIntReturn(this.regEIP, function(cpu, nCycles) {
return function onIntReturn(nLevel) {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long