| 1 | NED - Instruction Reference |
| 2 | =========================== |
| 3 | |
| 4 | Overview |
| 5 | -------- |
| 6 | |
| 7 | Version: 2 |
| 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 |
| 19 | |
| 20 | Indicators: None |
| 21 | |
| 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 |
| 35 | |
| 36 | Indicators: None |
| 37 | |
| 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] |
| 49 | |
| 50 | Indicators: Sets PSW_N and PSW_Z flags. |
| 51 | |
| 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 |
| 65 | |
| 66 | Indicators: None |
| 67 | |
| 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 |
| 82 | |
| 83 | Indicators: Sets PSW_N and PSW_Z flags. |
| 84 | |
| 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 |
| 97 | |
| 98 | Indicators: Sets PSW_N and PSW_Z flags. |
| 99 | |
| 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 |
| 112 | |
| 113 | Indicators: Sets PSW_N and PSW_Z flags. |
| 114 | |
| 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 |
| 126 | |
| 127 | Indicators: Sets PSW_N and PSW_Z flags. |
| 128 | |
| 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 |
| 141 | |
| 142 | Indicators: Sets PSW_N and PSW_Z flags. |
| 143 | |
| 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 |
| 156 | |
| 157 | Indicators: Sets PSW_N and PSW_Z flags. |
| 158 | |
| 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 |
| 171 | |
| 172 | Indicators: None |
| 173 | |
| 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 |
| 186 | |
| 187 | Indicators: None |
| 188 | |
| 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 |
| 200 | |
| 201 | Indicators: Sets PSW_N and PSW_Z flags. |
| 202 | |
| 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: |
| 217 | |
| 218 | Indicators: |
| 219 | |
| 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 |
| 231 | |
| 232 | Indicators: Sets PSW_N and PSW_Z flags. |
| 233 | |
| 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 | |
| 244 | Operation: PC = TOS if NOS = 0 |
| 245 | |
| 246 | Indicators: None |
| 247 | |
| 248 | Description: Pops TOS and NOS. If NOS = 0, loads TOS value in to PC. |
| 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) |
| 259 | |
| 260 | Indicators: Sets PSW_N and PSW_Z flags. |
| 261 | |
| 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 |
| 274 | |
| 275 | Indicators: None |
| 276 | |
| 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 |
| 289 | |
| 290 | Indicators: None |
| 291 | |
| 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 |
| 303 | |
| 304 | Indicators: None |
| 305 | |
| 306 | Description: Halts the CPU. |