MicroArchitecture
Macro Machine Instructions
At the processor achitecture level, only a part of the Level 1 of Tanenbaum's Machine is visible.
It is a 16 bit general purpose processor with 4K 16 bit memory. System programmers have access to
three registers, the program counter, PC, the accumulator, AC, and the stack pointer, SP.
There are 23 machine instructions, Macro Instructions at this level:
| Machine Code | OP Code | Instruction | Operation |
| 0000xxxxxxxxxxxx | LODD | Load direct | AC <- m[xxxxxxxxxxxx] |
| 0001xxxxxxxxxxxx | STOD | Store direct | m[xxxxxxxxxxxx] <- AC |
| 0010xxxxxxxxxxxx | ADDD | Add direct | AC <- AC + m[xxxxxxxxxxxx] |
| 0011xxxxxxxxxxxx | SUBD | Subtract direct | AC <- AC - m[xxxxxxxxxxxx] |
| 0100xxxxxxxxxxxx | JPOS | Jump positive | if AC>=0 then PC<-xxxxxxxxxxxx |
| 0101xxxxxxxxxxxx | JZER | Jump zero | if AC=0 then PC<-xxxxxxxxxxxx |
| 0110xxxxxxxxxxxx | JUMP | Jump | PC<-xxxxxxxxxxxx |
| 0111xxxxxxxxxxxx | LOCO | Load constant | AC<-xxxxxxxxxxxx |
| 1000xxxxxxxxxxxx | LODL | Load local | AC<-m[SP+xxxxxxxxxxxx] |
| 1001xxxxxxxxxxxx | STOL | Store local | m[SP+xxxxxxxxxxxx]<-AC |
| 1010xxxxxxxxxxxx | ADDL | Add local | AC<-AC+m[SP+xxxxxxxxxxxx] |
| 1011xxxxxxxxxxxx | SUBL | Subtract local | AC<-AC-m[SP+xxxxxxxxxxxx] |
| 1100xxxxxxxxxxxx | JNEG | Jump negative | if AC<0 then PC<-xxxxxxxxxxxx |
| 1101xxxxxxxxxxxx | JNZE | Jump nenzero | if AC<>0 then PC<-xxxxxxxxxxxx |
| 1110xxxxxxxxxxxx | CALL | Call procedure | SP<-SP-1;m[SP]<-PC;PC<-xxxxxxxxxxxx |
| 1111000000000000 | PSHI | Push indirect | SP<-SP-1;m[SP]<-m[AC] |
| 1111001000000000 | POPI | Pop indirect | m[AC]<-m[SP];SP<-SP+1 |
| 1111010000000000 | PUSH | Push onto stack | SP<-SP-1;m[SP]<-AC |
| 1111011000000000 | POP | Pop from stack | AC<-m[SP]; SP<-SP+1 |
| 1111100000000000 | RETN | Return | PC<-m[SP]; SP<-SP+1 |
| 1111101000000000 | SWAP | Swap ac,sp | tmp<-AC;AC<-SP;SP<-tmp |
| 11111100yyyyyyyy | INSP | Increment sp | SP<-SP+yyyyyyyy |
| 11111110yyyyyyyy | DESP | Decrement sp | SP<-SP-yyyyyyyy |