/// <summary> /// Returns the virtual machine stac capacity. /// </summary> /// /// <returns>The stack capacity.</returns> public byte GetStackCapacity() { return(PInvoke.Sal8StackCapacity(ref stack)); }
/// <summary> /// Returns the value of a stack slot. /// </summary> /// /// <param name="index">The slot index.</param> /// <returns>The value stored in the slot.</returns> public byte GetStackValue(byte index) { return(PInvoke.Sal8StackGet(ref stack, index)); }
/// <summary> /// Returns the value of a register. /// </summary> /// /// <param name="index">The register index.</param> /// /// <returns>The value stored in the register.</returns> public byte GetRegisterValue(byte index) { return(PInvoke.Sal8VmAccessRegister(this, index)); }
/// <summary> /// Returns the virtual machine stack size. /// </summary> /// /// <returns>The stack size.</returns> public byte GetStackSize() { return(PInvoke.Sal8StackSize(ref stack)); }
/// <summary> /// Gets the total number of instructions from the loaded cluster. /// </summary> /// /// <returns>The total number of loaded instructions.</returns> public uint GetInstructionCount() { return(PInvoke.Sal8ClusterInstructionCount(ref cluster)); }
public uint GetCurrentInstructionIndex() { return(PInvoke.Sal8VmCurrentInstructionIndex(this)); }
/// <summary> /// Loads a cluster into the virtual machine. /// </summary> /// /// <param name="cluster">The cluster to load.</param> public void Load(Cluster cluster) { PInvoke.Sal8VmLoad(this, cluster); }
/// <summary> /// Whether or not the virtual machine finished executing all of the instructions from the cluster. /// </summary> /// /// <returns>True, if there is nothing left to execute. False otherwise.</returns> public bool Finished() { return(PInvoke.Sal8VmFinished(this) != 0); }
/// <summary> /// Redirects the STDERR stream to a handler. /// </summary> /// /// <param name="handler">The error handler.</param> public void RedirectErr(IO.OutHandler handler) { PInvoke.Sal8IoRedirectErr(ref io, handler); }
/// <summary> /// Redirects the STDIN stream to a handler. The handler should return either 0-255 for valid numbers, or >255 for errors/end-of-input. /// </summary> /// /// <param name="handler">The input handler.</param> public void RedirectIn(IO.InHandler handler) { PInvoke.Sal8IoRedirectIn(ref io, handler); }
/// <summary> /// Initializes a new instance of the VM class. /// </summary> /// /// <param name="registerCount">The total number of available registers.</param> /// <param name="stackCapacity">The stack capacity.</param> public VM(byte registerCount, byte stackCapacity) { PInvoke.Sal8VmInit(this, registerCount, stackCapacity); }
/// <summary> /// Initializes a new instance of the Compiler class. /// </summary> /// /// <param name="registerCount">The total number of available registers.</param> public Compiler(byte registerCount) { PInvoke.Sal8CompilerInit(this, registerCount); }
/// <summary> /// Destroys the cluster and frees any memory used by it. /// </summary> public void Destroy() { PInvoke.Sal8ClusterDelete(ref this); }