private List <Parameter> GetParameters(Operator oper, string opCode) { List <Parameter> pars = new List <Parameter>(); string modes = ""; if (IntC.GetAddress(Cursor).ToString().Length > 2) { modes = opCode.Substring(0, opCode.Length - 2); } for (int i = 0; i < oper.ParamCount; i++) { pars.Add(new Parameter(IntC.GetAddress(Cursor + i + 1), RelativeBase)); } if (modes != "") { int it = 0; for (int x = modes.Length - 1; x >= 0; x--) { int mode = modes[x]; if (oper.Instruction == Instructions.Equals) { mode = 0; } pars[it].SetMode(modes[x] - '0'); it++; } } return(pars); }
public BigInteger GetResult(IntCode intCode) { if (Mode == Modes.Param) { return(intCode.GetAddress(Value)); } if (Mode == Modes.Immed) { return(Value); } if (Mode == Modes.Rel) { int newAddress = RelativeBase + (int)Value; return(intCode.GetAddress(RelativeBase + Value)); } return(-999); }