Previous Topic: Coding a COBOL Procedure ModuleNext Topic: Coding a PL/I Procedure Module


Coding an Assembler procedure module

The following module adds two numbers and returns the result to the main CA Culprit program.

Procedure Module

CULLUS94 CSECT
R0       EQU   0
R1       EQU   1
R2       EQU   2
R3       EQU   3
R4       EQU   4
R5       EQU   5
R6       EQU   6
R7       EQU   7
R8       EQU   8
R9       EQU   9
R10      EQU   10
R11      EQU   11
R12      EQU   12
R13      EQU   13
R14      EQU   14
R15      EQU   15
         STM   R14,R12,12(R13)     SAVE CALLER'S REGISTERS
         BALR  R3,0                ESTABLISH BASE REGISTER
         USING *,R3
         ST    R13,SAVEAREA+4
         LA    R13,SAVEAREA
         ST    R13,SAVEAREA+8
PROCESS  EQU   *
         LM    R4,R6,4(R1)         R4 ─► R6 POINTS TO ARG1 ─► ARG3
         ZAP   0(8,R6),0(8,R4)     ZERO ARG3, ADD ARG1
         AP    0(8,R6),0(8,R5)     ADD ARG2
RETURN   EQU    *
         L     R13,SAVEAREA+4      RESTORE REGISTERS
         LM    R14,R12,12(R13)
         BR    R14
SAVEAREA DS    18F                 SAVE REGISTER AREA
         B     RETURN
         END   CULLUS94