Exemplo n.º 1
0
 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);
     }
 }
Exemplo n.º 2
0
 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);
     }
 }
Exemplo n.º 3
0
 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);
     }
 }
Exemplo n.º 4
0
 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);
     }
 }
Exemplo n.º 6
0
 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);
     }
 }
Exemplo n.º 7
0
 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);
     }
 }
Exemplo n.º 8
0
 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);
     }
 }
Exemplo n.º 9
0
 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);
     }
 }
Exemplo n.º 10
0
 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);
     }
 }
Exemplo n.º 11
0
 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);
     }
 }
Exemplo n.º 12
0
 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);
     }
 }
Exemplo n.º 13
0
 public void JP_mHL()
 {
     using (var fixture = new DecodeFixture(1, 4, PrimaryOpCode.JP_mHL).DoNotHalt())
     {
         fixture.Expected.OpCode(OpCode.Jump).Operands(Operand.HL);
     }
 }
Exemplo n.º 14
0
 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);
     }
 }
Exemplo n.º 15
0
 public void DEC_ss(PrimaryOpCode op, Operand s)
 {
     using (var fixture = new DecodeFixture(1, 6, op))
     {
         fixture.Expected.OpCode(OpCode.Decrement16).Operands(s);
     }
 }
Exemplo n.º 16
0
 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);
     }
 }
Exemplo n.º 17
0
 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);
     }
 }
Exemplo n.º 18
0
 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);
     }
 }
Exemplo n.º 19
0
 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);
     }
 }
Exemplo n.º 20
0
 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);
     }
 }
Exemplo n.º 21
0
 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);
     }
 }
Exemplo n.º 22
0
 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);
     }
 }
Exemplo n.º 23
0
 private static void Test(PrimaryOpCode op, OpCode expected)
 {
     using (var fixture = new DecodeFixture(1, 4, op))
     {
         fixture.Expected.OpCode(expected).Operands(Operand.A).UseAlternativeFlagAffection();
     }
 }
Exemplo n.º 24
0
 private static void TestPrefixEd(PrefixEdOpCode op, OpCode expected)
 {
     using (var fixture = new DecodeFixture(4, 16, PrimaryOpCode.Prefix_ED, op).ThrowUnlessZ80())
     {
         fixture.Expected.OpCode(expected);
     }
 }
Exemplo n.º 25
0
 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);
     }
 }
Exemplo n.º 26
0
 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);
     }
 }
Exemplo n.º 27
0
 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);
     }
 }
Exemplo n.º 28
0
        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);
            }
        }
Exemplo n.º 29
0
        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);
            }
        }
Exemplo n.º 30
0
        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);
            }
        }