Assembler Directives and Pseudo-Operations

.CALL Directive

;This program calls printf() with four arguments

;whose register locations are described in the .CALL directive.

;The format string goes into arg0, not to be relocated.

;The string “message” goes into arg1, specified as a general register.

;The floating-point value 57005.57005 goes into farg2,

;specified as a floating-point register.

;The hexadecimal number 0xf00d goes into arg3,

;specified as a general register.

;The return value from printf() is not to be relocated.

 

.LIT

 

 

 

 

 

.ALIGN

8

 

 

 

 

.WORD

1197387154

 

; floating-point literal

 

.BLOCKZ

12

 

 

 

fp2

.WORD

0

 

 

 

main

.CODE

 

 

 

 

.PROC

 

 

 

 

 

 

 

 

 

 

.CALLINFO CALLER,FRAME=24,SAVE_RP

 

 

.ENTER

 

 

 

 

 

LDIL

L’fp2,%r1

 

 

 

 

LDO

R’fp2(1),%r31

; r31 < - floating-point literal address

 

FLDWS

-16(%r31),%fr4

 

 

 

LDO

-64(%sp),%r19

 

 

 

FSTWS

%fr4,0(%r19)

 

 

 

ADDIL

L’61453,0

 

 

 

 

LDO

R’61453(%r1),%r20

 

 

STW

%r20,-68(%sp)

; end of stacking floating-point address

 

ADDIL

L’string_area-$global$,%dp

 

 

LDO

R’string_area-$global$(%r1),%r21

; point to “message”

 

STW

%r21,-60(%sp)

; stack “message” address

 

LDO

-64(%sp),%r22

 

 

 

FLDWS

0(%r22),%fr5

 

 

 

FCNVFF,SGL,DBL

%fr5,%fr6 ; convert floating-point value

 

ADDIL

L’string_area-$global$+8,%dp

 

 

LDO

R’string_area-$global$+8(%r1),%arg0

 

 

 

 

 

;point to format string

 

LDW

-60(%sp),%arg1

; load “message” argument

 

FSTDS

38,-16(%sp)

 

 

 

FLDWS

-12(%sp),%fr6

; load floating-point argument

 

LDWS

-16(%sp),%arg3

; load hexadecimal argument

 

LDW

-68(%sp),%r1

 

 

 

STW

%r1,-52(%sp)

 

 

 

.CALL

argw0=no,argw1=gr,argw2=fr,argw3=gr,rtnval=no

 

BL

printf,2

 

 

 

 

NOP

 

 

 

 

 

.LEAVE

 

 

 

 

Chapter 4

65

Page 65
Image 65
HP UX Developer Tools manual LIT Align Word