Fixed save/restore (hopefully) when A20 is off, as well as when HDC I/O is in progress (although the latter needs more testing)

This commit is contained in:
Jeff Parsons 2015-08-29 15:22:36 -07:00
commit 63121a1768
6 changed files with 99 additions and 57 deletions

View file

@ -1467,19 +1467,25 @@ X86.fnLDS = function LDS(dst, src)
*/
X86.fnLEA = function LEA(dst, src)
{
/*
* TODO: Until I bite the bullet and choose a truly invalid value for X86.ADDR_INVALID (eg, null),
* this code must be disabled, because otherwise an instruction like "LEA ECX,[EAX-1]" will fail when
* EAX is zero. And we can't have that.
*
if (this.regEA === X86.ADDR_INVALID) {
/*
* TODO: After reading http://www.os2museum.com/wp/undocumented-8086-opcodes/, it seems that this
* form of LEA (eg, "LEA AX,DX") simply returns the last calculated EA. Since we always reset regEA
* at the start of a new instruction, we would need to preserve the previous EA if we want to mimic
* that (undocumented) behavior.
*
* And for completeness, we would have to extend EA tracking beyond the usual ModRM instructions
* (eg, XLAT, instructions that modify the stack pointer, and string instructions). Anything else?
*/
//
// TODO: After reading http://www.os2museum.com/wp/undocumented-8086-opcodes/, it seems that this
// form of LEA (eg, "LEA AX,DX") simply returns the last calculated EA. Since we always reset regEA
// at the start of a new instruction, we would need to preserve the previous EA if we want to mimic
// that (undocumented) behavior.
//
// And for completeness, we would have to extend EA tracking beyond the usual ModRM instructions
// (eg, XLAT, instructions that modify the stack pointer, and string instructions). Anything else?
//
X86.opUndefined.call(this);
return dst;
}
*/
this.nStepCycles -= this.cycleCounts.nOpCyclesLEA;
return this.regEA;
};