private void ExecuteTestAllRegs(byte extension, ShiftRotateOperations y, byte value, byte expectedValue, bool expectedCarry, bool expectedSigned, bool carry = false) { ForEachRegister((reg) => { var ob = OpcodeByte.New(x: 0, z: (byte)reg, y: (byte)y); var model = ExecuteTest(ob, value, (cpu) => { if (extension == 0xDD) { cpu.Registers.IX = Address; } if (extension == 0xFD) { cpu.Registers.IY = Address; } cpu.Registers.Flags.C = carry; }, extension); if (reg != Register8Table.HL) { model.Cpu.Registers[reg].Should().Be(expectedValue); } model.Memory.Assert(ExpectedAddress, expectedValue); model.Cpu.Registers.Flags.S.Should().Be(expectedSigned); model.Cpu.Registers.Flags.Z.Should().Be(false); model.Cpu.Registers.Flags.C.Should().Be(expectedCarry); model.Cpu.Registers.Flags.N.Should().Be(false); model.Cpu.Registers.Flags.H.Should().Be(false); }); }
public byte DoShiftRotate(ShiftRotateOperations shiftRotate, byte value) { switch (shiftRotate) { case ShiftRotateOperations.RotateLeftCarry: return(RotateLeftCarry(value)); case ShiftRotateOperations.RotateRightCarry: return(RotateRightCarry(value)); case ShiftRotateOperations.RotateLeft: return(RotateLeft(value)); case ShiftRotateOperations.RotateRight: return(RotateRight(value)); case ShiftRotateOperations.ShiftLeftArithmetic: return(ShiftLeftArithmetic(value)); case ShiftRotateOperations.ShiftRightArithmetic: return(ShiftRightArithmetic(value)); case ShiftRotateOperations.ShiftLeftLogical: return(ShiftLeftLogical(value)); case ShiftRotateOperations.ShiftRightLogical: return(ShiftRightLogical(value)); } throw new NotSupportedException("Unknown Shift/Rotate operation."); }
public void DoShiftRotate(ShiftRotateOperations shiftRotate, Register8Table reg) { _primarySet[reg] = DoShiftRotate(shiftRotate, _primarySet[reg]); }