-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.gvm
More file actions
54 lines (45 loc) · 744 Bytes
/
Copy pathtest.gvm
File metadata and controls
54 lines (45 loc) · 744 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# Test Program for functions of the GritVM
# Requires 1 memory location with some int
# Check memory, clear the accumulator
CHECKMEM 1
CLEAR
# Make the number 35
ADDCONST 50
SUBCONST 5
MULCONST 7
DIVCONST 9
# Make that 35 around the 10 in 0, resulting in [35, N, 35]
INSERT 0
INSERT 2
# Add 4 to our 0 memory location, insert 3 into location 3, and
ADDCONST 4
SET 0
CLEAR
ADDCONST 3
INSERT 3
# Use that 3 and do some maths
AT 0
DIVMEM 3
ADDMEM 0
SUBMEM 2
MULMEM 3
# Erase location 3 and set location 2 to 5
ERASE 3
CLEAR
ADDCONST 5
SET 2
# While Location 2 is not zero, times location 2 by 2
AT 2
SUBCONST 1
SET 2
JUMPZERO 5# TO THE END
AT 0
MULCONST 2
SET 0
JUMPREL -7
# This jump should not happen
JUMPNZERO 2
HALT
SET 0
SET 1
SET 2