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