.th REL V "August 1, 1977"
.sh NAME
\&.rel \*- relocatable object module format
.sh DESCRIPTION
.it \&.rel
files are the runnable object files on the Delphi time-sharing system, and are
output by
.it macro
(I) and
.it bind
(I), which have been modified to run under UNIX.
.s3
Gross structure:
.lp +5 5
I.	Identification information:  title, prerequisite, time/date created.
.lp +5 5
II.	Symbol directory:  gives CSECT names, entry names,
global and (if desired) internal symbols, their values
and their attributes.
.lp +5 5
III.	Text:  a sequence of text blocks and relocation
directives interspersed, which indicate the actual code
and data content of the module.
.i0
.s3
.lp +5 5
I.	Identification information:
.lp +10 5
A.	Date/time created (6 bytes) - DELPHI format.
.lp +10 5
B.	Title (.asciz) - object module title.
.lp +10 5
C.	Prerequisite (.asciz) - a single zero byte means there
is no prerequisite.
.s3
.lp +5 5
II.	Symbol dictionary:  a sequence of commands declaring
symbols.  Associated with each symbol is an implicit
numerical ID, which is the index of this command in the
directory (i.e., the index of the first symbol is zero, the
second is 1, and so on).  The first byte of the command
identifies the type of symbol and determines the format of
the remainder of the command.  Arbitrary numbers of zero
bytes may be inserted anywhere between commands. The
commands are:
.lp +10 5
1.	CS (byte) - declares a CSECT
.lp +12 2
attributes (byte) - bits (starting at bit 0) are:  external/internal; I/D
space; pure/impure; absolute/relocatable
.lp +12 2
length (2 bytes) - length in bytes
.lp +12 2
name (.asciz) - .asciz string
.lp +10 5
2.	ST (byte) - declares a symbol table name (e.g., the
name of one object module that was bound into this
one).  However, any symbol can serve as a symbol
table name, so the ST declaration is more of a
"place holder" for otherwise homeless symbols than
anything else.
.lp +12 2
attributes (byte) - no attributes for now
.lp +12 2
table (2 bytes) - ID of the symbol table it belongs to
(or -1 if none).
.lp +12 2
name (.asciz)
.lp +10 5
3.	SYM (byte) - declares a symbol
.lp +12 2
attributes (byte) - bits are external/internal;
defined/undefined.  Other attributes are
determined by what CSECT the symbol belongs to.
.lp +12 2
value (2 bytes) - value of the symbol (offset in CSECT)
.lp +12 2
CSECT (2 bytes) - ID of the CSECT it belongs to
.lp +12 2
table (2 bytes) - ID of the symbol table it belongs to
(or -1 if none)
.lp +12 2
name (.asciz) - name of the symbol
.lp +10 5
4.	ENTRY (byte) - declare an entry point
.lp +12 2
attributes (byte) - I can't think of any attributes!
.lp +12 2
value (2 bytes) - offset in CSECT
.lp +12 2
CSECT (2 bytes) - CSECT ID
.lp +12 2
spares (10 bytes) - could be used for access, psw, etc.
.lp +12 2
name (.asciz) - name of the entry point
.lp +10 5
5.	END (byte) - marks the end of the symbol directory
and the beginning of the text section.
.lp +10 5
6.	MIXID (byte) - don't distinguish between pure I and
pure D space (MIXID must occur before anything
else in the symbol directory, and is not indexed
with an ID).
.lp +10 5
7.	HBF (byte) - specifies that the most significant byte of
of a 16-bit word has a lower address than the least
significant byte (as in the Motorola 6800 and opposed
to the DEC PDP-11 and INTEL 8080). HBF must occur before
anything (except MIXID) in the symbol directory, and is not
indexed with an ID.
.lp +10 5
8-20.	reserved.
.s3
.lp +5 5
III.	Text - a sequence of commands, in a format described
below.  Zero or more zero bytes may serve as filler between
successive commands.  Each command is introduced by a byte,
which indicates what the command is, followed by a variable
number of arguments, depending on the command.  If the
high-order bit of the byte is set, the command operates on
bytes rather than on words, except where this distinction is
clearly inapplicable (e.g., the "set location counter"
request).  The commands are listed here by command number:
.lp +10 5
21.	TXT (byte) - declares a block of binary text
.lp +12 2
length (byte) - number of bytes of text that follow
.lp +12 2
text ("length" bytes) - put this block of text in core
starting at the corrent position of the location
counter.
.lp +10 5
22.	TXTR (byte) - repeat block
.lp +12 2
length (byte)
.lp +12 2
count (2 bytes) - repeat the text block "count" times.
Also causes any relocation directives for this
text block to be repeated for each instance of the
text block.
.lp +12 2
text ("length" bytes)
.lp +10 5
23.	ABS (byte) - used for #A, where A is in the same CSECT
.lp +12 2
offset (byte) - into most recent text block.  Adds base
address of current CSECT to word/byte at
"offset".
.lp +10 5
24.	REL (byte) - used for A, where A is absolute
.lp +12 2
offset (byte) - subtracts base address of current CSECT
from datum at "offset" bytes into most recent text
block.
.lp +10 5
25.	ABSX (byte) - used for #A, where A is global or in another
CSECT
.lp +12 2
offset (byte) - adds value of ID (base address if ID
refers to a CSECT, value if ID refers to an
external symbol) to datum specified by "offset".
.lp +12 2
ID (2 bytes)
.lp +10 5
26.	RELX (byte) - this turns out to be almost useless!
.lp +12 2
offset (byte) - subtracts value of ID from datum.
.lp +12 2
ID (2 bytes)
.lp +10 5
27.	LCS (byte) - used for .BLKW
.lp +12 2
constant (2 bytes) - sets location counter to (current
CSECT base) + "constant".
.lp +10 5
28.	LCSX (byte) - used for moving to a new CSECT
.lp +12 2
constant (2 bytes) - sets location counter to (value of
ID) + "constant".
.lp +12 2
ID (2 bytes)
.lp +10 5
29.-63.	SPEC (byte) - used for, e.g., LISP
.lp +12 2
length (byte) - length of text below
.lp +12 2
code length (2 bytes) - SPEC block adds this amount to
location counter.
.lp +12 2
text ("length" bytes) - arbitrary sequence of bytes.
The standard loader will not process SPEC blocks,
but user-defined loaders might.  Relocation
directives do not apply to SPEC blocks.
.lp +10 5
64-127.	Reserved for use by librarian, etc.
.i0
.s3
The end of the object module is marked by the end of the file.
.sh "SEE ALSO"
macro (I), bind (I), relld (VI), reldld (VI), a.out (V)
