Tunguska is a ternary computer emulator. On a good day, it's performance it is roughly equivalent with that of a personal computer from the 1980's, with peak speeds around 1,000,000 operations per second, on a more normal day roughly 250,000 ops/sec.

It is loosely based on the excellent design of the (binary) 6502-processor by MOS Technology, but entirely ternary. So instead of having two memory cell states (0, 1), it has three (-1, 0, 1).

The machine uses tryte-width (tryte = ternary analog to "byte") 6, with 36=729 states per tryte.

The name is both a tip of the hat to the predominantly russian heritage of ternary computing, and an (obsolete) in-joke about the stability of an earlier version.


Besides the emulator itself, tunguska has several other components:

The tunguska assembler compiles assembly code into a compressed binary format that the emulator can run.
Operating system
Tunguska comes with a crude operating system, written in assembly, it has functions for basic I/O and provides a less programmer-hostile environment than a blank memory slate.
C compiler
In development is also a C-like language that will translate into assembly code. At this stage, it is rudimentally functioning, but very early alpha. Since the main goal is to provide a higher level alternative to assembly, it will not initially have all the functionality standard C has.


"I wonder how it would be if my computer was ternary?", I asked myself a while back. I googled around, and found a few stub-ish wikipedia articles, a few pages explaining why ternary computing is vastly superior to everything, and some documents discussing russian experiments in the 1950's.

Obviously, this wouldn't do. I wanted a hands-on computer I could play with. So I got to work, and a few months later, this is the result.

So, the purpose is to provide a simple and accessible, yet powerful playground for ternary computing for the man in the street (with a decent understanding of assembly programming and general computer infrastructure).


The goal of the project is primarily enjoyment, but undirected programming won't really produce anything useful, so some sort of priorities and goals need to be defined. In descending order of importance:

  1. Simplicity / usability
  2. Speed
  3. Beautiful code
  4. Experimentation

The goal of the project is ultimately to make ternary computing widely accessible to those who are interested. As a diversion, as a toy, as a what-if; to tug a bit in the binary groupthink, and see if something comes loose.

An important side-goal is to document the project well enough so that people who don't quite meet the knowledge level required to understand Tunguska easily can catch up on the essentials.

©opy(direction) 2008 Viktor Lofgren <vlofgren(Q)gmail.com>
Get tunguska at SourceForge.net. Fast, secure and Free Open Source software downloads