SVM

From Esolang
Jump to navigation Jump to search

SVM is an esoteric programming language by user:David.werecat that works as a virtual machine with expandable memory.

Data types

Data types are represented as follows: (1 character for data type)(n characters for reference)

Data type Char code Address representation Use
immediate = 8 hex chars is an integer which is specified in the program data
memory * 8 hex chars references a memory location
register ! 2 hex chars references an integer register
stack ^ n/a uses the stack
queue ~ n/a uses the queue
pointer @ n/a uses the pointer variable to reference a memory location
imm. string $ ? chars is a string which is specified in the program data

Instructions

Commands are two letters in length and are represented as follows: (2 character command)(1 space character)(parameters comma separated)(newline).

Command Parameters Description Exceptions
AM 1 expands memory by P1 n/a
RM 1 shrinks memory by P1 Lowest possible memory size is 16
IP 1 increments pointer by P1 n/a
DP 1 decrements pointer by P1 Pointer cannot go below 0x00000000
PV 1 pointer value -> P1 P1 must be a memory pointer, limited by size
M+ 3 P3=P1+P2 Always integers
M- 3 P3=P1-P2 Always integers
M* 3 P3=P1*P2 Always integers
M/ 3 P3=P1/P2 Always integers
M^ 3 P3=P1^P2 Always integers
AD 3 P3=P1 AND P2 Always integers
OR 3 P3=P1 OR P2 Always integers
XR 3 P3=P1 XOR P2 Always integers
NT 2 P2= NOT P1 Always integers
CM 3 mem P1 size P2 -> mem P3 Limited by maximum memory size
ZM 2 zeros mem P1 size P2 Limited by maximum memory size
IC 1 user keycode -> P1 n/a
II 1 typed integer -> P1 n/a
IL 1 typed line -> P1 Doesn't copy if memory overflow
DD 2 displays text P1 size P2 n/a
DI 1 displays integer P1 n/a
DC 0 clears display n/a
## 0 COMMENT n/a
GT 1 jumps to instruction P1 P1 is the logical instruction number
SK 1 jumps to instruction P1 P1 is the offset from the current instruction
IG 4 if P1 P2 P3 then GT P4 P2 is a predefined comparator (integer)
IS 4 if P1 P2 P3 then SK P4 P2 is a predefined comparator (integer)
WT 1 waits P1 miliseconds P1 is an integer
BP 0 beeps n/a
EP 0 ends program n/a

Note: In the examples, whenever a value like P1 appears, it represents a parameter.

Comparators
Value Comparator
0x00000000 =
0x00000001 <>
0x00000002 <
0x00000003 >
0x00000004 <=
0x00000005 >=

External resources