Free tool · TAOCP §1.3

MIX emulator and MIXAL assembler, in your browser

Write MIXAL, assemble it and run it on MIX, the imaginary computer from Knuth's The Art of Computer Programming, right here. No install. 14 exercises from §1.3 are graded on the server when you submit them, and a pass verifies that week of the path.

What MIX is

A made-up 1960s-style machine: words of five bytes and a sign, registers A and X, six index registers, a jump register, and 4000 words of memory. Every program in TAOCP Volumes 1 to 3 is written for it, which is what lets Knuth count running time exactly. More on MIX.

How to use it

  1. Type or paste MIXAL into the editor below.
  2. Assemble and run it; step through to watch the registers and memory.
  3. Pick an exercise from the list to load its starting code and tests; sign in to submit it for credit.

A first program

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

Adds 1 to 10; register A ends at 55.

Scratchpad

Graded exercises

Each one loads its starting code and test cases into the emulator. Check runs them in your browser; sign in to submit for credit.

Questions

Is this the same MIX as in TAOCP?

Yes: the MIX of Volume 1, §1.3.1, with the MIXAL assembly language of §1.3.2. It is meant for working the book's examples and exercises.

Can I run MIX programs offline?

GNU MDK is the classic desktop MIX toolkit. This page needs no install and grades exercises.

Is MIX the same as MMIX?

No. MMIX is Knuth's later 64-bit RISC machine used from Volume 4A on. This emulator runs MIX.

Learn more: what MIX is, MIXAL, the §1.3.1 reading guide, how to read TAOCP and Volume 1.