To discuss this emulator or report bugs use our forum in English or in Russian
Instruction set of ternary computer 3niti alpha was designed in 2004. Control panel for it was designed in 2008 as row of 15 "ternary" red-green indicators (GREEN is +1 or P, WHITE is 0 or O, RED is -1 or N) and row of 15 "ternary" slide switches (TOP position is +1 or P, NEUTRAL position is 0 or O, BOTTOM position is -1 or N - see below for details). Now you can try emulator of this computer with simulated control panel. Computer has 3-trit data and 9-trit address. So data registers are 3-trit (1 triad) and address registers are 9-trit (3 triads). 9-trit register PC (program counter) is not available directly. Three 9-trit registers DPn, DPo and DPp (data pointers) are used to address some data in memory. Also it can be used to copy value from or to PC. Also computer has three 3-trit registers: A, B and F (flags). Ternary program can get direct access only to 3-trit data at once and we have 9 directly available 3-trit registers to do that (some of them address parts of DP registers or memory pointed by DP registers):
Id | Name | Description |
-4 | N | triad from memory addressed by DPn |
-3 | O | triad from memory addressed by DPo |
-2 | P | triad from memory addressed by DPp |
-1 | F | flag register (RSF - result sign flag, DPF - data pointer flag, BCF - borrow carry flag) |
0 | A | accumulator register |
+1 | B | auxiliary register |
+2 | L | lower triad of current DP register chosen by DPF |
+3 | M | middle triad of current DP register chosen by DPF |
+4 | H | higher triad of current DP register chosen by DPF |
Control panel has row of 15 "ternary" red-green indicators:
Also control panel has row of 15 "ternary" slide switches:
Each instruction of 3niti alpha is one triad length and may have 0, 1 or 3 one-triad arguments. This is full list of instructions:
Opcode | Mnemonic | Description |
#NNN (-13) | SAN | save register A to register N |
#NNO (-12) | SAO | save register A to register O |
#NNP (-11) | SAP | save register A to register P |
#NON (-10) | SAF | save register A to register F |
#NOO (-9) | SPCD | save PC (program counter) to current data pointer |
#NOP (-8) | SAB | save register A to register B |
#NPN (-7) | SAL | save register A to register L (lower triade of current data pointer) |
#NPO (-6) | SAM | save register A to register M (middle triade of current data pointer) |
#NPP (-5) | SAH | save register A to register H (higher triade 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 set by immediate triad), modify sign flag RSF |
#OPN (2) | LDI # # # | load current data pointer by immediate 3 triads (higher, middle, lower) |
#OPO (3) | JMP # # # | jump to address (put it to register PC) set by immediate 3 triads (higher, middle, lower) |
#OPP (4) | OPB # # # | perform binary "tritwise" operation over registers A and B, save result to A (function set by immediate 3 triad), modify sign flag RSF |
#PNN (5) | LAN | load register A from register N |
#PNO (6) | LAO | load register A from register O |
#PNP (7) | LAP | load register A from register P |
#PON (8) | LAF | load register A from register F |
#POO (9) | LPCD | load PC (program counter) from current data pointer |
#POP (10) | LAB | load register A from register B |
#PPN (11) | LAL | load register A from register L (lower triad of current data pointer) |
#PPO (12) | LAM | load register A from register M (middle triad of current data pointer) |
#PPP (13) | LAH | load register A from register H (higher triad of current data pointer) |