private static void TestZ80(PrefixEdOpCode op, Operand o0, Operand o1) { using (var fixture = new DecodeFixture(2, 9, PrimaryOpCode.Prefix_ED, op).ThrowUnlessZ80()) { fixture.Expected.OpCode(OpCode.Load).Operands(o0, o1); } }
public void SWAP_r(GameBoyPrefixCbOpCode op, Operand r) { using (var fixture = new DecodeFixture(2, 8, PrimaryOpCode.Prefix_CB, op).OnlyGameboy()) { fixture.Expected.OpCode(OpCode.Swap).Operands(r); } }
public void LD_SP_HL() { using (var fixture = new DecodeFixture(1, 6, PrimaryOpCode.LD_SP_HL)) { fixture.Expected.OpCode(OpCode.Load16).Operands(Operand.SP, Operand.HL); } }
public void LD_SP_IXY(Operand index) { using (var fixture = new DecodeFixture(2, 10, index.GetZ80IndexPrefix(), PrimaryOpCode.LD_SP_HL).ThrowUnlessZ80()) { fixture.Expected.OpCode(OpCode.Load16).Operands(Operand.SP, index); } }
private static void Test(PrimaryOpCode op, OpCode expected) { using (var fixture = new DecodeFixture(1, 4, op)) { fixture.Expected.OpCode(expected); } }
private static void TestZ80(PrefixEdOpCode op, Operand o0, OpCode excepted = OpCode.Input, int machineCycles = 3, int throttlingStates = 12) { using (var fixture = new DecodeFixture(machineCycles, throttlingStates, PrimaryOpCode.Prefix_ED, op).ThrowUnlessZ80()) { fixture.Expected.OpCode(excepted).Operands(o0, Operand.C); } }
public void INC_IXY(Operand index) { using (var fixture = new DecodeFixture(2, 10, index.GetZ80IndexPrefix(), PrimaryOpCode.INC_HL).ThrowUnlessZ80()) { fixture.Expected.OpCode(OpCode.Increment16).Operands(index); } }
public void RST_nn(PrimaryOpCode op, ushort address) { using (var fixture = new DecodeFixture(3, 11, op).DoNotHalt()) { fixture.Expected.OpCode(OpCode.Reset).Operands(Operand.nn).WordLiteral(address); } }
public void ADD_IXY_s(PrimaryOpCode op, Operand index, Operand s) { using (var fixture = new DecodeFixture(4, 15, index.GetZ80IndexPrefix(), op).ThrowUnlessZ80()) { fixture.Expected.OpCode(OpCode.Add16).Operands(index, s); } }
public void SBC_HL_s(PrefixEdOpCode op, Operand s) { using (var fixture = new DecodeFixture(4, 15, PrimaryOpCode.Prefix_ED, op).ThrowUnlessZ80()) { fixture.Expected.OpCode(OpCode.SubtractWithCarry16).Operands(Operand.HL, s); } }
public void ADD_HL_s(PrimaryOpCode op, Operand s) { using (var fixture = new DecodeFixture(3, 11, op)) { fixture.Expected.OpCode(OpCode.Add16).Operands(Operand.HL, s); } }
public void JP_IXY(Operand index) { using (var fixture = new DecodeFixture(2, 8, index.GetZ80IndexPrefix(), PrimaryOpCode.JP_mHL).DoNotHalt().ThrowUnlessZ80()) { fixture.Expected.OpCode(OpCode.Jump).Operands(index); } }
public void JP_mHL() { using (var fixture = new DecodeFixture(1, 4, PrimaryOpCode.JP_mHL).DoNotHalt()) { fixture.Expected.OpCode(OpCode.Jump).Operands(Operand.HL); } }
private static void TestIndex(PrefixCbOpCode op, OpCode expected, bool gameboy = true) { using (var fixture = new DecodeFixture(4, 15, PrimaryOpCode.Prefix_CB, op).ThrowOn8080().OnGameboy(gameboy)) { fixture.Expected.OpCode(expected).Operands(Operand.mHL); } }
public void DEC_ss(PrimaryOpCode op, Operand s) { using (var fixture = new DecodeFixture(1, 6, op)) { fixture.Expected.OpCode(OpCode.Decrement16).Operands(s); } }
private static void TestPrimaryNoHalt(GameBoyPrimaryOpCode op, OpCode excepted = OpCode.Load, int machineCycles = 1, int throttlingStates = 4) { using (var fixture = new DecodeFixture(machineCycles, throttlingStates, op).OnlyGameboy().DoNotHalt()) { fixture.Expected.OpCode(excepted); } }
private static void TestStackOperation(PrimaryOpCode op, Operand qq, OpCode expected = OpCode.Push, int machineCycles = 3, int throttlineStates = 11) { using (var fixture = new DecodeFixture(machineCycles, throttlineStates, op)) { fixture.Expected.OpCode(expected).Operands(qq); } }
private static void TestReturn(PrimaryOpCode op, FlagTest flagTest, int machineCycles = 1, int throttlingStates = 5, bool gameboy = true) { using (var fixture = new DecodeFixture(machineCycles, throttlingStates, op).DoNotHalt().ThrowOnGameboy(!gameboy)) { fixture.Expected.OpCode(OpCode.Return).FlagTest(flagTest); } }
private static void TestZ80StackOperation(PrimaryOpCode op, Operand qq, OpCode expected = OpCode.Push, int machineCycles = 4, int throttlineStates = 15) { using (var fixture = new DecodeFixture(machineCycles, throttlineStates, qq.GetZ80IndexPrefix(), op).ThrowUnlessZ80()) { fixture.Expected.OpCode(expected).Operands(qq); } }
private static void TestZ80(PrefixEdOpCode op, OpCode excepted, int machineCycles = 4, int throttlingStates = 16) { using (var fixture = new DecodeFixture(machineCycles, throttlingStates, PrimaryOpCode.Prefix_ED, op).ThrowUnlessZ80()) { fixture.Expected.OpCode(excepted); } }
private static void TestPrimary(GameBoyPrimaryOpCode op, Operand o0, Operand o1, OpCode excepted = OpCode.Load, int machineCycles = 2, int throttlingStates = 7) { using (var fixture = new DecodeFixture(machineCycles, throttlingStates, op).OnlyGameboy()) { fixture.Expected.OpCode(excepted).Operands(o0, o1); } }
private static void Z80IndexExchangeTest(Operand index) { using (var fixture = new DecodeFixture(6, 23, index.GetZ80IndexPrefix(), PrimaryOpCode.EX_mSP_HL).ThrowUnlessZ80()) { fixture.Expected.OpCode(OpCode.Exchange).Operands(Operand.mSP, index); } }
private static void Test(PrimaryOpCode op, OpCode expected) { using (var fixture = new DecodeFixture(1, 4, op)) { fixture.Expected.OpCode(expected).Operands(Operand.A).UseAlternativeFlagAffection(); } }
private static void TestPrefixEd(PrefixEdOpCode op, OpCode expected) { using (var fixture = new DecodeFixture(4, 16, PrimaryOpCode.Prefix_ED, op).ThrowUnlessZ80()) { fixture.Expected.OpCode(expected); } }
public void EX_mSP_HL() { using (var fixture = new DecodeFixture(5, 19, PrimaryOpCode.EX_mSP_HL).NotOnGameboy()) { fixture.Expected.OpCode(OpCode.Exchange).Operands(Operand.mSP, Operand.HL); } }
private static void IndexTest(PrimaryOpCode op, OpCode expected, int machineCycles = 2, int throttlingStates = 7) { using (var fixture = new DecodeFixture(machineCycles, throttlingStates, op)) { fixture.Expected.OpCode(expected).Operands(Operand.mHL); } }
private static void Test(PrimaryOpCode op, Operand r, OpCode expected, int machineCycles = 1, int throttlingStates = 4) { using (var fixture = new DecodeFixture(machineCycles, throttlingStates, op)) { fixture.Expected.OpCode(expected).Operands(r); } }
private static void Z80Index(PrimaryOpCode op, Operand index, OpCode expected, int machineCycles = 5, int throttlingStates = 19) { var displacement = Rng.SByte(); using (var fixture = new DecodeFixture(machineCycles, throttlingStates, index.GetZ80IndexPrefix(), op, displacement).ThrowUnlessZ80()) { fixture.Expected.OpCode(expected).Operands(index).Displacement(displacement); } }
private static void LiteralTest(PrimaryOpCode op, OpCode expected, int machineCycles = 2, int throttlingStates = 7) { var literal = Rng.Byte(); using (var fixture = new DecodeFixture(machineCycles, throttlingStates, op, literal)) { fixture.Expected.OpCode(expected).Operands(Operand.n).ByteLiteral(literal); } }
private static void TestByteLiteral(PrimaryOpCode op, OpCode excepted = OpCode.Input) { var literal = Rng.Byte(); using (var fixture = new DecodeFixture(3, 11, op, literal).ThrowOnGameboy()) { fixture.Expected.OpCode(excepted).Operands(Operand.A, Operand.n).ByteLiteral(literal); } }