Conditionally Assembling the END Directive (84744)
The information in this article applies to:
- Microsoft Macro Assembler (MASM) 6.0
- Microsoft Macro Assembler (MASM) 6.0a
- Microsoft Macro Assembler (MASM) 6.0b
This article was previously published under Q84744 SUMMARY
Sometimes it is helpful to conditionally have a starting label
specified with the END directive; for example, to use preprocessor
directives to specify various END directives:
IFDEF xyz
END start_label
ELSE
END
ENDIF
Note, however, that this approach will not work. As soon as MASM
encounters the first END directive it will stop assembling. The
assembler stops regardless of whether or not the END directive is
inside a preprocessor block. This is the expected behavior for the
assembler.
A method that can be used to accomplish this task involves using a
conditionally defined text equate with the END directive. The
following sample code demonstrates this method:
Sample Code
; Assemble options needed: /Dxyz
.MODEL small
.STACK 4096
.CODE
start_label:
mov ax, 4C00h
int 21h
IFDEF xyz
end_label EQU <start_label>
ELSE
end_label EQU <>
ENDIF
END end_label
Modification Type: | Major | Last Reviewed: | 10/17/2003 |
---|
Keywords: | KB84744 |
---|
|