Commit | Line | Data |
---|---|---|
f6e94cb2 AT |
1 | # NED - Instruction Reference # |
2 | ||
3 | ## Format A - Word ## | |
4 | ||
5 | +----------+----+-------+ | |
6 | | | 31 | 30..0 | | |
7 | +----------+----+-------+ | |
8 | | WORD_x | 1 | x..x | | |
9 | +----------+----+-------+ | |
10 | ||
11 | **Operation:** TOS = x | |
12 | ||
13 | **Indicators:** None | |
14 | ||
15 | **Description:** Pushes bits 30-0 on to TOS after left shift by one position and | |
16 | padding with zero bit. | |
17 | ||
18 | ## Format C - Syllables ## | |
19 | ||
20 | +----------+---+---+---+---+---+---+ | |
21 | | | 5 | 4 | 3 | 2 | 1 | 0 | | |
22 | +----------+---+---+---+---+---+---+ | |
23 | | IM_x | 1 | x | x | x | x | x | | |
24 | +----------+---+---+---+---+---+---+ | |
25 | ||
26 | **Operation:** TOS = x | |
27 | ||
28 | **Indicators:** None | |
29 | ||
30 | **Description:** Pushes bits 4-0 on to TOS while padding bits 31-5 with zeroes. | |
31 | ||
32 | +----------+---+---+---+---+---+---+ | |
33 | | | 5 | 4 | 3 | 2 | 1 | 0 | | |
34 | +----------+---+---+---+---+---+---+ | |
35 | | LDSP+x | 0 | 1 | 1 | x | x | x | | |
36 | +----------+---+---+---+---+---+---+ | |
37 | ||
38 | **Operation:** TOS = TOS[x] | |
39 | ||
40 | **Indicators:** Sets PSW_N and PSW_Z flags. | |
41 | ||
42 | **Description:** Pushes a copy of the x'th entry on the stack to the TOS. Indexing | |
43 | begins at 0. Thus, LDSP+0 duplicates the top stack entry and | |
44 | LDSP+1 pushes a copy of the NOS to the TOS. | |
45 | ||
46 | +----------+---+---+---+---+---+---+ | |
47 | | | 5 | 4 | 3 | 2 | 1 | 0 | | |
48 | +----------+---+---+---+---+---+---+ | |
49 | | STSP+x | 0 | 1 | 0 | x | x | x | | |
50 | +----------+---+---+---+---+---+---+ | |
51 | ||
52 | **Operation:** TOS[x] = TOS | |
53 | ||
54 | **Indicators:** None | |
55 | ||
56 | **Description:** Pops TOS and stores it x positions deep, overwriting the | |
57 | pre-existing stack entry. Indexing begins at 0 and is counted | |
58 | after popping the TOS. Thus, STSP+0 deletes the NOS, equivalent | |
59 | to SWAP, DROP if such instructions existed. | |
60 | ||
61 | +----------+---+---+---+---+---+---+ | |
62 | | | 5 | 4 | 3 | 2 | 1 | 0 | | |
63 | +----------+---+---+---+---+---+---+ | |
64 | | AND | 0 | 0 | 1 | 0 | 0 | 0 | | |
65 | +----------+---+---+---+---+---+---+ | |
66 | ||
67 | **Operation:** TOS = TOS ^ NOS | |
68 | ||
69 | **Indicators:** Sets PSW_N and PSW_Z flags. | |
70 | ||
71 | **Description:** Pops TOS and NOS, performs bitwise Boolean AND and pushes result | |
72 | to TOS. | |
73 | ||
74 | +----------+---+---+---+---+---+---+ | |
75 | | | 5 | 4 | 3 | 2 | 1 | 0 | | |
76 | +----------+---+---+---+---+---+---+ | |
77 | | OR | 0 | 0 | 1 | 0 | 0 | 1 | | |
78 | +----------+---+---+---+---+---+---+ | |
79 | ||
80 | **Operation:** TOS = TOS V NOS | |
81 | ||
82 | **Indicators:** Sets PSW_N and PSW_Z flags. | |
83 | ||
84 | **Description:** Pops TOS and NOS, performs bitwise Boolean OR and pushes result | |
85 | to TOS. | |
86 | ||
87 | +----------+---+---+---+---+---+---+ | |
88 | | | 5 | 4 | 3 | 2 | 1 | 0 | | |
89 | +----------+---+---+---+---+---+---+ | |
90 | | NOT | 0 | 0 | 1 | 0 | 1 | 0 | | |
91 | +----------+---+---+---+---+---+---+ | |
92 | ||
93 | **Operation:** TOS = ~TOS | |
94 | ||
95 | **Indicators:** Sets PSW_N and PSW_Z flags. | |
96 | ||
97 | **Description:** Pops TOS, performs bitwise Boolean NOT and pushes result to TOS. | |
98 | ||
99 | +----------+---+---+---+---+---+---+ | |
100 | | | 5 | 4 | 3 | 2 | 1 | 0 | | |
101 | +----------+---+---+---+---+---+---+ | |
102 | | XOR | 0 | 0 | 1 | 0 | 1 | 1 | | |
103 | +----------+---+---+---+---+---+---+ | |
104 | ||
105 | **Operation:** TOS = TOS >< NOS | |
106 | ||
107 | **Indicators:** Sets PSW_N and PSW_Z flags. | |
108 | ||
109 | **Description:** Pops TOS and NOS, performs bitwise Boolean XOR and pushes result | |
110 | to TOS. | |
111 | ||
112 | +----------+---+---+---+---+---+---+ | |
113 | | | 5 | 4 | 3 | 2 | 1 | 0 | | |
114 | +----------+---+---+---+---+---+---+ | |
115 | | ADD | 0 | 0 | 1 | 1 | 0 | 0 | | |
116 | +----------+---+---+---+---+---+---+ | |
117 | ||
118 | **Operation:** TOS = TOS + NOS | |
119 | ||
120 | **Indicators:** Sets PSW_N and PSW_Z flags. | |
121 | ||
122 | **Description:** Pops TOS and NOS, performs signed, twos-complement addition and | |
123 | pushes result to TOS. | |
124 | ||
125 | +----------+---+---+---+---+---+---+ | |
126 | | | 5 | 4 | 3 | 2 | 1 | 0 | | |
127 | +----------+---+---+---+---+---+---+ | |
128 | | SWAP | 0 | 0 | 1 | 1 | 0 | 1 | | |
129 | +----------+---+---+---+---+---+---+ | |
130 | ||
131 | **Operation:** TOS = NOS; NOS = TOS | |
132 | ||
133 | **Indicators:** Sets PSW_N and PSW_Z flags. | |
134 | ||
135 | **Description:** Swaps the TOS and NOS entries on the stack. Sets PSW flags based | |
136 | on new TOS entry. | |
137 | ||
138 | +----------+---+---+---+---+---+---+ | |
139 | | | 5 | 4 | 3 | 2 | 1 | 0 | | |
140 | +----------+---+---+---+---+---+---+ | |
141 | | JMP | 0 | 0 | 1 | 1 | 1 | 0 | | |
142 | +----------+---+---+---+---+---+---+ | |
143 | ||
144 | **Operation:** PC = TOS | |
145 | ||
146 | **Indicators:** None | |
147 | ||
148 | **Description:** Pops TOS and loads value in to PC, overwriting existing PC. Resets | |
149 | SC to zero. | |
150 | ||
151 | +----------+---+---+---+---+---+---+ | |
152 | | | 5 | 4 | 3 | 2 | 1 | 0 | | |
153 | +----------+---+---+---+---+---+---+ | |
154 | | MVSTCK | 0 | 0 | 1 | 1 | 1 | 1 | | |
155 | +----------+---+---+---+---+---+---+ | |
156 | ||
157 | **Operation:** SID = TOS | |
158 | ||
159 | **Indicators:** None | |
160 | ||
161 | **Description:** Pops TOS and loads value in to SID, overwriting existing SID. | |
162 | ||
163 | +----------+---+---+---+---+---+---+ | |
164 | | | 5 | 4 | 3 | 2 | 1 | 0 | | |
165 | +----------+---+---+---+---+---+---+ | |
166 | | SHIFT | 0 | 0 | 0 | 1 | 0 | 0 | | |
167 | +----------+---+---+---+---+---+---+ | |
168 | ||
169 | **Operation:** TOS = NOS (<< or >>) TOS | |
170 | ||
171 | **Indicators:** Sets PSW_N and PSW_Z flags. | |
172 | ||
173 | **Description:** Pops TOS and NOS, shifts NOS according to TOS and pushes back to | |
174 | TOS. Direction of shift is left if bit 31 of TOS is set, otherwise | |
175 | shift is right. Magnitude of shift is controlled by bits 30-0 of | |
176 | TOS. Note that this is sign-magnitude, not twos-complement. | |
177 | ||
178 | +----------+---+---+---+---+---+---+ | |
179 | | | 5 | 4 | 3 | 2 | 1 | 0 | | |
180 | +----------+---+---+---+---+---+---+ | |
181 | | CMPSWP | 0 | 0 | 0 | 1 | 0 | 1 | | |
182 | +----------+---+---+---+---+---+---+ | |
183 | ||
184 | **Operation:** | |
185 | ||
186 | **Indicators:** | |
187 | ||
188 | **Description:** Not yet implemented. | |
189 | ||
190 | +----------+---+---+---+---+---+---+ | |
191 | | | 5 | 4 | 3 | 2 | 1 | 0 | | |
192 | +----------+---+---+---+---+---+---+ | |
193 | | TEST | 0 | 0 | 0 | 1 | 1 | 0 | | |
194 | +----------+---+---+---+---+---+---+ | |
195 | ||
196 | **Operation:** None | |
197 | ||
198 | **Indicators:** Sets PSW_N and PSW_Z flags. | |
199 | ||
200 | **Description:** Pops TOS and sets PSW flags accordingly. | |
201 | ||
202 | +----------+---+---+---+---+---+---+ | |
203 | | | 5 | 4 | 3 | 2 | 1 | 0 | | |
204 | +----------+---+---+---+---+---+---+ | |
205 | | BRZ | 0 | 0 | 0 | 1 | 1 | 1 | | |
206 | +----------+---+---+---+---+---+---+ | |
207 | ||
208 | **Operation:** PC = TOS if NOS = 0 | |
209 | ||
210 | **Indicators:** None | |
211 | ||
212 | **Description:** Pops TOS and NOS. If NOS = 0, loads TOS value in to PC. | |
213 | ||
214 | +----------+---+---+---+---+---+---+ | |
215 | | | 5 | 4 | 3 | 2 | 1 | 0 | | |
216 | +----------+---+---+---+---+---+---+ | |
217 | | LOAD | 0 | 0 | 0 | 0 | 1 | 0 | | |
218 | +----------+---+---+---+---+---+---+ | |
219 | ||
220 | **Operation:** TOS = (TOS) | |
221 | ||
222 | **Indicators:** Sets PSW_N and PSW_Z flags. | |
223 | ||
224 | **Description:** Pops TOS, treating it as a pointer in to RAM and pushing the | |
225 | corresponding value from RAM on to TOS. | |
226 | ||
227 | +----------+---+---+---+---+---+---+ | |
228 | | | 5 | 4 | 3 | 2 | 1 | 0 | | |
229 | +----------+---+---+---+---+---+---+ | |
230 | | STORE | 0 | 0 | 0 | 0 | 1 | 1 | | |
231 | +----------+---+---+---+---+---+---+ | |
232 | ||
233 | **Operation:** (TOS) = NOS | |
234 | ||
235 | **Indicators:** None | |
236 | ||
237 | **Description:** Pops TOS and NOS, treating TOS as a pointer in to RAM and storing | |
238 | NOS at that address. | |
239 | ||
240 | +----------+---+---+---+---+---+---+ | |
241 | | | 5 | 4 | 3 | 2 | 1 | 0 | | |
242 | +----------+---+---+---+---+---+---+ | |
243 | | NOP | 0 | 0 | 0 | 0 | 0 | 1 | | |
244 | +----------+---+---+---+---+---+---+ | |
245 | ||
246 | **Operation:** None | |
247 | ||
248 | **Indicators:** None | |
249 | ||
250 | **Description:** Does nothing for one CPU cycle. | |
251 | ||
252 | +----------+---+---+---+---+---+---+ | |
253 | | | 5 | 4 | 3 | 2 | 1 | 0 | | |
254 | +----------+---+---+---+---+---+---+ | |
255 | | HALT | 0 | 0 | 0 | 0 | 0 | 0 | | |
256 | +----------+---+---+---+---+---+---+ | |
257 | ||
258 | **Operation:** None | |
259 | ||
260 | **Indicators:** None | |
261 | ||
262 | **Description:** Halts the CPU. |