Macro Expansion May Occur Before Macro Call in Listing File

ID Number: Q73036

6.00 | 6.00

MS-DOS | OS/2

buglist6.00

Summary:

With the Microsoft Macro Assembler (MASM) version 6.0, if the .NOLIST

source directive is the first statement in a file and it is later

followed by a .LISTALL directive, then the macro expansion in the

listing file will occur before the macro call instead of after it.

This problem can be eliminated by placing either a blank line or a

comment before the .NOLIST directive, so that .NOLIST is not on the

first line of the file.

More Information:

The .NOLIST directive prevents the macro expansion of all macro calls

in the listing file. This option shows the macro call, but it does not

display the corresponding code. The .NOLIST directive also prevents a

complete listing of every macro in each file that is included with the

.INCLUDE directive. The .LISTALL directive lists all source lines,

including false conditionals and generated code for each macro.

In the sample code below, the placement of the .NOLIST directive

before the .INCLUDE directive prevents a general listing of every

macro in that include file. Placing the .LISTALL after the .INCLUDE

directive should cause the corresponding code for each macro to be

listed after that macro appears in the source code. For example, the

correct listing for TEST_MACRO should appear as follows:

TEST_MACRO

0000 55 1 PUSH BP

0001 8B EC 1 MOV BP, SP

However, if .NOLIST is the first statement on the first line in the

file, then this order is reversed and the macro expansion appears

before the macro call. The incorrect macro expansion actually appears

as follows:

0000 55 1 PUSH BP

0001 8B EC 1 MOV BP, SP

TEST_MACRO

As mentioned above, this can be resolved by placing either a blank

line or comment before the .NOLIST directive.

Microsoft has confirmed this to be a problem in MASM version 6.0. We

are researching this problem and will post new information here as it

becomes available.

Sample Code

-----------

Assemble options needed: /c /Fl

Note that .NOLIST must be on the first line in the file.

TEST.ASM

--------

.NOLIST

INCLUDE TEST.INC

.LISTALL

.MODEL small

.CODE

start:

TEST_MACRO

end start

TEST.INC

--------

; Include file for TEST.ASM

TEST_MACRO MACRO

PUSH BP

MOV BP, SP

ENDM