public void SkipNextInstructionIfRegisterNotEqualsRegisterTest() { // Arrange var sut = this.GetDefaultOpcodeProcessor(); var machineState = FixtureUtils.DefaultMachineState(); machineState.CurrentOpcode = 0x9238; machineState.ProgramCounter = 0x300; machineState.VRegisters[2] = 0x8010; machineState.VRegisters[3] = 0x80FF; // Act sut.SkipNextInstructionIfRegisterNotEqualsRegister(machineState); // Assert Assert.Equal(machineState.ProgramCounter, 0x302); }
public void ShiftRegisterLeftTest() { // Arrange var sut = this.GetDefaultOpcodeProcessor(); var machineState = FixtureUtils.DefaultMachineState(); machineState.CurrentOpcode = 0x823E; machineState.VRegisters[2] = 0x8010; machineState.VRegisters[3] = 0x80FF; // Act sut.ShiftRegisterLeft(machineState); // Assert Assert.Equal(machineState.VRegisters[2], 0x80FF >> 1); Assert.Equal(machineState.VRegisters[0xF], 0x1); }
public void SubstractRegistersReverseTest() { // Arrange var sut = this.GetDefaultOpcodeProcessor(); var machineState = FixtureUtils.DefaultMachineState(); machineState.CurrentOpcode = 0x8237; machineState.VRegisters[2] = 0xE001; machineState.VRegisters[3] = 0xFF01; // Act sut.SubstractRegistersReverse(machineState); // Assert Assert.Equal(machineState.VRegisters[2], 0xFF01 - 0xE001); Assert.Equal(machineState.VRegisters[0xF], 0x1); }
public void AddRegistersIntoRegisterTest() { // Arrange var sut = this.GetDefaultOpcodeProcessor(); var machineState = FixtureUtils.DefaultMachineState(); machineState.CurrentOpcode = 0x8234; machineState.VRegisters[2] = 0xFF; machineState.VRegisters[3] = 0xFF; // Act sut.AddRegistersIntoRegister(machineState); // Assert Assert.Equal(machineState.VRegisters[2], 0xFF + 0xFF); Assert.Equal(machineState.VRegisters[0xF], 0x1); }
public void LoadFromValueInRegisterIntoAllRegistersTest() { // Arrange var sut = this.GetDefaultOpcodeProcessor(); var machineState = FixtureUtils.DefaultMachineState(); machineState.CurrentOpcode = 0xF265; machineState.IndexRegister = 0x204; machineState.Memory[machineState.IndexRegister] = 0x10; machineState.Memory[machineState.IndexRegister + 1] = 0x11; machineState.Memory[machineState.IndexRegister + 2] = 0x12; // Act sut.LoadFromValueInRegisterIntoAllRegisters(machineState); // Assert Assert.Equal(machineState.Memory[machineState.IndexRegister], machineState.VRegisters[0]); Assert.Equal(machineState.Memory[machineState.IndexRegister + 1], machineState.VRegisters[1]); Assert.Equal(machineState.Memory[machineState.IndexRegister + 2], machineState.VRegisters[2]); }
public void LoadAllRegistersFromValueInRegisterTest() { // Arrange var sut = this.GetDefaultOpcodeProcessor(); var machineState = FixtureUtils.DefaultMachineState(); machineState.CurrentOpcode = 0xF455; machineState.VRegisters[0x0] = 0x12; machineState.VRegisters[0x1] = 0x13; machineState.VRegisters[0x2] = 0x14; machineState.VRegisters[0x3] = 0x15; machineState.VRegisters[0x4] = 0x16; // Act sut.LoadAllRegistersFromValueInRegister(machineState); // Assert Assert.Equal(machineState.Memory[machineState.IndexRegister], 0x12); Assert.Equal(machineState.Memory[machineState.IndexRegister + 1], 0x13); Assert.Equal(machineState.Memory[machineState.IndexRegister + 2], 0x14); Assert.Equal(machineState.Memory[machineState.IndexRegister + 3], 0x15); Assert.Equal(machineState.Memory[machineState.IndexRegister + 4], 0x16); }