예제 #1
0
 public void Run(ComputerMemory computerMemory)
 {
     SetValueParameters(computerMemory);
     Value = ValueParameters[PARAMETER2] * ValueParameters[PARAMETER1];
     computerMemory.Memory[(int)ValueParameters[Length - 1] + (int)RelativeBaseWhenWriteModeIsReliativeBase(computerMemory)] = Value;
     computerMemory.SetNewPointer(Length);
 }
예제 #2
0
 public void Run(ComputerMemory computerMemory)
 {
     SetValueParameters(computerMemory);
     if (ValueParameters[1] == ValueParameters[2])
     {
         computerMemory.Memory[(int)ValueParameters[Length - 1] + (int)RelativeBaseWhenWriteModeIsReliativeBase(computerMemory)] = 1;
     }
     else
     {
         computerMemory.Memory[(int)ValueParameters[Length - 1] + (int)RelativeBaseWhenWriteModeIsReliativeBase(computerMemory)] = 0;
     }
     computerMemory.SetNewPointer(Length);
 }
예제 #3
0
            public void Run(ComputerMemory computerMemory)
            {
                SetValueParameters(computerMemory);
                switch (WriteMode)
                {
                case ParameterMode.Position:
                case ParameterMode.Relative:
                    computerMemory.RelativeBase += computerMemory.Memory[(int)ValueParameters[Length - 1] + (int)RelativeBaseWhenWriteModeIsReliativeBase(computerMemory)];
                    break;

                case ParameterMode.Immediate:
                    computerMemory.RelativeBase += (int)ValueParameters[Length - 1];
                    break;
                }
                computerMemory.SetNewPointer(Length);
            }
예제 #4
0
            public void Run(ComputerMemory computerMemory)
            {
                SetValueParameters(computerMemory);
                if (ValueParameters[1] != 0)
                {
                    switch (WriteMode)
                    {
                    case ParameterMode.Position:
                    case ParameterMode.Relative:
                        computerMemory.SetPointer(computerMemory.Memory[(int)ValueParameters[Length - 1] + (int)RelativeBaseWhenWriteModeIsReliativeBase(computerMemory)]);
                        break;

                    case ParameterMode.Immediate:
                        computerMemory.SetPointer(ValueParameters[Length - 1]);
                        break;
                    }
                }
                else
                {
                    computerMemory.SetNewPointer(Length);
                }
            }
예제 #5
0
 public void Run(ComputerMemory computerMemory)
 {
     SetValueParameters(computerMemory);
     computerMemory.Memory[(int)ValueParameters[Length - 1] + (int)RelativeBaseWhenWriteModeIsReliativeBase(computerMemory)] = computerMemory.ProgramValue;
     computerMemory.SetNewPointer(Length);
 }
예제 #6
0
 public void Run(ComputerMemory computerMemory)
 {
     Exit = true;
     computerMemory.SetNewPointer(Length);
 }