VM18 Instructions

User Manual:

Open the PDF directly: View PDF 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.

Navigation menu