-
Notifications
You must be signed in to change notification settings - Fork 0
/
instructions.zig
142 lines (141 loc) · 3.27 KB
/
instructions.zig
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
const Instruction = struct {
mnemonic: [4]u8,
argument: enum {
none,
integer,
register,
},
description: []const u8,
};
pub const list = [_]Instruction{
.{
.mnemonic = "ADDI".*,
.argument = .integer,
.description = "ADD INTEGER",
},
.{
.mnemonic = "CLRS".*,
.argument = .integer,
.description = "CLEAR SCREEN",
},
.{
.mnemonic = "CPTO".*,
.argument = .register,
.description = "COPY REGISTER VALUE TO REGISTER",
},
.{
.mnemonic = "DECR".*,
.argument = .register,
.description = "DECREMENT",
},
.{
.mnemonic = "DDEC".*,
.argument = .none,
.description = "DISABLE DECIMAL MODE",
},
.{
.mnemonic = "DRAW".*,
.argument = .integer,
.description = "DRAW PIXELS",
},
.{
.mnemonic = "EDEC".*,
.argument = .none,
.description = "ENABLE DECIMAL MODE",
},
.{
.mnemonic = "GOTO".*,
.argument = .integer,
.description = "JUMP TO ADDRESS",
},
.{
.mnemonic = "HALT".*,
.argument = .none,
.description = "HALT EXECUTION",
},
.{
.mnemonic = "IFEQ".*,
.argument = .integer,
.description = "IF EQUAL, EXECUTE NEXT INSTRUCTION; OTHERWISE SKIP",
},
.{
.mnemonic = "IFNE".*,
.argument = .integer,
.description = "IF NOT EQUAL, EXECUTE NEXT INSTRUCTION; OTHERWISE SKIP",
},
.{
.mnemonic = "IFPP".*,
.argument = .none,
.description = "IF POINTER PRESSED, EXECUTE NEXT INSTRUCTION; OTHERWISE SKIP",
},
.{
.mnemonic = "INCR".*,
.argument = .register,
.description = "INCREMENT",
},
.{
.mnemonic = "LDPP".*,
.argument = .none,
.description = "LOAD POINTER POSITION INTO X AND Y",
},
.{
.mnemonic = "LDKK".*,
.argument = .none,
.description = "LOAD KEYBOARD KEY INTO W",
},
.{
.mnemonic = "LOAD".*,
.argument = .integer,
.description = "LOAD",
},
.{
.mnemonic = "PRNT".*,
.argument = .none,
.description = "PRINT W AS CHARACTER TO (X, Y)",
},
.{
.mnemonic = "RSTR".*,
.argument = .register,
.description = "POP FROM STACK",
},
.{
.mnemonic = "SAVE".*,
.argument = .register,
.description = "PUSH TO STACK",
},
.{
.mnemonic = "SEXH".*,
.argument = .integer,
.description = "SET EXCEPTION HANDLER",
},
.{
.mnemonic = "SCLR".*,
.argument = .integer,
.description = "SET COLOR",
},
.{
.mnemonic = "SETW".*,
.argument = .integer,
.description = "SET W",
},
.{
.mnemonic = "SETX".*,
.argument = .integer,
.description = "SET X",
},
.{
.mnemonic = "SETY".*,
.argument = .integer,
.description = "SET Y",
},
.{
.mnemonic = "TRGT".*,
.argument = .register,
.description = "SET OPERATION TARGET",
},
.{
.mnemonic = "WAIT".*,
.argument = .integer,
.description = "DO NOTHING FOR AN AMOUNT OF MILLISECONDS",
},
};