NED - Instruction Reference

Format A - Word

+----------+----+-------+
|          | 31 | 30..0 |
+----------+----+-------+
|   WORD_x |  1 |  x..x |
+----------+----+-------+

Operation: TOS = x

Indicators: None

Description: Pushes bits 30-0 on to TOS after left shift by one position and padding with zero bit.

Format C - Syllables

+----------+---+---+---+---+---+---+
|          | 5 | 4 | 3 | 2 | 1 | 0 |
+----------+---+---+---+---+---+---+
|     IM_x | 1 | x | x | x | x | x |
+----------+---+---+---+---+---+---+

Operation: TOS = x

Indicators: None

Description: Pushes bits 4-0 on to TOS while padding bits 31-5 with zeroes.

+----------+---+---+---+---+---+---+
|          | 5 | 4 | 3 | 2 | 1 | 0 |
+----------+---+---+---+---+---+---+
|   LDSP+x | 0 | 1 | 1 | x | x | x |
+----------+---+---+---+---+---+---+

Operation: TOS = TOS[x]

Indicators: Sets PSW_N and PSW_Z flags.

Description: Pushes a copy of the x'th entry on the stack to the TOS. Indexing begins at 0. Thus, LDSP+0 duplicates the top stack entry and LDSP+1 pushes a copy of the NOS to the TOS.

+----------+---+---+---+---+---+---+
|          | 5 | 4 | 3 | 2 | 1 | 0 |
+----------+---+---+---+---+---+---+
|   STSP+x | 0 | 1 | 0 | x | x | x |
+----------+---+---+---+---+---+---+

Operation: TOS[x] = TOS

Indicators: None

Description: Pops TOS and stores it x positions deep, overwriting the pre-existing stack entry. Indexing begins at 0 and is counted after popping the TOS. Thus, STSP+0 deletes the NOS, equivalent to SWAP, DROP if such instructions existed.

+----------+---+---+---+---+---+---+
|          | 5 | 4 | 3 | 2 | 1 | 0 |
+----------+---+---+---+---+---+---+
|      AND | 0 | 0 | 1 | 0 | 0 | 0 |
+----------+---+---+---+---+---+---+

Operation: TOS = TOS ^ NOS

Indicators: Sets PSW_N and PSW_Z flags.

Description: Pops TOS and NOS, performs bitwise Boolean AND and pushes result to TOS.

+----------+---+---+---+---+---+---+
|          | 5 | 4 | 3 | 2 | 1 | 0 |
+----------+---+---+---+---+---+---+
|       OR | 0 | 0 | 1 | 0 | 0 | 1 |
+----------+---+---+---+---+---+---+

Operation: TOS = TOS V NOS

Indicators: Sets PSW_N and PSW_Z flags.

Description: Pops TOS and NOS, performs bitwise Boolean OR and pushes result to TOS.

+----------+---+---+---+---+---+---+
|          | 5 | 4 | 3 | 2 | 1 | 0 |
+----------+---+---+---+---+---+---+
|      NOT | 0 | 0 | 1 | 0 | 1 | 0 |
+----------+---+---+---+---+---+---+

Operation: TOS = ~TOS

Indicators: Sets PSW_N and PSW_Z flags.

Description: Pops TOS, performs bitwise Boolean NOT and pushes result to TOS.

+----------+---+---+---+---+---+---+
|          | 5 | 4 | 3 | 2 | 1 | 0 |
+----------+---+---+---+---+---+---+
|      XOR | 0 | 0 | 1 | 0 | 1 | 1 |
+----------+---+---+---+---+---+---+

Operation: TOS = TOS >< NOS

Indicators: Sets PSW_N and PSW_Z flags.

Description: Pops TOS and NOS, performs bitwise Boolean XOR and pushes result to TOS.

+----------+---+---+---+---+---+---+
|          | 5 | 4 | 3 | 2 | 1 | 0 |
+----------+---+---+---+---+---+---+
|      ADD | 0 | 0 | 1 | 1 | 0 | 0 |
+----------+---+---+---+---+---+---+

Operation: TOS = TOS + NOS

Indicators: Sets PSW_N and PSW_Z flags.

Description: Pops TOS and NOS, performs signed, twos-complement addition and pushes result to TOS.

+----------+---+---+---+---+---+---+
|          | 5 | 4 | 3 | 2 | 1 | 0 |
+----------+---+---+---+---+---+---+
|     SWAP | 0 | 0 | 1 | 1 | 0 | 1 |
+----------+---+---+---+---+---+---+

