Download asmintro - Jay Moseley

Transcript
LINKAGE-3
When your routine is entered, first you
and then establish and link your own save area.
STM
14,12,12(13)
LA
ST
ST
LR
5,MYSAVE
5,8(13)
13,4(5)
13,5
should
save
registers
save regs. 14, 15, and 0-12 in
calling program's save area.
get addr. of my save area
link calling pgm. s.a. to mine
link my s.a. to calling pgm's
transfer pointer to s.a.
On return:
MYSAVE
L
13,4(13)
LM
BR
14,12,12(13)
14
DC
18F'0'
retrieve addr. of calling pgm's
save area
restore registers as they were
A calling program is known as a "higher routine", and the routine
called is the "lower routine". Register 13 is always to point to an
area whose contents may be destroyed.
An exception to the requirement that a routine must always
establish a save area is that the lowest-level routine (the one which
calls no others) need not set up a save area. The reason for this is
the save area is for the use of any called routines, but that
the
lowest-level routine will have no called routines.
It is important to know the conventions on save areas, but the
use of XSAVE AND XRETURN (consult appropriate documentation) can
reduce the problems in coding and linking save areas.
THE NAME CONVENTION is a means of having the EBCDIC form of the name
of a routine appear at certain key places on dumps.
To use this
convention, the first four bytes of a routine must be a branch, on
15 as a base register, which passes over a series of bytes.
These bytes contain the EBCDIC form of the name of a routine, and
also a length count for this name area.
This example shows how to
code a name field.
name
CSECT
B
m+1+4(,15)
DC
X'm'
DC
CLm'name'
next instruction.
The value of m must be odd, in order to have the next instruction
properly aligned.
An alternate approach uses the convention on
register 15:
name
NEXTINST
CSECT
USING
name,15
B
NEXTINST
DC
X'm'
DC
CLm'name'
next instruction