예제 #1
0
        public void Execute(Instruction instruction, ICpu cpu, IMmu mmu)
        {
            var n = cpu.ReadImmediateN();

            cpu.Registers.F.ZeroFlag     = cpu.Registers.A.Value == n;
            cpu.Registers.F.CarryFlag    = cpu.Registers.A.Value < n;
            cpu.Registers.F.SubtractFlag = true;

            // TODO: ???
            cpu.Registers.F.HalfCarryFlag = (((cpu.Registers.A.Value & 0xF) - (n & 0xF)) & 0x10) == 0x10;
        }
예제 #2
0
        public void Execute(Instruction instruction, ICpu cpu, IMmu mmu)
        {
            if (cpu.Registers.F.ZeroFlag)
            {
                IncrementProgramCounter = true;
                return;
            }

            var b = (sbyte)cpu.ReadImmediateN();

            cpu.Registers.PC.Value += (ushort)b;
            IncrementProgramCounter = true;
        }
예제 #3
0
        public void Execute(Instruction instruction, ICpu cpu, IMmu mmu)
        {
            var n             = cpu.ReadImmediateN();
            var originalValue = cpu.Registers.A.Value;

            cpu.Registers.A.Value = (byte)(cpu.Registers.A.Value + n);

            // Flags
            cpu.Registers.F.SubtractFlag  = false;
            cpu.Registers.F.CarryFlag     = originalValue + n > byte.MaxValue;
            cpu.Registers.F.ZeroFlag      = cpu.Registers.A.Value == 0;
            cpu.Registers.F.HalfCarryFlag = (((originalValue & 0xF) + (n & 0xF)) & 0x10) == 0x10;
        }
예제 #4
0
        public void Execute(Instruction instruction, ICpu cpu, IMmu mmu)
        {
            var b = (sbyte)cpu.ReadImmediateN();

            cpu.Registers.PC.Value += (ushort)b;
        }
예제 #5
0
 public void Execute(Instruction instruction, ICpu cpu, IMmu mmu)
 {
     cpu.Registers.L.Value = cpu.ReadImmediateN();
 }
예제 #6
0
        public void Execute(Instruction instruction, ICpu cpu, IMmu mmu)
        {
            var n = cpu.ReadImmediateN();

            cpu.Registers.A.Value = mmu.ReadByte((ushort)(0xFF00 + n));
        }