MIXAL programs can be written as ASCII files with your editor of choice. Here you have the mandatory hello world as written in the MIXAL assembly language:
* (1) * hello.mixal: say 'hello world' in MIXAL (2) * (3) * label ins operand comment (4) TERM EQU 19 the MIX console device number (5) ORIG 1000 start address (6) START OUT MSG(TERM) output data at address MSG (7) HLT halt execution (8) MSG ALF "MIXAL" (9) ALF " HELL" (10) ALF "O WOR" (11) ALF "LD " (12) END START end of the program (13)
MIXAL source files should have the extension .mixal when used with the mdk utilities. As you can see in the above sample, each line in a MIXAL file can be divided into four fields separated by an arbitrary amount of whitespace characters (blanks and or tabs). While in Knuth's definition of MIXAL each field must start at a fixed pre-defined column number, the mdk assembler loosens this requirement and lets you format the file as you see fit. The only restrictions retained are for comment lines (like 1-4) which must begin with an asterisk (*) placed at column 1, and for the label field (see below) which, if present, must also start at column 1. The four fields in each non-comment line are:
MSGin lines 7 and 9) or a defined symbol (
TERM) (if present, the label must always start at the first column in its line, for the first whitespace in the line maks the beginning of the second field),
HLTin lines 7 and 8 above), or an assembly pseudoinstruction (e.g., the
ORIGpseudoinstruction in line 61.
Lines 9-12 of the hello.mixal file above also show the
second (and last) difference between Knuth's MIXAL definition and ours:
the operand of the
ALF pseudoinstruction (a word of five
characters) must be quoted using ""2.
The workings of this sample program should be straightforward if you are familiar with MIXAL. See TAOCP vol. 1 for a thorough definition or MIX and MIXAL tutorial, for a tutorial.
 If an
ORIG directive is not used, the program will
be loaded by the virtual machine at address 0.
allocating the executable code where you see fit.
 In Knuth's definition,
the operand always starts at a fixed column number, and the use of
quotation is therefore unnecessary. As
mixasm releases this
requirement, marking the beginning and end of the
disambiguates the parser's recognition of this operand when it includes
blanks. Note that double-quotes (") are not part of the MIX character
set, and, therefore, no escape characters are needed within