invent some opcodes for a base 19 computer
Alright — let’s imagine a nonary‑plus‑ten style machine: a base‑19 CPU, where each “digit” of an instruction is a nonadecimal value from 0 to 18. With 19 states per symbol, even a two‑digit opcode space gives you 361 unique instructions — plenty of room for rich, specialized operations.
We can design this for balanced base‑19 (-9 … 0 … +9) so arithmetic and branching can exploit symmetry.
🖥 Example Base‑19 Instruction Set
Mnemonic | Opcode (nonadecits) | Description | Special Base‑19 Twist |
---|
LD19 | 0 0 0 | Load Nonadeword from memory into register | Address in next word |
ST19 | 0 0 1 | Store Nonadeword from register to memory | — |
AD19 | 0 1 0 | Add (mod 19) | Wraps naturally at 19 |
SU19 | 0 1 1 | Subtract (mod 19) | — |
ML19 | 0 2 0 | Multiply (mod 19) | Handy for modular crypto (19 is prime) |
DV19 | 0 2 1 | Divide (mod 19) | — |
INC | 0 3 0 | Increment by 1 nonadecimal | Rolls over at 18 → 0 |
DEC | 0 3 1 | Decrement by 1 nonadecimal | Rolls under at 0 → 18 |
NEG | 0 4 0 | Negate (balanced form) | Flips sign in -9…+9 representation |
TST | 1 0 0 | Test Value | Sets flags for <0 , =0 , >0 |
BRN | 1 0 1 | Branch if Negative | — |
BRZ | 1 0 2 | Branch if Zero | — |
BRP | 1 0 3 | Branch if Positive | — |
BRM | 1 0 4 | Branch if Magnitude > n | n in next undecit |
SHL | 1 1 0 | Shift Left by n nonadecits | n in next digit |
SHR | 1 1 1 | Shift Right by n nonadecits | — |
ROT | 1 1 2 | Rotate nonadecits | Circular shift |
NINV | 1 2 0 | Nonadecimal Invert | Maps 0↔18 , 1↔17 , …, 9→9 |
MAP19 | 1 2 1 | Apply 19‑entry lookup table to each digit | Great for encoding/crypto |
MODP | 1 3 0 | Modular Power | Raises regA to regB mod 19 |
NOP | 18 18 18 | No Operation | — |
HLT | 18 18 0 | Halt Execution | — |

Design Notes
Prime modulus: 19 being prime makes modular multiplication, inversion, and exponentiation especially useful for cryptography and finite‑field math.
Balanced form (-9…+9) makes negation trivial and allows three‑way branching on sign.
MAP19 is a “vectorized” instruction — you can remap each digit in a word in one go, which is powerful for table‑driven transforms.
With 19 states per digit, you could reserve entire opcode ranges for domain‑specific accelerators (e.g., DSP, AI tensor ops, graphics).
If you’d like, I can sketch a tiny base‑19 assembly program using these opcodes — for example, a modular counter that cycles through all 19 values and branches based on sign — so you can see them in action. Would you like me to build that next?