#### 2.1.1 MIX architecture ¶

The basic information storage unit in the MIX computer is the byte, which stores positive values in the range 0-63 . Note that a MIX byte can be then represented as 6 bits, instead of the common 8 bits for a regular byte. Unless otherwise stated, we shall use the word byte to refer to a MIX 6-bit byte.

A MIX word is defined as a set of 5 bytes plus a sign. The bytes within a word are numbered from 1 to 5, being byte number one the most significant one. The sign is denoted by index 0. Graphically,

     -----------------------------------------------
    |   0   |   1   |   2   |   3   |   4   |   5   |
     -----------------------------------------------
    |  +/-  | byte  | byte  | byte  | byte  | byte  |
     -----------------------------------------------

Sample MIX words are ‘`- 12 00 11 01 63`’ and ‘`+ 12 11 34 43 00`’.

You can refer to subfields within a word using a field specification or fspec of the form “(L:R)”, where L denotes the first byte, and R the last byte of the subfield. When L is zero, the subfield includes the word’s sign. An fspec can also be represented as a single value `F`, given by `F = 8*L + R` (thus the fspec ‘`(1:3)`’, denoting the first three bytes of a word, is represented by the integer 11).

The MIX computer stores information in registers, that can store either a word or two bytes and sign (see below), and memory cells, each one containing a word. Specifically, the MIX computer has 4000 memory cells with addresses 0 to 3999 (i.e., two bytes are enough to address a memory cell) and the following registers:

`rA`

  A register. General purpose register holding a word. Usually its contents serves as the operand of arithmetic and storing instructions.

`rX`

  X register. General purpose register holding a word. Often it acts as an extension or a replacement of ‘`rA`’.

`rJ`

  J (jump) register. This register stores positive two-byte values, usually representing a jump address.

`rI1`, `rI2`, `rI3`, `rI4`, `rI5`, `rI6`

  Index registers. These six registers can store a signed two-byte value. Their contents are used as indexing values for the computation of effective memory addresses.

In addition, the MIX computer contains:

- An overflow toggle (a single bit with values on or off). In this manual, this toggle is denoted OV.
- A comparison indicator (having three values: EQUAL, GREATER or LESS). In this manual, this indicator is denoted CM, and its possible values are abbreviated as E, G and L.
- Input-output block devices. Each device is labelled as `un`, where `n` runs from 0 to 20. In Knuth’s definition, `u0` through `u7` are magnetic tape units, `u8` through `15` are disks and drums, `u16` is a card reader, `u17` is a card writer, `u18` is a line printer and, `u19` is a typewriter terminal, and `u20`, a paper tape. Our implementation maps these devices to disk files, except for `u19`, which represents the standard output.

As noted above, the MIX computer communicates with the external world by a set of input-output devices which can be “connected” to it. The computer interchanges information using blocks of words whose length depends on the device at hand (see MIX block devices). These words are interpreted by the device either as binary information (for devices 0-16), or as representing printable characters (devices 17-20). In the last case, each MIX byte is mapped onto a character according to the following table:

00 |  | 01 | A | 02 | B | 03 | C
04 | D | 05 | E | 06 | F | 07 | G
08 | H | 09 | I | 10 | ~ | 11 | J
12 | K | 13 | L | 14 | M | 15 | N
16 | O | 17 | P | 18 | Q | 19 | R
20 | [ | 21 | # | 22 | S | 23 | T
24 | U | 25 | V | 26 | W | 27 | X
28 | Y | 29 | Z | 30 | 0 | 31 | 1
32 | 2 | 33 | 3 | 34 | 4 | 35 | 5
36 | 6 | 37 | 7 | 38 | 8 | 39 | 9
40 | . | 41 | , | 42 | ( | 43 | )
44 | + | 45 | - | 46 | * | 47 | /
48 | = | 49 | $ | 50 | < | 51 | >
52 | @ | 53 | ; | 54 | : | 55 | ’

The value 0 represents a whitespace. The characters `~`, `[` and `#` correspond to symbols not representable as ASCII characters (uppercase delta, sigma and gamma, respectively), and byte values 56-63 have no associated character.

Finally, the MIX computer features a virtual CPU which controls the above components, and which is able to execute a rich set of instructions (constituting its machine language, similar to those commonly found in real CPUs), including arithmetic, logical, storing, comparison and jump instructions. Being a typical von Neumann computer, the MIX CPU fetches binary instructions from memory sequentially (unless a jump instruction is found), and stores the address of the next instruction to be executed in an internal register called location counter (also known as program counter in other architectures).

The next section, See MIX instruction set, gives a complete description of the available MIX binary instructions.