/// <summary> /// Constructs a memory stick, with the specified size /// </summary> /// <param name="size">The size of the memory</param> public Memory(int size) { Registers = new Register[size]; foreach (var i in Enumerable.Range(0, size)) { Registers[i] = new Register(RegisterAddress.FromInt(i), DEFAULT_REGISTER_VALUE); } }
/// <summary> /// Gets the return value of the program - The return value is always the last memory cell. /// </summary> /// <returns>The return value of the program</returns> public BigInteger GetReturnValue() { return(Machine.Memory.Read(RegisterAddress.FromInt(Machine.Memory.Size - 1))); }