The .LST file is one of the files that can be generated when
a program is assembled. It shows assembly code and the corresponding
machine code, addresses of variables, and other information
about the program. The .LST file also shows how macros are
expanded. We will demonstrate this by an example.
Example: The following program contains the MOVW macro
and two invocations.
TITLE PGM1: MACRO DEMO
.MODEL SMALL
MOVW MACRO WORD1, WORD2
PUSH WORD2
POP WORD1
ENDM
.STACK 100H
.DATA
A DW 1, 2
B DW 3
MAIN PROC
MOV AX, @DATA
MOV DS, AX
MOVW A, DX
MOVW A+2, B
; dos exit
MOV AH, 4CH
INT 21H
MAIN ENDP
END MAIN
The next figure shows the file PGM1.LST. In this file, the assembler prints
the macro invocations, followed by their expansions (shown in boldface). The digit 1 that
appears on each line of the expansions means that these macros were
invoked at the "top level"; that is, by the program itself. We will show
later that a macro may invoke another macro.
PGM1.LST
TITLE PGM1: MACRO DEMO
.MODEL SMALL
MOVW MACRO WORD1, WORD2
PUSH WORD2
POP WORD1
ENDM
.STACK 100H
0000 .DATA
0000 0001 0002 A DW 1, 2
0004 0003 B DW 3
0000 .CODE
0000 MAIN PROC
0000 B8 ---- R MOV AX, @DATA
0003 8E D8 MOV DS, AX
MOVW A, DX
0005 52 1 PUSH DX
0006 8F 06 0000 R 1 POP A
MOVW A+2, B
000A FF 36 0004 R 1 PUSH B
000E 8F 06 0002 R 1 POP A+2
; dos exit
0012 B4 4C MOV AH, 4CH
0014 CD 21 INT 21H
0016 MAIN ENDP
END MAIN
The macro expansion process and the generation of the listing file (.LST file) is illustrated in the figure shown below.
Fig. m12050.1 List File Generation and Macro Expansion Process