• Aucun résultat trouvé

MACRO BODY

Dans le document · MACRO XVM ASSEMBLER LANGUAGE MANUAL (Page 76-84)

TAG+1 -I LAS ..J

4.2 MACRO BODY

The body of the macro definition follows the .DEFIN statement. Appear-ances of dummy arguments are marked and the character string of the body is stored, five characters per two words in the macro definition table, until the macro terminating pseudo-op .ENDM is encountered.

Comments within the macro definition are not stored.

Dummy arguments may appear in the definition lines only as symbols or elements of an expression. They may appear in the label field, opera-tion field, or address field. Dummy arguments may appear within a literal or they may be defined as variables. They will not be recog-nized if they appear within a comment.

The following restrictions apply to the usage of the .DEFIN, .ETC and .ENDM pseudo-ops:

a. If they appear in other than the operation field within the body of a macro definition, they will cause erroneous results.

b. If .ENDM or .ETC appears outside the range of a macro defini-tion, i t will be flagged as undefined.

If index register usage is desirable, it should be specified in the body of the definition, not in the argument string .

. DEFIN LAC A DAC B,X LAC C

.ENDM

XUSE,A,B,C

If .ASCII or .SIXBT is used in the body of a macro, a slash (I) or number sign (#) must not appear as part of the text string or as a de -limi ter (use < 57 > to represent a slash and < 43 > to represer.t a number sign). Be careful when using a du~my argument name as part of the text string. For example,

.DEFIN .SIXBT .SIXBT

• ENDM

TEXT A ,A, .A •

followed by the macro call, TEXT XYZ

will generate the following code .SIXBT

• SIXBT

,XYZ, .A •

In the first .SIXBT statement, A is recognized as a dummy argument re-sulting in the substitution of XYZ. In the second statement, A is not recognized as a dummy argument because the string delimiter, period, is itself a legal symbol constituent.

Definition Comments

-I • DEFIN -I MAC,A,B,C,D,E,F -I LAC -I A#

-I SPA

-IJMP -I B

-IISZ -I TtvlP

I E

E is not recognized as an argument -I LAC -I (C

-IDAC -I D + 1 -IF

-I.ASCII -IE B=.

-I.

ENDM 4.3 t.1ACRO CALLS

A macro call consists of the macro name, which must be in the operation field, followed by a list of real arguments separated by commas and terminated by one of the characters listed below.

a. space (~)

b. tab

(-I )

c. carriage ( ) )

return

If the real arguments cannot fit on one line of coding, they may be continued on succeeding lines by terminating the current line with a

dollar sign ($). When they are continued on succeeding lines they must dummy arguments associated with it.

Example:

4.3.1 Argument Delimiters

It was stated that the list of arguments is terminated by any of the following symbols.

a. space b. tab

c. carriage return ()

These characters may be used within real arguments only by enclosing them in angle brackets

«».

Angle brackets are not recognized if they appear within a comment.

Example:

./

G ' •• J

.i .. ,'::

(I () () C' <> h. .::.-: (.: <) <> () '.:.i' 0<) <)0:1. i :.: ~'::~ ..:':; () () J ()

<> (~.: r:'" i'.> ~:5 r;~

..:'}

<> (:. 3 () (>i ::f:: (:.:;

00006 n 040011 R *G

00010 R 000065 A 00011 R 000000 A

." -... , : ::: ~ ; ... :

i ... (, c:.

/2:

'I',

.\:'

"j' .,(

.; .... ,.

:.: ~.: .. y .. {

,,/

,.,.-.. ; .... ; .

All characters within a matching pair of angle brackets are considered to be one argument, and the entire argument, with the delimiters

«»

removed, will be substituted for the dummy argument in the original definition.

The Assembler recognizes the end of an argument only on seeing a ter-minating character not enclosed within angle brackets.

If brackets appear within brackets, only the outermost pair is deleted.

If angle brackets are required within a real argument, they must be enclosed by argument delimiter angle brackets.

Example:

.DEFIN ERRMSG,IE<T

ERRMSG ('ERROR IN LINE'~15)

/

I' .. ! 00000 R 600007 R *G

00001 R 426452 A *G 00002 R 247644 A *G 00003 R 202231 A *G 00005 R 446350 A 1G 00006 R 506400 A *8

4.3.2 Created Symbols

1'1':; 1 i·1 r

" C 17:: h: U h: ::: r. .. ~ : .. I I\! [: I <: :!. ~:.:.; .,:'

Often, i t is desirable to attach a label to a line of code within a macro definition. As this label is defined each time the macro is called, a different symbol must be supplied at each call to avoid multiply defined symbols.

This symbol can be explicitly supplied by the user or the user can implicitly request the Assembler to replace the dummy argument with a created symbol which will be unique for each call of the macro. For example,

-/.DEFIN-jMAC,A, ?B

The question mark (?) prefixed to the dummy argument B indicates that i t will be supplied from a created symbol if not explicitly supplied by the user when the macro is called for.

The created symbols are of the form •. 0000+ •. 9999. Like other symbols, they are entered into the symbol table as they are defined.

Unsupplied real arguments corresponding to dummy arguments not preceded by a question mark are substituted in as empty strings; and supplied real arguments corresponding to dummy arguments preceded by a question mark suppress the generation of a corresponding created symbol.

Example: .,

,., .i.

",','.

6

10

D::::,;.

. .. 1:':1'"

L(:,C D{:",C:

·,.ENXh··:

(1 (:.,C

D

0000::;:: r;: ~1)OO()O(, r' ", process is called concatenation.

The following example illustrates this operation.

:I. .DEFIN CALL,TYPL.ADDR

:I. with the concatenation operator. The following example illustrates this rule.

In this example concatenation is used to test the existence of a named temporary location, and, if necessary, output code to define it. Then the concatenation operator - Assembler delimiter rule is presented by concatenating two dummy arguments and other characters beginning with a delimiter. In detail, one such concatenation string is a delimiter (Le.,-.j),· a dummy argument (Le., FROM), the concatenation operator (i.e., @), a second dummy argument (i.e. , LVL) , finally followed by other characters beginning with a delimiter (i.e., ,X).

The general case of real argument for dummy argument substitution per-formed by MACRO is the application of the "other characters beginning with a delimiter" rule presented above. In other words, argument

sub-stitution may be thought of as concatenation when the dummy argument is bounded by delimiters, rather than a concatenation operator.

Note that one ambiguous case can arise in use of the concatenation opera-tor when the other character string to be concatenated with an argument value is the same as a dummy argument name. The following example illustrates this problem.

t,..I rC~:>(;·;'L.i..J;···.i

.. ;' ~\'i :;: -.. !::. \.-' .:.-'..}

-~ ; .. ' , ..

C:(, .

c· .. ·

..;' .. '

This macro was written with the intention of satisfying the following flow diagram.

OUTPUT WAITFR CODE, 16l1/J WITH LABEL "WTCPlun"

1

OUTPUT THE ADDRESS OF LABEL "EVlun"

YES

6 OUTPUT THE VALUE

Dans le document · MACRO XVM ASSEMBLER LANGUAGE MANUAL (Page 76-84)

Documents relatifs