Glossary

What is MIXAL?

MIXAL, short for MIX Assembly Language, is how programs for Knuth's MIX computer are written in The Art of Computer Programming. It turns readable lines like LDA X into MIX machine words.

Taught in TAOCP 1.3.2 The MIX Assembly Language

What a MIXAL line looks like

Each line has up to three parts: an optional location (a label), an operation (an instruction like LDA or a pseudo-operation like EQU), and an address part, which can carry an index register and a field: LDA X,1(0:3) loads bytes 0 to 3 of the word at X plus rI1 into register A.

The pseudo-operations are few: EQU defines a symbol, ORIG sets where the next word goes, CON and ALF place a constant or five characters, and END ends the program and names where it starts. Local symbols like 2H, 2B and 2F let you reuse short labels for loops (the B means the nearest one before, F the nearest one after).

A small example

This program adds the numbers 1 to 10 and halts with the sum in register A:

       ORIG 100
START  ENTA 0
       ENT1 10
LOOP   INCA 0,1
       DEC1 1
       J1P  LOOP
       HLT
       END  START

ENT1 10 puts 10 in index register 1, INCA 0,1 adds rI1 to A, and J1P jumps back while rI1 is positive. Paste it into the MIX emulator and step through it.

Where it is taught

Knuth introduces MIXAL in §1.3.2, with worked programs for finding a maximum and printing a table of primes, annotated with how many times each line runs. Those counts are how he gets exact running times. The graded exercises at /mix follow the same section.

Questions

Is MIXAL the same as MIX?

No. MIX is the machine; MIXAL is the assembly language you write MIX programs in. An assembler turns MIXAL into MIX words.

Can I run MIXAL online?

Yes. cracked.guide/mix assembles and runs MIXAL in the browser, and grades a set of exercises from TAOCP §1.3 when you are signed in.