public void Test88() { byte value8; i8086CPU cpu = GetCPU(new byte[] { 0x88, 0x4f, 0x10 } /* MOV [bx+10],CL */); value8 = 0x2f; cpu.EU.Registers.CL = value8; cpu.NextInstruction(); Assert.AreEqual(value8, cpu.Bus.GetData8(cpu.EU.Registers.BX + 0x10), "Instruction 0x88 failed"); cpu.Boot(new byte[] { 0x88, 0x8f, 0x10, 0x00 } /* MOV [bx+10],CL using 16 bit displacement */); value8 = 0x2f; cpu.EU.Registers.CL = value8; cpu.NextInstruction(); Assert.AreEqual(value8, cpu.Bus.GetData8(cpu.EU.Registers.BX + 0x10), "Instruction 0x88 failed"); // Test with segment override cpu.Boot(new byte[] { 0x26, 0x88, 0x8f, 0x10, 0x00 } /* MOV [bx+10],CL using 16 bit displacement with ES override */); value8 = 0x2f; cpu.EU.Registers.CL = value8; // only need to call NextInstruction once because when there is a segment override the next instruction is always // executed immediately. In a real system, interrupts are not allowed after a segment override. cpu.NextInstruction(); // now set the override again so the correct memory segment is accessed cpu.Bus.SegmentOverride = i8086BusInterfaceUnit.SegmentOverrideState.UseES; Assert.AreEqual(value8, cpu.Bus.GetData8(cpu.EU.Registers.BX + 0x10), "Instruction 0x88 failed"); }
private i8086CPU GetCPU(byte[] program) { i8086CPU cpu = new i8086CPU(); cpu.Boot(program); cpu.Bus.DS = 0x2000; cpu.Bus.SS = 0x4000; cpu.Bus.ES = 0x6000; return(cpu); }
public void Test88() { byte value8; i8086CPU cpu = GetCPU(new byte[] { 0x88, 0x4f, 0x10 } /* MOV [bx+10],CL */); value8 = 0x2f; cpu.EU.Registers.CL = value8; cpu.NextInstruction(); Assert.AreEqual(value8, cpu.Bus.GetData8(cpu.EU.Registers.BX + 0x10), "Instruction 0x88 failed"); cpu.Boot(new byte[] { 0x88, 0x8f, 0x10, 0x00 } /* MOV [bx+10],CL using 16 bit displacement */); value8 = 0x2f; cpu.EU.Registers.CL = value8; cpu.NextInstruction(); Assert.AreEqual(value8, cpu.Bus.GetData8(cpu.EU.Registers.BX + 0x10), "Instruction 0x88 failed"); // Test with segment override cpu.Boot(new byte[] { 0x26, 0x88, 0x8f, 0x10, 0x00 } /* MOV [bx+10],CL using 16 bit displacement with ES override */); value8 = 0x2f; cpu.EU.Registers.CL = value8; cpu.NextInstruction(); Assert.AreEqual(i8086BusInterfaceUnit.SegmentOverrideState.UseES, cpu.Bus.SegmentOverride, "Invalid segment override value"); cpu.NextInstruction(); // after the instruction the override should be turned off Assert.AreEqual(i8086BusInterfaceUnit.SegmentOverrideState.NoOverride, cpu.Bus.SegmentOverride, "Invalid segment override value"); // now set the override again so the correct memory segment is accessed cpu.Bus.SegmentOverride = i8086BusInterfaceUnit.SegmentOverrideState.UseES; Assert.AreEqual(value8, cpu.Bus.GetData8(cpu.EU.Registers.BX + 0x10), "Instruction 0x88 failed"); }