Added MS-DOS 1.x and 2.0 directory listings (and fixed improper fault handling on 8086 machines)

This commit is contained in:
Jeff Parsons 2016-02-04 12:13:32 -08:00
commit c3215b7aca
6 changed files with 216 additions and 9 deletions

View file

@ -1025,6 +1025,14 @@ CPU.prototype.runCPU = function(fOnClick)
catch(exception) {
if (typeof exception != "number") throw exception;
if (MAXDEBUG) this.println("CPU exception " + str.toHexByte(exception));
/*
* TODO: If we ever get into a situation where every single instruction is generating a fault
* (eg, if an 8088 executes opcode 0xFF 0xFF, which is incorrectly routed to fnFault() instead
* of fnGRPUndefined()), the browser may hang because we're failing to yield often enough.
* This is likely because the thrown exceptions are taking MUCH longer than normal instructions,
* throwing off our burst calculations. We need to either adjust the burst or break out of the
* DO-WHILE loop on every exception.
*/
}
/*

View file

@ -3776,6 +3776,18 @@ X86.fnXORw = function(dst, src)
*/
X86.fnGRPFault = function(dst, src)
{
/*
* This should NEVER be called on 8086/8088 CPUs, and yet we preset some of the handlers in aOpGrpPOPw,
* aOpGrp4b, and aOpGrp4w to call it. initProcessor() DOES patch aOpGrp4b[0x07] and aOpGrp4w[0x07] to
* fnGRPInvalid, but that's it.
*
* However, given the infrequency of this call, it's simpler to continue presetting all the handlers in
* aOpGrpPOPw to their post-8086 default, and deal with the appropriate 8086 behavior here (which for now,
* is to call fnGRPUndefined instead).
*/
if (this.model < X86.MODEL_80186) {
return X86.fnGRPUndefined.call(this, dst, src);
}
X86.fnFault.call(this, X86.EXCEPTION.GP_FAULT, 0);
return dst;
};

View file

@ -4342,7 +4342,7 @@ X86.opGRP3w = function()
X86.opCLC = function()
{
this.clearCF();
this.nStepCycles -= 2; // CLC takes 2 cycles on all CPUs
this.nStepCycles -= 2; // CLC takes 2 cycles on all CPUs
};
/**
@ -4353,7 +4353,7 @@ X86.opCLC = function()
X86.opSTC = function()
{
this.setCF();
this.nStepCycles -= 2; // STC takes 2 cycles on all CPUs
this.nStepCycles -= 2; // STC takes 2 cycles on all CPUs
};
/**
@ -4373,7 +4373,7 @@ X86.opCLI = function()
return;
}
this.clearIF();
this.nStepCycles -= this.cycleCounts.nOpCyclesCLI; // CLI takes LONGER on an 80286
this.nStepCycles -= this.cycleCounts.nOpCyclesCLI; // CLI takes LONGER on an 80286
};
/**
@ -4394,7 +4394,7 @@ X86.opSTI = function()
}
this.setIF();
this.opFlags |= X86.OPFLAG.NOINTR;
this.nStepCycles -= 2; // STI takes 2 cycles on all CPUs
this.nStepCycles -= 2; // STI takes 2 cycles on all CPUs
};
/**
@ -4405,7 +4405,7 @@ X86.opSTI = function()
X86.opCLD = function()
{
this.clearDF();
this.nStepCycles -= 2; // CLD takes 2 cycles on all CPUs
this.nStepCycles -= 2; // CLD takes 2 cycles on all CPUs
};
/**
@ -4416,7 +4416,7 @@ X86.opCLD = function()
X86.opSTD = function()
{
this.setDF();
this.nStepCycles -= 2; // STD takes 2 cycles on all CPUs
this.nStepCycles -= 2; // STD takes 2 cycles on all CPUs
};
/**
@ -4655,5 +4655,5 @@ X86.aOpGrp4b = [
X86.aOpGrp4w = [
X86.fnINCw, X86.fnDECw, X86.fnCALLw, X86.fnCALLFdw, // 0xFF(reg=0x0-0x3)
X86.fnJMPw, X86.fnJMPFdw, X86.fnPUSHw, X86.fnGRPFault // 0xFF(reg=0x4-0x7)
X86.fnJMPw, X86.fnJMPFdw, X86.fnPUSHw, X86.fnGRPUndefined // 0xFF(reg=0x4-0x7)
];