Using a Higher Processor Directive in a Macro Causes an A2006

ID Number: Q72887

6.00 | 6.00

MS-DOS | OS/2

buglist6.00

Summary:

When you attempt to use a symbol in your assembly code without

defining it first, the Microsoft Macro Assembler (MASM) generates the

following error:

error A2006: undefined symbol : 'identifier'

However, MASM version 6.0 may also incorrectly generate this error

when you use a processor directive in a macro if the processor

specified is higher than the one currently defined. To work around the

problem, declare a processor type of sufficient level to execute the

instructions in the macro before calling the macro.

More Information:

The sample code below may be used to illustrate this problem. The

default processor directive is .8086. When the macro is called, a

LEAVE instruction is used that requires the .286 processor. However,

with the .286 directive in the macro definition, the following error

is generated by the assembler:

file.asm(14): error A2006 undefined symbol : s

my_proc(2): Macro Called From

file.asm(14): Main Line Code

To work around the problem, declare the .286 directive before the

macro is called, as shown in the comment in the sample code.

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: none

.MODEL SMALL

.8086

; .286 ;Uncomment this directive for workaround.

my_proc macro s

.286

enter s,0

.8086

endm

.CODE

my_proc 5

END