예제 #1
0
 private static void MoveImmediate(Emulator emulator, Register?register, byte value)
 {
     if (register.HasValue)
     {
         emulator[register.Value] = value;
     }
     else
     {
         emulator[emulator.Get16BitValue(Register.H, Register.L)] = value;
     }
 }
예제 #2
0
        private static void IncrementSourceBy(Emulator emulator, Register?register, int increment)
        {
            var memoryAddress = emulator.Get16BitValue(Register.H, Register.L);
            var current       = register.HasValue ? emulator[register.Value] : emulator[memoryAddress];

            emulator[Flag.AC] = current.AuxiliaryCarryFlag((byte)(increment < 0 ? (-increment) : increment), increment > 0);
            current           = (byte)(current + increment);
            emulator[Flag.P]  = current.ParityFlag();
            emulator[Flag.Z]  = current == 0;
            emulator[Flag.S]  = current.SignFlag();

            if (register.HasValue)
            {
                emulator[register.Value] = current;
            }
            else
            {
                emulator[memoryAddress] = current;
            }
        }