three states, no bits
A balanced ternary computer, specified and running in your browser
Every digit is -1, 0, or +1. Six of them make one word. This site documents the architecture and gives you a working machine to write for.
- word
- 6 trits
- states per word
- 729
- range
- -364 .. 364
- memory
- 729 words
- registers
- R0 .. R7, PC, SP, FLAGS
- instruction
- 3 words, fixed width
word dial
reads000+0-8
Numbers, without a sign bit
Negative values fall out of the notation itself: flip every trit and you have the negation. Leading zero trits are dimmed so the significant part of a word reads first.
| decimal | word | weights |
|---|---|---|
| -364 | ------ | -243 - 81 - 27 - 9 - 3 - 1 |
| -13 | 000--- | -9 - 3 - 1 |
| -1 | 00000- | -1 |
| 0 | 000000 | 0 |
| 1 | 00000+ | 1 |
| 8 | 000+0- | 9 - 1 |
| 121 | 0+++++ | 81 + 27 + 9 + 3 + 1 |
| 364 | ++++++ | 243 + 81 + 27 + 9 + 3 + 1 |
A program, end to end
START:
MOV R1, +0- ; R1 = 8
MOV R2, 5
ADD R1, R2 ; R1 = 13
STORE [100], R1
HALTLoad this and six other example programs — including Fibonacci with visible overflow — in the playground, where the assembler reports errors by line and the machine can be stepped one instruction at a time.