Main Page | See live article | Alphabetical index

# MIX

MIX is the mythical computer used in Donald Knuth's textbook, The Art of Computer Programming. Its model number is 1009, which was chosen by combining the numbers and names of other machines that the designer was familiar with. (Conveniently, the roman numerals "MIX" also denote 1009.)

MIX is replaced by a wholly new machine, MMIX, in the later editions of the textbook. In the meantime, you can find software that emulates MIX. Called MIXware by Donald Knuth. GNU MDK is one such program, which is known to be running on a wide variety of platforms.

## Architecture

MIX is both a binary and a decimal computer. When programmed in binary, each byte has 6 bits (values range from 0 to 63). In decimal, each byte has 2 decimal digits (values range from 0 to 99). Bytes are grouped into words of five bytes plus a sign. Most programs written for MIX will work in either binary or decimal, so long as they do not try to store a value greater than 63 in a single byte.

A word has the range -1,073,741,824 to 1,073,741,824 (on a binary machine), or -10,000,000,000 to 10,000,000,000 (decimal machine) and distinguishes between +0 and -0. (Most modern machines use two's complement binary arithmetic, and have only one zero. Programming arithmetic on MIX requires taking into account the fact that +0 ≠ -0.)

### Registers

There are 9 registers in MIX:

• rA: Accumulator (full word).
• rX: Extension (full word).
• rI1 ... rI6: Index registers (two bytes and a sign).
• rJ: Jump address (two bytes, always positive).

MIX records whether the previous operation overflowed, and a comparison indicator (less than, equal to, or greater than).

### Memory and Input/Output

The MIX machine has 4000 words of storage (each with 5 bytes and a sign), addressed from 0 to 3999. A variety of input and output devices are also included:

• Tape units (devices 0 ... 7).
• Disk or drum units (devices 8 ... 15).