Operation: TOS = NOS; NOS = TOS

Indicators: Sets PSW_N and PSW_Z flags.

Description: Swaps the TOS and NOS entries on the stack. Sets PSW flags based on new TOS entry.

+----------+---+---+---+---+---+---+
|          | 5 | 4 | 3 | 2 | 1 | 0 |
+----------+---+---+---+---+---+---+
|      JMP | 0 | 0 | 1 | 1 | 1 | 0 |
+----------+---+---+---+---+---+---+

Operation: PC = TOS

Indicators: None

Description: Pops TOS and loads value in to PC, overwriting existing PC. Resets SC to zero.

+----------+---+---+---+---+---+---+
|          | 5 | 4 | 3 | 2 | 1 | 0 |
+----------+---+---+---+---+---+---+
|   MVSTCK | 0 | 0 | 1 | 1 | 1 | 1 |
+----------+---+---+---+---+---+---+

Operation: SID = TOS

Indicators: None

Description: Pops TOS and loads value in to SID, overwriting existing SID.

+----------+---+---+---+---+---+---+
|          | 5 | 4 | 3 | 2 | 1 | 0 |
+----------+---+---+---+---+---+---+
|    SHIFT | 0 | 0 | 0 | 1 | 0 | 0 |
+----------+---+---+---+---+---+---+

Operation: TOS = NOS (<< or >>) TOS

Indicators: Sets PSW_N and PSW_Z flags.

Description: Pops TOS and NOS, shifts NOS according to TOS and pushes back to TOS. Direction of shift is left if bit 31 of TOS is set, otherwise shift is right. Magnitude of shift is controlled by bits 30-0 of TOS. Note that this is sign-magnitude, not twos-complement.

+----------+---+---+---+---+---+---+
|          | 5 | 4 | 3 | 2 | 1 | 0 |
+----------+---+---+---+---+---+---+
|   CMPSWP | 0 | 0 | 0 | 1 | 0 | 1 |
+----------+---+---+---+---+---+---+

Operation:

Indicators:

Description: Not yet implemented.

+----------+---+---+---+---+---+---+
|          | 5 | 4 | 3 | 2 | 1 | 0 |
+----------+---+---+---+---+---+---+
|     TEST | 0 | 0 | 0 | 1 | 1 | 0 |
+----------+---+---+---+---+---+---+

Operation: None

Indicators: Sets PSW_N and PSW_Z flags.

Description: Pops TOS and sets PSW flags accordingly.

+----------+---+---+---+---+---+---+
|          | 5 | 4 | 3 | 2 | 1 | 0 |
+----------+---+---+---+---+---+---+
|      BRZ | 0 | 0 | 0 | 1 | 1 | 1 |
+----------+---+---+---+---+---+---+

Operation: PC = TOS if NOS = 0

Indicators: None

Description: Pops TOS and NOS. If NOS = 0, loads TOS value in to PC.

+----------+---+---+---+---+---+---+
|          | 5 | 4 | 3 | 2 | 1 | 0 |
+----------+---+---+---+---+---+---+
|     LOAD | 0 | 0 | 0 | 0 | 1 | 0 |
+----------+---+---+---+---+---+---+

Operation: TOS = (TOS)

Indicators: Sets PSW_N and PSW_Z flags.

Description: Pops TOS, treating it as a pointer in to RAM and pushing the corresponding value from RAM on to TOS.

+----------+---+---+---+---+---+---+
|          | 5 | 4 | 3 | 2 | 1 | 0 |
+----------+---+---+---+---+---+---+
|    STORE | 0 | 0 | 0 | 0 | 1 | 1 |
+----------+---+---+---+---+---+---+

Operation: (TOS) = NOS

Indicators: None

Description: Pops TOS and NOS, treating TOS as a pointer in to RAM and storing NOS at that address.

+----------+---+---+---+---+---+---+
|          | 5 | 4 | 3 | 2 | 1 | 0 |
+----------+---+---+---+---+---+---+
|      NOP | 0 | 0 | 0 | 0 | 0 | 1 |
+----------+---+---+---+---+---+---+

Operation: None

Indicators: None

Description: Does nothing for one CPU cycle.

+----------+---+---+---+---+---+---+
|          | 5 | 4 | 3 | 2 | 1 | 0 |
+----------+---+---+---+---+---+---+
|     HALT | 0 | 0 | 0 | 0 | 0 | 0 |
+----------+---+---+---+---+---+---+

Operation: None

Indicators: None

Description: Halts the CPU.