VM18 Instructions
User Manual:
Open the PDF directly: View PDF .
Page Count: 4
VM-18 Instruction Set
Format โINSTRUCTION [๐๐ซ๐ ๐] [๐๐ซ๐ ๐] โฆ [๐๐ซ๐ ๐]โ
where [arg๐] is pushed onto the stack before [arg๐+1] and [arg๐]
represents a single byte.
opcode: 0x01
PUSH_BYTE [byte]
Pushes next byte found in the instruction stream onto the stack
opcode: 0x02
HALT
Stops execution of instruction stream
opcode: 0x03
ADD_BYTE [๐๐ฎ๐ฆ๐๐๐ซ๐] [๐๐ฎ๐ฆ๐๐๐ซ๐]
Pushes the result of Number1 + Number2 onto stack
opcode: 0x04
SUB_BYTE [๐๐ฎ๐ฆ๐๐๐ซ๐] [๐๐ฎ๐ฆ๐๐๐ซ๐]
Pushes the result of Number1 - Number2 onto stack
opcode: 0x05
MUL_BYTE [๐๐ฎ๐ฆ๐๐๐ซ๐] [๐๐ฎ๐ฆ๐๐๐ซ๐]
Pushes the result of Number1โ Number2 onto stack
opcode: 0x06
DIV_BYTE [๐๐ฎ๐ฆ๐๐๐ซ๐] [๐๐ฎ๐ฆ๐๐๐ซ๐]
Pushes the result of Number1รท Number2 onto stack
opcode: 0x07
MOD_BYTE [๐๐ฎ๐ฆ๐๐๐ซ๐] [๐๐ฎ๐ฆ๐๐๐ซ๐]
Pushes the result of Number1 modulo Number2 onto stack
opcode: 0x08
LOAD_BYTE [๐๐๐๐๐๐๐๐] [๐๐๐๐๐๐๐๐] โฆ [๐๐๐๐๐๐๐๐]
Fetches byte stored at address, ADDRESS1 being MSB, and pushes onto
stack. Address size is determined by the VM implementation.
opcode: 0x09
STORE_BYTE [BYTE] [๐๐๐๐๐๐๐๐] [๐๐๐๐๐๐๐๐] โฆ [๐๐๐๐๐๐๐๐]
Stores byte at address, ADDRESS1 being MSB. Address size is determined
by the VM implementation.
opcode: 0x0A
SEND_INTERFACE [I] [๐๐] [๐๐] โฆ [๐๐] [๐๐] [๐๐] โฆ [๐๐]
Sends N bytes starting at address A to interface number I. A1 and N1
are the MSBs, and ๐ is the number of bytes in the implementationโs
memory address.
opcode: 0x0B
RECV_INTERFACE [I] [๐๐] [๐๐] โฆ [๐๐] [๐๐] [๐๐] โฆ [๐๐]
Receives N bytes to address A from interface number I. A1 and N1 are
the MSBs, and ๐ is the number of bytes in the implementationโs memory
address.
opcode: 0x0C
AND_BYTE [๐๐ฎ๐ฆ๐๐๐ซ๐] [๐๐ฎ๐ฆ๐๐๐ซ๐]
Pushes result of performing the bitwise AND on Number1 and Number2.
opcode: 0x0D
OR_BYTE [๐๐ฎ๐ฆ๐๐๐ซ๐] [๐๐ฎ๐ฆ๐๐๐ซ๐]
Pushes result of performing the bitwise OR on Number1 and Number2.
opcode: 0x0E
NOT_BYTE [๐๐ฎ๐ฆ๐๐๐ซ]
Pushes result of performing the bitwise NOT on Number.
opcode: 0x0F
XOR_BYTE [๐๐ฎ๐ฆ๐๐๐ซ๐] [๐๐ฎ๐ฆ๐๐๐ซ๐]
Pushes result of performing the bitwise XOR on Number1 and Number2.
opcode: 0x10
JUMPG [๐๐ฎ๐ฆ๐๐๐ซ๐] [๐๐ฎ๐ฆ๐๐๐ซ๐] [๐๐] [๐๐] โฆ [๐๐]
If Number1 > Number2, move instruction pointer to instruction address
specified by I๐ where ๐ is the implementationโs address size.
opcode: 0x11
JUMPE [๐๐ฎ๐ฆ๐๐๐ซ๐] [๐๐ฎ๐ฆ๐๐๐ซ๐] [๐๐] [๐๐] โฆ [๐๐]
If Number1 == Number2, move instruction pointer to instruction address
specified by I๐ where ๐ is the implementationโs address size.
opcode: 0x12
JUMPL [๐๐ฎ๐ฆ๐๐๐ซ๐] [๐๐ฎ๐ฆ๐๐๐ซ๐] [๐๐] [๐๐] โฆ [๐๐]
If Number1 < Number2, move instruction pointer to instruction address
specified by I๐ where ๐ is the implementationโs address size.
opcode: 0x13
JUMPNE [๐๐ฎ๐ฆ๐๐๐ซ๐] [๐๐ฎ๐ฆ๐๐๐ซ๐] [๐๐] [๐๐] โฆ [๐๐]
If Number1 != Number2, move instruction pointer to instruction address
specified by I๐ where ๐ is the implementationโs address size.
opcode: 0x14
JUMPLE [๐๐ฎ๐ฆ๐๐๐ซ๐] [๐๐ฎ๐ฆ๐๐๐ซ๐] [๐๐] [๐๐] โฆ [๐๐]
If Number1 <= Number2, move instruction pointer to instruction address
specified by I๐ where ๐ is the implementationโs address size.
opcode: 0x15
JUMPGE [๐๐ฎ๐ฆ๐๐๐ซ๐] [๐๐ฎ๐ฆ๐๐๐ซ๐] [๐๐] [๐๐] โฆ [๐๐]
If Number1 >= Number2, move instruction pointer to instruction address
specified by I๐ where ๐ is the implementationโs address size.
opcode: 0x16
JUMP [๐๐] [๐๐] โฆ [๐๐]
Move instruction pointer to instruction address specified by I๐ where ๐
is the implementationโs address size.