예제 #1
0
        public void Setting_IRegister_OutsideValidMemoryRange_ThrowsException(byte vxValue, ushort iValue)
        {
            var cpu = new Cpu {
                I = iValue
            };
            var decodedInstruction = new DecodedInstruction(0xFA1E);

            cpu.V[decodedInstruction.x] = vxValue;

            var instruction = new Instruction_Fx1E(decodedInstruction);

            Assert.Throws <InvalidOperationException>(() => instruction.Execute(cpu, MockedDisplay, MockedKeyboard));
        }
예제 #2
0
        public void Executing_Instruction_Fx1E_WorksAsExpected(byte vxValue, ushort iValue, ushort expectedIValue)
        {
            var cpu = new Cpu {
                I = iValue
            };
            var decodedInstruction = new DecodedInstruction(0xFA1E);

            cpu.V[decodedInstruction.x] = vxValue;

            var instruction = new Instruction_Fx1E(decodedInstruction);

            instruction.Execute(cpu, MockedDisplay, MockedKeyboard);

            Assert.That(cpu.I, Is.EqualTo(expectedIValue));
            Assert.That(instruction.Mnemonic, Is.EqualTo($"ADD I, V{decodedInstruction.x:X}"));
        }