Example #1
0
 protected override void OnLastCycleLastM()
 {
     // perform jump
     if (IsConditionMet())
     {
         var d = (sbyte)InstructionM2.Data.Value;
         Registers.PC = Alu.Add(Registers.PC, d);
     }
 }
        protected override void OnClockHigh()
        {
            if (ExecutionEngine.Cycles.IsLastCycle)
            {
                Cpu.Registers.PC = Alu.Add(Cpu.Registers.PC, _deltaPC);
            }

            base.OnClockHigh();
        }
Example #3
0
        private ushort GetAddress()
        {
            ushort address;

            if (ExecutionEngine.Opcode.Definition.IsIX)
            {
                address = Registers.IX;
            }
            else if (ExecutionEngine.Opcode.Definition.IsIY)
            {
                address = Registers.IY;
            }
            else
            {
                throw Errors.AssignedToIllegalOpcode();
            }

            return(Alu.Add(address, (sbyte)InstructionM2.Data.Value));
        }
        protected ushort GetHLOrIXIY(bool useOffset = true)
        {
            if (ExecutionEngine.Opcode.Definition.IsIX)
            {
                if (ExecutionEngine.Opcode.Definition.d && useOffset)
                {
                    ThrowIfNoParametersFound();
                    return(Alu.Add(Registers.IX, (sbyte)ExecutionEngine.MultiCycleOpcode.GetParameter(0).Value));
                }
                return(Registers.IX);
            }
            if (ExecutionEngine.Opcode.Definition.IsIY)
            {
                if (ExecutionEngine.Opcode.Definition.d && useOffset)
                {
                    ThrowIfNoParametersFound();
                    return(Alu.Add(Registers.IY, (sbyte)ExecutionEngine.MultiCycleOpcode.GetParameter(0).Value));
                }
                return(Registers.IY);
            }

            return(Registers.HL);
        }
Example #5
0
 public void When_ByteHalfOverFlow_Expect_HalfCarryFlagSet()
 {
     registers.Reset();
     alu.Add((byte)15, (byte)1);
     Assert.True(registers.AreFlagsSet(RegisterFlags.H));
 }