Show / Hide Table of Contents

Enum OpCode

Represents the bytecode operation codes (opcodes) for the virtual machine.

Namespace: VM.Core.Instructions
Assembly: VM.dll
Syntax
public enum OpCode : byte
Remarks

Each opcode corresponds to a specific operation in the VM's instruction set. The numeric values are used in the bytecode representation of programs.

Fields

Name Description
ADD

Adds the top two values

AND

Performs logical AND on top two values

CALL

Calls a function at specified address

CAST

Casts value to different type

CMP

Compares top two values (-1, 0, or 1 result)

CONCAT

Concatenates two strings

DIV

Divides the second value by the top value

DUP

Duplicates the top stack value

EQ

Checks if top two values are equal

FSAPPEND

Appends content to file

FSDELETE

Deletes a file

FSEXISTS

Checks if file exists

FSREAD

Reads content from file

FSWRITE

Writes content to file

GETINDEX

Gets element at index from array

GLOAD

Loads a value from a global variable

GSTORE

Stores a value in a global variable

HALT

Stops program execution

INPUT

Reads input from console

ISNUM

Checks if value is numeric

ISSTR

Checks if value is a string

JMP

Unconditional jump

JNZ

Jumps if top value is not zero

JZ

Jumps if top value is zero

LOAD

Loads a value from a local variable

MOD

Computes modulus of the second value by the top value

MUL

Multiplies the top two values

NEG

Negates the top value

NEQ

Checks if top two values are not equal

NEWARRAY

Creates a new array

NOT

Performs logical NOT on top value

OR

Performs logical OR on top two values

OVER

Copies the second stack value to the top

POP

Removes the top value from the stack

PRINT

Prints the top stack value

PUSH

Pushes a value onto the stack

PUSHS

Pushes a string constant onto the stack

RET

Returns from a function call

SETINDEX

Sets element at index in array

STORE

Stores a value in a local variable

STRCHR

Gets character at index from string

STRLEN

Gets length of a string

STRORD

Gets ASCII code of character

STRVAL

Converts value to string

SUB

Subtracts the top value from the second value

SUBSTR

Extracts substring from string

SWAP

Swaps the top two stack values

TYPE

Gets type name of value

In this article
Back to top Generated by DocFX