Instruction Set
Instruction set of 3niti alpha has 3 groups of commands:
- load register A from other register (opcode starts with P) - LAr (where r is a name of any directly available register used as source);
- save register A to other register (opcode starts with N) - SAr (where r is a name of any directly available register used as destination);
- and other commands (opcode starts with O).
Full instruction set:
Ternary | Decimal | Mnemonic | Description |
---|---|---|---|
NNN | -13 | SAN | Save value from register A to register N (memory cell with address DPn) |
NNO | -12 | SAO | Save value from register A to register O (memory cell with address DPo) |
NNP | -11 | SAP | Save value from register A to register P (memory cell with address DPp) |
NON | -10 | SAF | Save value from register A to register F |
NOO | -9 | SPCD | Save value from PC (program counter) to current DP (data pointer) |
NOP | -8 | SAB | Save value from register A to register B |
NPN | -7 | SAL | Save value from register A to register L (lower triad of current data pointer) |
NPO | -6 | SAM | Save value from register A to register M (middle triad of current data pointer) |
NPP | -5 | SAH | Save value from register A to register H (higher triad of current data pointer) |
ONN | -4 | RLA | Rotate register A to the left through flag BCF |
ONO | -3 | ADD | Add register A with B and flag BCF, save result to A and BCF, modify sign flag RSF |
ONP | -2 | RRA | Rotate register A to the right through flag BCF |
OON | -1 | LAI # | Load register A from immediate triad |
OOO | 0 | ADI # | Add register A with immediate triad and flag BCF, save result to A and BCF, modify sign flag RSF |
OOP | 1 | OPA # | Perform unary "tritwise" operation over register A (function is defined by immediate triad), modify sign flag RSF |
OPN | 2 | LDI ### | Load current DP (data pointer) by immediate 3 triads (higher triad, middle triad, lower triad) |
OPO | 3 | JMP ### | Jump to address (copy to PC) set by immediate 3 triads (higher triad, middle triad, lower triad) |
OPP | 4 | OPB ### | Perform binary "tritwise" operation over registers A and B, save result to A (function is defined by immediate 3 triads), modify sign flag RSF |
PNN | 5 | LAN | Load register A by value from register N (memory cell with address DPn) |
PNO | 6 | LAO | Load register A by value from register O (memory cell with address DPo) |
PNP | 7 | LAP | Load register A by value from register P (memory cell with address DPp) |
PON | 8 | LAF | Load register A by value from register F |
POO | 9 | LPCD | Load PC (program counter) by value from current DP (data pointer) |
POP | 10 | LAB | Load register A by value from register B |
PPN | 11 | LAL | Load register A by value from register L (lower triad of current data pointer) |
PPO | 12 | LAM | Load register A by value from register M (middle triad of current data pointer) |
PPP | 13 | LAH | Load register A by value from register H (higher triad of current data pointer) |
See Code Snippets for better understanding