Locati On Counters; Setting The Location Counters; Org - Xerox 530 Language And Operations Reference Manual

Table of Contents

Advertisement

5. LOCATION COUNTERS AND IPROGRAM SECTIONS
LOCATION COUNTERS
A location counter is a memory cell that the assembler uses
to keep track of the storage location it assigned last and,
thus, what location it
~,hould
assign next.
Each section of
a program has two location counters associated with it: the
load location counter (referenced symbol ically as $$) and the
execution location counter (ref.erenced symbolically as $).
An additional location counter, the common location counter,
is used and set only by the COMMON directive. COMMON
symbols may be referenced as COMMON relocatable oper-
ands.
However, COMMON symbols may not be assembled
wi th values.
The value of the load location counter is relative to the
origin of the source program (or program section when two
sections comprise a single program).
The execution loca-
tion counter is the location relative to an execution base.
The initial value of the location counters is specified at
assembly time.
Most users wi II be concerned only with the execution loca-
tion
~ounter;
that is, they wi II want to assemble relocatable
programs that can be loaded and executed anywhere in core
memory.
To have a relocatable program assembled relative
to some value other than zero, the programmer shou Id use
an ORG directive to designate the origin of the program
(or a section of a program). This directive sets the load
and execution location counters to the same value and
allows Extended Symbol to assemble the program relative
to that value.
The load location counter is a facility provided for systems
programmers to enable them to assemble a program that must
be executed in a certain area of core memory, load it into
a different area of core, and then, when the program is to
be executed, move it to the proper area of memory wi thout
having to alter any program addresses.
For example,
assume a program provides a choice of four different output
devices: paper tape, magnetic tape, punched cards, or line
printer. Atexecutiontime, onlyoneofthedevices will be
used.
In order to execute properly, the program must be
stored in core as follu..vs:
0000
lFFF
2FFF
Main Program
Desired Output Routine
To be used
for data
storage during
program
execution
Each of the four output routines would be assembled with an
initial execution location counter value of lFFF butdifferent
24
Location Counters and Program Sections
load location counter values (e.g., 1 FFF, 2FFF, 3FFF, etc.).
At run time all the routines could be loaded as follows:
0000
lFFF
2FFF
3FFF
4FFF
5FFF
Main Program
Magnetic Tape Routine
Paper Tape Routine
Typewriter Routine
Line Printer Routine
}
Execution area
for output routi ne
To be used for
data storage
during program
execution
When the main program has determined which output routine
is to be used, it moves that routine to the appropriate exe-
cution area.
No address modification is required at this
time since the routine was originally assembled to be exe-
cuted in that area.
If
the paper tape routine were selected,
it would be moved to the execution area beginning at
1 FFF, and memory from 2FFF and above could then be used
for data storage.
At the beginning of an assembly, Extended Symbol automat-
ically sets the value of the three location counters to zero.
The user can reset the location values for the load and exe-
cution counters during an assembly wi th the ORG and LaC dir-
ectives. The ORG directive sets the value of both of these loca-
tion counters. The LaC directive sets the value of only the
execution location counter. The COMMON directive alters
the value of the common location counter.
SETTING THE LOCATION COUNTERS
Unless the assembler is otherwise informed via a program sec-
tion directive, it assumes at the beginning of an assembly
that there is to be only one program section, and it sets the
three location cOL'ni"ers to zero. The user may designate val-
ues to be assigned to these location counters by means of
th,~
ORG, COMMON and LOC directives. Two other directives,
BOUND and RES, have a special effect on the load and exe-
cution location counters.
ORG
Set Program Origin
The ORG directive sets both the load and execution location
counters to the location specified.
This directive has the
form

Advertisement

Table of Contents
loading

This manual is also suitable for:

Sigma 3Sigma 2

Table of Contents