예제 #1
0
        public void ExecuteTestXor()
        {
            var memory = new byte[] { 0xb0, 0x04, 0x30, 0xc0 };
            var cpu    = new InterpretCpu(memory);

            cpu.Execute(0, 1);
            Assert.AreEqual(4, cpu.GetRegister(Reg8.al));
            cpu.Execute(2, 3);
            Assert.AreEqual(0, cpu.GetRegister(Reg8.al));
        }
예제 #2
0
        public void ExecuteTestAddAhAl()
        {
            var memory = new byte[] { 0xB4, 0x04, 0xB0, 0x08, 0x00, 0xC4 };
            var cpu    = new InterpretCpu(memory);

            cpu.Execute(0, 6);
            Assert.AreEqual(12, cpu.GetRegister(Reg8.ah));
        }
예제 #3
0
        public void ExecuteTestMovEsAx()
        {
            var memory = new byte[] { 0xb8, 0x42, 0x00, 0x8e, 0xc0 };
            var cpu    = new InterpretCpu(memory);

            cpu.Execute(0, 5);
            Assert.AreEqual(0x42, cpu.GetRegister(Segments.es));
        }
예제 #4
0
        public void ExecuteTestMov16()
        {
            var memory = new byte[] { 0xbb, 0x42, 0x00 };
            var cpu    = new InterpretCpu(memory);

            cpu.Execute(0, 2);
            Assert.AreEqual(0x42, cpu.GetRegister(Reg16.bx));
        }
예제 #5
0
        public void ExecuteTest()
        {
            var memory = new byte[] { 0xb4, 0x04 };
            var cpu    = new InterpretCpu(memory);

            cpu.Execute(0, 1);
            Assert.AreEqual(4, cpu.GetRegister(Reg8.ah));
        }
예제 #6
0
        public void ExecuteTestSbb8Imm8()
        {
            var memory = new byte[] { 0xB4, 0x04, 0xB7, 0xFF, 0x00, 0xFC, 0xB0, 0x08, 0x1C, 0x04 };
            var cpu    = new InterpretCpu(memory);

            cpu.Execute(0, 9);
            Assert.AreEqual(3, cpu.GetRegister(Reg8.al));
        }
예제 #7
0
        public void ExecuteTestSbb16Imm16()
        {
            var memory = new byte[] { 0xB4, 0x04, 0xB7, 0xFF, 0x00, 0xFC, 0xB8, 0xCF, 0x12, 0x1D, 0x57, 0x06 };
            var cpu    = new InterpretCpu(memory);

            cpu.Execute(0, 11);
            Assert.AreEqual(3191, cpu.GetRegister(Reg16.ax));
        }
예제 #8
0
        public void ExecuteTestAdc16Imm16()
        {
            var memory = new byte[] { 0xB4, 0x04, 0xB7, 0xFF, 0x00, 0xFC, 0xB8, 0x30, 0x00, 0x15, 0xEC, 0x05 };
            var cpu    = new InterpretCpu(memory);

            cpu.Execute(0, 12);
            Assert.AreEqual(1565, cpu.GetRegister(Reg16.ax));
        }
예제 #9
0
        public void ExecuteTestOrAxImm16()
        {
            var memory = new byte[] { 0xB8, 0xEC, 0x05, 0x0D, 0x26, 0x09 };
            var cpu    = new InterpretCpu(memory);

            cpu.Execute(0, 5);
            Assert.AreEqual(0xdee, cpu.GetRegister(Reg16.ax));
        }
예제 #10
0
        public void ExecuteTestAdcr8rm8()
        {
            var memory = new byte[] { 0xB4, 0x04, 0xB7, 0xFF, 0x00, 0xFC, 0xB3, 0x04, 0x12, 0x1E, 0x0C, 0x00, 0x08 };
            var cpu    = new InterpretCpu(memory);

            cpu.Execute(0, 11);
            Assert.AreEqual(13, cpu.GetRegister(Reg8.bl));
        }
예제 #11
0
        public void ExecuteTestOrAlImm8()
        {
            var memory = new byte[] { 0xB0, 0x17, 0x0C, 0x2A };
            var cpu    = new InterpretCpu(memory);

            cpu.Execute(0, 3);
            Assert.AreEqual(0x3f, cpu.GetRegister(Reg8.al));
        }
예제 #12
0
        public void ExecuteTestAddAxImm16()
        {
            var memory = new byte[] { 0xB8, 0xCF, 0x12, 0x05, 0x57, 0x06 };
            var cpu    = new InterpretCpu(memory);

            cpu.Execute(0, 5);
            Assert.AreEqual(6438, cpu.GetRegister(Reg16.ax));
        }
예제 #13
0
        public void ExecuteTestAddAlImm8()
        {
            var memory = new byte[] { 0xB0, 0x04, 0x04, 0x08 };
            var cpu    = new InterpretCpu(memory);

            cpu.Execute(0, 3);
            Assert.AreEqual(12, cpu.GetRegister(Reg8.al));
        }
예제 #14
0
        public void ExecuteTestSbb1616Rm16()
        {
            var memory = new byte[]
            { 0xB4, 0x04, 0xB7, 0xFF, 0x00, 0xFC, 0xB8, 0x30, 0x00, 0xBB, 0xEC, 0x05, 0x19, 0xC3 };
            var cpu = new InterpretCpu(memory);

            cpu.Execute(0, 13);
            Assert.AreEqual(1467, cpu.GetRegister(Reg16.bx));
        }
예제 #15
0
        public void ExecuteTestAdc16()
        {
            var memory = new byte[]
            { 0xb8, 0x04, 0x00, 0xbb, 0xff, 0xff, 0x01, 0xd8, 0xbb, 0x04, 0x00, 0xb8, 0x08, 0x00, 0x11, 0xc3 };
            var cpu = new InterpretCpu(memory);

            cpu.Execute(0, 0x10);
            Assert.AreEqual(13, cpu.GetRegister(Reg8.bl));
        }
예제 #16
0
        public void ExecuteTestPushEs()
        {
            var memory = new byte[] { 0xB8, 0x2A, 0x00, 0x8E, 0xC0, 0x06, 0x1F, 0x00, 0x00 };
            var cpu    = new InterpretCpu(memory);

            cpu.SetRegister(Reg16.sp, 9);
            cpu.Execute(0, 7);
            Assert.AreEqual(42, cpu.GetRegister(Segments.ds));
        }