P. 1
OS390 Assemble Programming

OS390 Assemble Programming

|Views: 5,014|Likes:
Published by Sreenivas Rao

More info:

Published by: Sreenivas Rao on Apr 30, 2011
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

07/18/2013

pdf

text

original

In this case, the code to return control should not
be duplicated, so that there is a separate copy for
each possible return code.

Instead, return code can be placed in a variable in
storage, say a halfwordcalled RC. A single return
sequence places this value into R15.

Since you cannot address RC after restoring the
caller’s registers, set R15 and then restore
registers, without overwriting the value in R15.

However, this can cause addressability problems.

Continued…

Unit:Modular Programming

• RC Cannot Be Restored After
Restore Caller’s Registers

Addressability Problems:

• R15 Cannot Be Set Prior To
Restoring Registers, Without
Overwriting Contents of R15

Concepts

Topic:Passing and Receiving Control

OS/390 Assembler Programming Introduction

©Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 328of 58

There are two possible methods to solve addressability problem. The methods are explained here:

•In the first method, the value can be set into R15, and then theregisters can be restored, except for

R15

•The other method is to put the desired return code value not into R15, but into R15 slot in the caller’s
save area. It will then be restored when the Load Multiple is completed prior to returning.

Returning Control: Solution to Addressability Problem

Unit:Modular Programming

Concepts

Topic:Passing and Receiving Control

First Method:

LH R15,RC Sets return code
L R13,4(,R13) Restores the old SA pointer
L R14,12(,R13) Restores R14
LM R0,R12,20(R13) Restores R0 to R12
BR R14 Returns to the caller

Second Method:

LH R3,RC Getsthe return code
L R4,4(,R13) Getsthe old SA address
ST R3,16(,R4) Stores RC in R15 slot in old SA
(There may be other instruction here)
L R13,4(,R13) Restores the old SA address
LM R14,R12,12(R13) Restores the caller’s regs
BR R14 Returns to the caller

OS/390 Assembler Programming Introduction

©Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 329of 58

Single and Multiple Assemblies

While creating a multi-modular Assembler
Language program, modules can be assembled in
a single assembly or assembled separately.

Assembling the modules together provides the
advantage of only having a single source file to
manage.

The main disadvantage is that names must be
unique within an assembly.

Continued…

Unit:Modular Programming

B CSECT

A

CSECT

B CSECT

A

CSECT

FILE 1

Single
Assembly

Multiple
Assembly

FILE 1

FILE 2

Concepts

Topic:Passing and Receiving Control

OS/390 Assembler Programming Introduction

©Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 330of 58

Single and Multiple Assemblies (cont’d)

When the number of modules exceeds 3 or 4, it is
better to use separate source files.

The linkage editor combines individual object
modules into a single, executable module.

It does this by matching external references (V-
type adconsin your program), with external
CSECT names in your program.

Unit:Modular Programming

Main CSECT
.
.
.
L R15,=V(SUB)
BALR R14,R15

SUBCSECT

FILE 2

FILE 1

Identical
Names

Concepts

Topic:Passing and Receiving Control

OS/390 Assembler Programming Introduction

©Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 331of 58

Parameter Lists

The mechanism used for passing data between
modules is the parameter list. A parameter can be
defined as a list of the addresses of the data being
passed from caller to called module.

Each entry in the parameter list is a fullword,
containing the address of the corresponding data.
Regardless of whether the actual data is a single
byte in length, or many thousands of bytes, it is the
address of the data that is passed, and this fits in a
fullword.

Continued…

Unit:Modular Programming

Address of
DATA 1

Address of
DATA 2

2 Entry Parameter List:

PLIST

DATA1

DATA2

Topic:Passing and Receiving Data

Concepts

OS/390 Assembler Programming Introduction

©Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 332of 58

Parameter Lists (cont’d)

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->