Professional Documents
Culture Documents
Very large assembly language programs will require more than one control
section.In any case, the programs we write will require only one CSECT,
even assuming the addressing constraints imposed by the old System/370
architecture.
A program with a single CSECT may be started in one of two ways. For
example,
the program LAB01 may be started in one of two ways.
LAB01 START
LAB01 CSECT
The assembler allows for the specification of a load address in the START
or CSECT.
This is probably a bad idea; it may be ignored by a modern operating
system.
The last line in the CSECT must be END Name, such as END LAB01.
4. What is the functionality of LTORG statement?
The assembler instruction that directs the location of the literal pool is
LTORG. It does not have any operands. If you do not use any LTORG
instructions in your program, the literal pool is placed at the end of the
first control section (CSECT) of your program.
When the assembler encounters a LTORG instruction within a program, it
creates a literal pool at that point, containing all the literals specified
since the last LTORG instruction, or since the beginning of the program, if
this is the first LTORG
To avoid addressability problems in multi modular programs, you should
code a LTORG instruction as the last instruction of each control section in
the program. So, each CSECT will have its own literal pool at the end of
the module.
MOD1 CSECT
LTORG
MOD2 CSECT
LTORG
MOD3 CSECT
LTORG
5. How base register is defined in an assembler program?
Base registers is defined as below
BALR R12,R0
USING *, R12
These statements are coded immediately below CSECT.
BALR instruction is RR type of instruction, which loads the address of the
next instruction into operand 1 i.e. R12. Second operand is specified as
R0 so no branch takes place.
USING establishes addressability. The * is used to represent the current
location counter in the assembler program. The USING instruction tells
assembler that R12 is to be used as the base register and that R12 will
contain the address of the current instruction.
Since BALR has loaded R12 with the address of the instruction following
BALR, this correctly Establishes address in the program.
6. How multiple base registers are defined in an assembler program?
Multiple Base registers are defined as below
BALR R12,R0
USING *, R12,R10,R11
BASE LM R10,R11,BASES
B MAIN
BASES DC A(BASE+4096)
DC A(BASE+8192)
MAIN MVC IN,OUT
SUB CSECT
STM
BASR R12,R0
USING *,R12
ST R13,SAVE+4
LA R13,SAVE
BASR R14,R15
In above scenario, MAIN is main program which calls subprogram
SUB. Standard entry statements would be same in the both cases, since
Main program also gets called by OS modules first.
Since we have very limited GPRS which should be shared between many
programs, it is the programmers responsibilty to save the contenet of the
register in the start of the program and restore the content of the
registers back when exit.
To store the contents, SAVE is delcared as 18 fullword.First fullword is
used by operating system. Second fullword stores address of the save
area of the calling program.Third fullword contains address of save area
of any called program from the current program.
Contents of registers 14,15,0,1,2,3,4,5,6,7,8,9,10,11,12 are stored in this
fullword thereafter.