AngelScript
Byte code instructions

This page gives a brief description of each of the byte code instructions that the virtual machine has.

Object management

Perform a bitwise copy of a memory buffer to another

Push the address and length of a string on the stack

Allocate the memory for an object and setup the VM to execute the constructor

Release the memory of an object or list buffer

Move the address in an object variable to the object register. The address in the variable is then cleared.

Move the address from the object register to an object variable. The address in the object register is then cleared.

Copy the object handle from one address to another. The reference count of the object is updated to reflect the copy.

Copy the object handle on stack to a handle in a variable. The reference count of the object is updated to reflect the copy.

Push the pointer of an object type on the stack

Push the type id on the stack

Pop an address to a script object from the stack. If the desired cast can be made store the address in the object register.

Push the function pointer on the stack

Load the address to a property of the object into the value register. Substitutes the sequence PshV4/8, ADDSi, PopRPtr.

Load the address to a property of a value object into the value register. Substitutes the sequence PSF, ADDSi, PopRPtr.

Math instructions

Negate the value in the variable. The original value is overwritten.

Perform the operation with the value of two variables and store the result in a third variable.

Perform the operation with a constant value and the value of the variable. The original value is overwritten.

Bitwise instructions

Perform a boolean not operation on the value in the variable. The original value is overwritten.

Perform a bitwise complement on the value in the variable. The original value is overwritten.

Perform the operation with the value of two variables and store the result in a third variable.

Comparisons

Compare the value of two variables and store the result in the value register.

Compare the value of a variable with a constant and store the result in the value register.

Test the value in the value register. Update the value register according to the result.

Type conversions

Convert the value in the variable. The original value is overwritten.

Convert the value of a variable and store the result in another variable.

Increment and decrement

Increment or decrement the value pointed to by the address in the value register.

Increment or decrement the value in the variable.

Flow control

Setup the VM to begin execution of the other script function

Setup the VM to return to the calling function

Make an unconditional jump to a relative position

Make a jump to a relative position depending on the value in the value register

Call an application registered function

Save the state and suspend execution, then return control to the application

Give control of execution to the JIT compiled function

Stack and data management

Push a constant value on the stack.

Push the stack frame pointer on the stack.

Swap the top values on the stack.

Dereference top pointer on stack. Raises exception if pointer is null.

Add an offset to the top address on the stack. Raises exception if address is null.

Push the value of a variable on the stack.

Initialize the value of a variable with a constant.

Copy the value of one variable to another.

Validate that an expected pointer is not null.

Push the variable index with the size of a pointer on the stack.

Replace a variable index on the stack with an address.

Pop and discard an address from the stack.

Pop or push an address to or from the value register.

Copy a value between value register and a variable.

Copy a value from a variable to the address held in the value register

Copy a value from the address held in the value register to a variable

Load the address of the variable into the value register

Clear the upper bytes of the value register

Global variables

Push the value of a global variable on the stack

Load the address of a global variable into the value register

Load the address of a global variable into the value register and copy the value of the global variable to local variable

Copy a value between local variable and global variable.

Push the address of the global variable on the stack.

Initialize the variable of a global variable with a constant.

Initialization list management

Allocates the memory for the initialization list buffer

Sets the number of elements that will be repeated afterwards

Sets the type of the next element

Pushes the address of the list element on the stack