Struct melon::VM [] [src]

pub struct VM {
    pub mem: Vec<SmallUInt>,
    pub return_value: SmallUInt,
    // some fields omitted
}

The state of the VM

Fields

The memory allocated and used by the VM

The return value of the VM

Methods

impl VM
[src]

[src]

Executes the given program using the given system and returns the program's exit status

[src]

Returns the current value of the program counter

[src]

Returns the current value of the stack pointer

[src]

Returns the current value of the base pointer

[src]

Returns the full list of instructions for the current program

[src]

Returns the instruction at the current pc

[src]

Stops execution and shuts down the VM

[src]

Returns the u8 at the given address

[src]

Writes the given u8 to the given address

[src]

Returns the u16 at the given address

[src]

Writes the given u16 to the given address

[src]

Helper method for popping a u8 value off the stack

[src]

Helper method for popping a u16 value off the stack

[src]

Helper method for popping a i8 value off the stack

[src]

Helper method for popping a i16 value off the stack

[src]

Returns two u8 values as (left-hand-side, right-hand-side)

[src]

Returns two u16 values as (left-hand-side, right-hand-side)

[src]

Returns two i8 values as (left-hand-side, right-hand-side)

[src]

Returns two i16 values as (left-hand-side, right-hand-side)

[src]

Pops two values of the given type off the stack, adds them together and pushes the result back on the stack

[src]

Pops two values of the given type off the stack, subtracts the second from the first and pushes the result back on the stack

[src]

Pops two values of the given type off the stack, multiplies them and pushes the result back on the stack

[src]

Pops two values of the given type off the stack, divides the first through the second and pushes the result back on the stack

[src]

Pops two values of the given type off the stack, uses the second one to shift the bits of the first one to the right and pushes the result back onto the stack

[src]

Pops two values of the given type off the stack, uses the second one to shift the bits of the first one to the left and pushes the result back onto the stack

[src]

Pops two values of the given type off the stack, applies a bitwise and to both and pushes the result back onto the stack

[src]

Pops two values of the given type off the stack, applies a bitwise or to both and pushes the result back onto the stack

[src]

Pops two values of the given type off the stack, applies a bitwise or to both and pushes the result back onto the stack

[src]

Applies a bitwise not operation to the top stack value

[src]

Applies a negation on the tio stack value

[src]

Compares the top two values of the stack by applying a subtraction on them and saving the result in the cmp register

[src]

Increments the top stack value

[src]

Decrements the top stack value

[src]

Converts a u8 to a u16

[src]

Converts a u16 to a u8

[src]

Converts a i8 to a i16

[src]

Converts a i16 to a i8

[src]

Pushes the given u8 onto the stack

[src]

Pushes the given u16 onto the stack

[src]

Pushes the given i8 onto the stack

[src]

Pushes the given i16 onto the stack

[src]

Loads the value from the given register and pushes it onto the stack

[src]

Loads the value from the given address and pushes it to the stack

[src]

Like load but takes the address off the stack before storing

[src]

Takes the top value off the stack and stores it at the given address

[src]

Like store but takes the address off the stack before storing

[src]

Duplicates the top stack value and pushes it onto the stack

[src]

Discards the top stack value

[src]

Calls the function at the given address

[src]

Returns from a function call

[src]

Allocates the given number of bytes in the heap

[src]

Undos the last allocation and frees the memory

[src]

Jumps unconditionally in the given direction

[src]

Jumps if the value of the cmp register is not zero, in the given direction

[src]

Jumps if the value of the cmp register is zero, in the given direction

[src]

Jumps if the value of the cmp register is negative, in the given direction

[src]

Jumps if the value of the cmp register is positive, in the given direction

Trait Implementations

impl Default for VM
[src]

[src]

Returns the "default value" for a type. Read more

impl Debug for VM
[src]

[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl Send for VM

impl Sync for VM