Assembler Directives and Pseudo-Operations

.MACRO Directive

and prevents the label from being referenced from outside the body of the macro definition. This suffix also contains a number that is used as a counter by the Assembler.

The following example defines the macro PRINT, which calls the printf() function (see printf(3S) in HP-UX Reference). The macro parameter DATA_ADDR is used to set up the argument to be passed to printf().

PRINT .MACRO

DATA_ADDR

ADDIL

L'DATA_ADDR,%dp

.CALL

 

BL

printf,%rp

LDO

R'DATA_ADDR(%r1),%arg0

.ENDM

 

The next example defines the macro STORE. STORE places the contents of the register REG, the first macro parameter, into the memory address LOC, the second parameter.

STORE

.MACRO

REG,LOC

 

LDIL

L'LOC-$global$,%r1

 

STW

REG,R'LOC-$global$(%r1)

 

.ENDM

 

100

Chapter 4

Page 100
Image 100
HP UX Developer Tools manual 100