2.2 Program Listing

To obtain more details about the generated object deck, use ‘--list’ (‘-l’) command line option. This option generates a listing file. The file name for this file is constructed by appending ‘.lst’ suffix to the base name of the input file. For example, the following invocation will store the program listing in file ‘hello.lst’.

 
$ mixal -l hello.mix

If explicit input file is not given, e.g. when assembling the standard input, the listing is named ‘mixal.lst’.

These naming conventions can be overridden, by specifying the listing name explicitly, with ‘--list-file’ option. This option implies ‘--list’, so you need not give the two options together. For example, the following invocation will store the listing in file ‘out/hello.list’:

 
$ mixal --list-file=out/hello.list hello.mix

The program listing contains, for each line of the input source, the address of the corresponding MIX cell and the assembled cell contents, as shown in the table below:

Column Meaning
1–4 MIX cell address.
5 A semicolon
7–21 Cell contents.
23–27 Source line number.
28 and others. Source line.

The cell contents (columns 7–21) is formatted as described in TAOCP, 1.3.1, p.124, Instruction format:

Column Meaning
7 Sign.
8-12 Address part.
14–15 I-field.
17–18 F-field.
20–21 Opcode.

The following example shows mixal listing for the ‘hello.mix’ program:

 
                          1 * ``HELLO, WORLD'' PROGRAM
                          2 PRINTER    EQU  18
                          3            ORIG 3000
3000: + 3003  0 18 37     4 HELLO      OUT  TEXT(PRINTER)
3001: + 3001  0 18 34     5            JBUS *(PRINTER)
3002: +    0  0  2  5     6            HLT  
3003: +  517 13 13 16     7 TEXT       ALF  HELLO
3004: + 2624 26 16 19     8            ALF  , WOR
3005: +  836  0  0  0     9            ALF  LD   
                         10            END  HELLO

After the listing comes a symbol table, which, for each symbol used in the program, shows its name, location and a source line, where it was defined. For example:

 
Symbol     Value  Line  
PRINTER       18    2   
HELLO       3000    4   
TEXT        3003    7   

The ‘Value’ column contains a MIX location, corresponding to that symbol, except in case of macro-definitions (EQU), where the actual value of the macro is printed (see ‘PRINTER’ in the example above).

The symbol table contains not only user-defined symbols, but also any literals and local labels used in the program. For literals, the ‘Symbol’ column contains their computed w-expressions, surrounded by equals sings. For example, the line

 
        MUL  =2*25+1=

will produce the symbol name ‘=51=’, e.g.:

 
Symbol     Value  Line  
=51=        1101   18

Local labels are displayed as two integer numbers, separated by a dash and surrounded by vertical bars (‘|’). The first number corresponds to the number of the local label, the second one means its ordinal number in the program text. For example, the MIXAL fragment below:

 
1H      INCX 0
        DECA 11
        JANP 1B
1H      INCX 1

will produce the following two entries in the symbol table:

 
Symbol     Value  Line  
|1-1|       1026    7
|1-2|       1029   10

An additional statistics about the input source can be obtained using ‘--xref’ (‘-x’) option, which instructs mixal to print a cross-reference table of all used symbols. A cross-reference table is added as an additional column to the symbol table, described above. The contents of this column lists the lines where the symbol was referenced. The following example shows a cross-reference table for the ‘hello.mix’ program:

 
Symbol     Value  Line  Referenced on line
PRINTER       18    2    4    5
HELLO       3000    4   10
TEXT        3003    7    4

If ‘--xref’ is used without ‘--list’ (or ‘--list-file’), the symbol table is printed on the standard error.