• Aucun résultat trouvé

Appendix A: Assembler language Information

Dans le document VS FORTRAN (Page 81-86)

The mathematical and service subprograms in the

vs

FORTRAN library can be used' by\the assembler language programmer. Successful use depends on three things:

(1) making the library available to the linkage editor; (2) setting up proper calling sequences, based on either a call macro instruction or a branch; and (3) supply cor-rect parameters.

U8RARY AYAILABIUTY

The assembler language programmer must arrange for the desired subprograms (modules) to be taken from the

vs

FORTRAN library and brought into main storage, usually as a part of the programmer's load module. This can be done by employing the techniques described in the OS/VS Linkage Editor and Loader, and Guide to the DOS/VSE Assembler, publications.

For example, the

vs

FORTRAN library could be made part of the automatic call library by using these job control statements:

Iljobname JOB desired operands

Ilstepname EXEC ASMFCLG,PARM.LKEO='XREF,LIST,MAP' II ASM.SYSIN 00·

(assembler language program source deck)

IILKED.SYSLIB 00 OSNAME=data set name,OISP=SHR

Subprograms requested in the source program would then be available to the linkage editor for inclusion in the load module.

CAWNG SEQUENCES

Two general methods of calling are possible: (1) coding an appropriate macro instruction (for OS/VS and VM/370 CMS, see OS/VS Supervisor Services and macro Instructions, and for OOS/VSE see DOS/VSE Data Management Concepts, and DOS/

VSE Macro User's Guide), such as CALL; or (2) coding assembler language branch instructions.

In all cases, a save area must be provided that:

• is aligned on a fullword boundary

• is at least as large as the size specified in Figures 13, 14, and 15, (but preferably the standard 18 words to ensure future compatibility)

• All extended precision mathematical subprograms (both explicit and implicit) use a1116 registers, and require their callers to supply a full 18 word save area.

• has its address in general register 13 at the time of the CALL macro instruction or branch

Notes:

1. For performance reasons, VS FORTRAN subprograms use certain floating-point registers (see Figure 14), but do not save and restore original register con-tents. If you wish floating-point information retained, you must save it before calling the subprogram and restore it on return.

2. From the OOS/VSE control program register 1 is not used but the execution parameters are passed as bit settings in the communications area.

Appendix A: Assembler Language Information 79

If the called subprogram uses VS FORTRAN input/output, error processing, or

inter-ruption routines (see Figure 17), the calling program must initialize the execution

0

environment by executing the following two instructions before the branch is made:

L 15,=V(VSCOM#) BAL 14,64(15)

These instructions cause a branch into the VSCOM# subprogram, which initial-izes return coding and prepares routines to handle interruptions. If this initializa-tion is omitted, an interrupinitializa-tion or error may cause abnormal terminainitializa-tion. (After initialization, VSCOM# returns to the instruction following the BAL.)

Note:

An initialization entry to VSCOM# is not required if the main program is written in FORTRAN, and the assembier ianguage routine is an intermediate.

o

o

o

o

Save Area Registers U se<P Entry Name ( s) . ( Ful1words ) Result Intermediate

Figure 13. Assembler Information for the Explicitly Called Mathematical Subprograms

Save Area Registers Used1 Entry Name(s} ( Fullwords ) Result Intarmediate

CDMPY#, CDDVD# 5 0,2 4,6

Figure 14. Assembler Information for the Implicitly Called Mathematical Subprograms

Entry Name(s) Save Area (Fullwords)

CCMPR# 18

CMOVE# 18

CNCAT# 18

LGE, LGT, LLE, LLT 18

Figure 15. Assembler Information for the Implicitly Called Character Subprograms.

Figure 16. Assembler Information for the Service Subprograms

18 10 5 10

Appendix A: Assembler Language Information 81

When a branch instruction rather than a call macro instruction is used to invoke a subprogram, several additional conventions must be observed:

• An argument (parameter) address list must be assembled on a fullword bound-ary. It consists of one 4-byte address constant for each argument, with the last address constant containing a 1 in its high order bit.

• The address of the first item in this argument address list must be in general register 1.

• From the DOS/VSE control program register 1 is not used but the execution parameters are passed as bit settings in the communications area.

• The address of the entry point of the called subprogram must be in general register 15.

• The address of the point of return to the calling program must be in generai . register 14.

The total requirements for an assembler language calling sequence are illustrated in Figure 14.

0'"

( .... \

)

(0;

For more than one argument

arglist DC A (argl)

Figure 17. General Assembler Language Calling Sequence

These two statements are necessary only if the called subprogram uses FORTRAN input/output. error, or interrupt routines (see Appendix B), and if the main program is not a FORTRAN routine .

General register 13 contain~ the address of the save aren.

General register 1 contains the address of the argument list.

General regi.<;ter 15 contains the address of the subprogram.

General register 14 contains the address of the point of return to the calling program.

This statement is optional. The id represents an identification number.

This number is supplied by the programmer and may be any hexadecimal inte$(er less than 21ft -1.

NOTE: In this case, dle entry name must be defined by an EXTRN instruc-tion to obtain proper linkage.

This statement defines the save area needed by the subprogram. The xx repre-sents the minimum size of the save area required; however, the programmer is advised to use a save area of 18 fullwords for all subprograms. (The minimum save area requirements are given in Figures 13 and 14 for the mathematical subprograms and in Figure 16 for the service subprograms.)

Aligns the .ugumeut list at a fullword boundary.

Places a 1 in the high order bit of the only argument.

Contains the address of the argument.

Contains the address of the first argument.

Contains the address of the second argument.

Places a 1 in the higb order bit of the last argument.

Contains the address of the last argument.

Appendix A: Assembler Language Information 83

Dans le document VS FORTRAN (Page 81-86)