• Aucun résultat trouvé

Literal-Text Operator

Dans le document About This Book (Page 58-67)

Format

<text>

Purpose

The literal-text operator directs the assembler to treat

text

as a single literal element regardless of whether it contains commas, spaces, or other separators. The operator is most often used with macro calls and the IRP pseudo-op to ensure that values in a parameter list are treated as a single parameter.

The literal text operator can also be used to force MASM to treat special characters such as the semicolon (;) or the ampersand (&) lit-erally. For example, the semicolon inside angle brackets

<;>

becomes a semicolon, not a comment indicator.

MASM removes one set of angle-brackets each time the parameter is used in a macro. When using nested macros, you will need to supply as many sets of angle brackets as there are levels of nesting.

!

Special Macro Operator

Purpose

When you use an exclamation point (!) in an operand, the Macro Assembler treats the next character literally. (!) is typically used to treat special characters such as the semicolon (;) or the ampersand (&) literally.

Format

!character Remarks

For example, !; and <; > are equivalent entries.

3-10

0/0

Special Macro Operator

Purpose

The % special macro operator converts the expression that follows (usually a symbol) to a number in the current RADIX. During macro expansion, the number derived from converting the expression is substituted for the dummy.

Format

%expression Remarks

The percent sign (%) is used only in a macro operand. Using the % special operator allows a macro call by value. Usually, a macro call is a call by reference with the text of the macro operand substituti ng exactly for the dummy.

Example MAKERR MACRO X

LB 0

REPT X

LB LB+l

MAKLIB %LB

ENDM ;;END OF REPT ENDM ;;END OF MACRO MAKLIB ~lACRO Y

ERR&Y: DB 'ERROR &Y' ,0 ENDM

Purpose

The = pseudo-op lets you set and then redefine constant symbols.

You can redefine the symbol more than once.

Format

symbol

=

expression Remarks

The

=

pseudo-op is similar to the EQU pseudo-op except you can redefine the symbol without producing any message. However, unlike EQU, the = pseudo-op is limited only to numeric expressions (no text strings) that may also include assigning a type by using the

PTR operator.

Example

EMP = 6 ;THIS IS THE SAME AS EMP EQU 6 EMP EQU 6 ;ERROR, EMP CANNOT BE REDEFINED

BY EQU

EMP = 7 ;EMP CAN BE REDEFINED EMP = EMP+l ;CAN REFER TO ITS PREVIOUS

DEFINITION

Note: Optionally, a TYPE attribute can be assigned to the symbol by using the PTR operator. For example:

VECTOR DWORD PTR 4

Note: If that value were to be changed by some subsequent =, the typing symbol and PTR should be repeated, or the attribute of the symbol will be changed. For example:

VECTOR DWORD PTR VECTOR+4

3-12

.ALPHA

Purpose

. ALPHA tells the assembler to arrange the segments in the object file

...

in alphabetical order, by segment names.

Format .ALPHA Remarks

.ALPHA cancels the /s option used on the MASM command line.

Example .ALPHA DATA SEGMENT

DATA ENDS

CODE SEGMENT

CODE ENDS

Segment CODE will precede segment DATA in the object module.

Purpose

.'

ASSUME tells the assembler the segment register to which a segment belongs. When the assembler encounters a seg-name, it automat-ically assembles the seg-name reference under the proper segment register. ASSUME NOTHING cancels any previous ASSUME for the indi-cated register.

Format

ASSUME seg-reg: seg-name[, ... ] or

ASSUME NOTHING Remarks

The valid seg-reg entries are CS, os, ES, and SS.

The possible entries for seg-name are:

• The name of a segment declared with the SEGMENT pseudo-op

• The name of a group declared with the GROUP pseudo-op you must prefix each seg-name type reference with a segment-register override.

If you temporarily use a seg-reg to contain a value other than the seg-id identified in the ASSUME statement, then you should use the

ASSUME NOTHING to indicate that the seg-reg no longer has the old value. You can use this redefined seg-reg in an explicit reference.

When the contents of the seg-reg are used for addressability, a seg-reg should never have a val ue that contradicts what the ASSUME

says it has.

3-14

:xample

ASSUME DS:DATA,SS:DATA,CS:CGROUP,ES:NOTHING MOV SI,OFFSET SOURCE

MOV Dr,OFFSET DEST MOV CX,LENGTH SOURCE

REP MOVS BYTE PTR [DIJ ,ES: [SIJ ;ES WILL BE USED AS THE

BASE REG FOR BOTH SOURCE AND DEST

Narning: If the ASSUME cs:seg-name is placed before the code :;egment it is referencing, the assembler will ignore the ASSUME. The

~SSUME cs:seg-name statement must follow the SEGMENT definition :;tatement of the code segment it is referencing.

rhe ASSUME statement for the cs register should be placed imme-::tiately following the code SEGMENT statement, before any labels are ::tefined in that code segment. See the SKELCOM.ASM, SKELEXE.ASM, and

)KELEXEP.ASM sample files included on your IBM Macro Assembler/2 ::tiskettes for examples of ASSUME usage.

COMMENT

Purpose

COMMENT lets you enter comments about your program without having to enter semicolons (;) for each line.

Format

COMMENT delimiter text delimiter Remarks

The first non-blank character after COMMENT is the first delimiter. The

COMMENT pseudo-op causes the assembler to treat all text between delimiter and delimiter as a comment. The text must not contain the delimiter character. This pseudo-op is used for multiple-line com-ments. A COMMENT defined in the body of a macro does not appear unless .LALL is requested.

Note: Do not use the COMMENT pseudo-op in structured Assembler source code to be processed by the SALUT utility.

Example

COMMENT *You can enter as many lines of text between the delimiters

as you need to describe your program.*

3-16

.CREF/.XCREF

Purpose

The output of the cross-reference information is controlled by these pseudo-ops. The default condition is the .CREF pseudo-op. When the assembler finds a .XCREF pseudo-op, cross-reference information results in no output until the assembler finds .CREF.

Format .CREF

or

.XCREF [operand]

Remarks

You must use the cross-reference utility to let these pseudo-ops func-tion.

Note: See the discussion of the Cross-Reference Utility (CREF) in the

IBM Macro Assemblerl2 Assemble, Link, and Run book for more information.

The .XCREF pseudo-op can have an optional operand consisting of a list of one or more variable names suppressed in the cross-reference listing.

Dans le document About This Book (Page 58-67)

Documents relatifs