R 21_Time Sharing_System_Reference_Oct68 21 Time Sharing System Reference Oct68

R-21_Time-Sharing_System_Reference_Oct68 R-21_Time-Sharing_System_Reference_Oct68

User Manual: R-21_Time-Sharing_System_Reference_Oct68

Open the PDF directly: View PDF PDF.
Page Count: 106

DownloadR-21_Time-Sharing_System_Reference_Oct68 R-21 Time-Sharing System Reference Oct68
Open PDF In BrowserView PDF
REFERENCE MANUAL
TJME- SHARING SYSTDi

L. Peter Deutsch
Larry Durham
Butler W. Lampson
t'fn1versity of California, Berkeley

Document No. R-2l

Revised October 22, 1968
Office of Secretary of Defense
Advanced Research Projects Agency
Washington, D. C.
20325

TABLE OF CONTENTS

....

1.0

Introductory. .
2.0 The Scheduler. .
PAC TABLE . .
Phantom user queue entry ••
3.0 Forks and Jobs . •
3.1 Creation of Forks •
Hierarchy of Processes • •
3.2 Memory Acquisition. • •
3.3 Panic Conditions. •
3.4 Jobs • • . • • • •
Job Tables •
4.0 Program Interrupts • •
5.0 The Swapper and Memory Allocation ••

1-1
2-1
2A

2B

3-1
3-1

......

3-5

. ".

...

6.0 Miscellaneous

Featur~s

.

3A
3-4

...

3-7
3B

4-1
5-1
6-1

TELETYPE SYSTEM POINTERS

7-1
7A

TElETYPE TABLE •

7B

TELETYPE BUFFERS •

7C

7.0 Teletype Input-Output. • • ·

8.0 Drum and Buffer Organization; Devices.
8.1 File Storage on the Drum. • . • • •
8.2 File Buffers • . • . • .
8.3 Devices. • • • • •
Layout of a File Buffer.
Forma~ of an Index Block • .
Device Indexed Tables • • • • •
9.0 Sequential Files . . . • • .
9.1 Sequential Drum Files .
9.2 Other Sequential Files.
9.3 File Control Blocks .•
9.4 Permanently Open Files.
10.0 Random Drum Files • . • • .
10.1 Direct Drum Access
11.0 Subroutine Files . • • •

8-1
8-1

8-2
8-3
8A
8A

8B
9-1
9-1
9-7
9-11
9-11
10-1
10-3
11-1

12.0

File Naming System . . . • . •
12.1 File Naming. . . . • •

• .
12.2 Accessing Other Users' Files, Special Groups
12.3

Pseudonyms. . . . . • • . • • .

. . . .

12-1
12-2
12-4
12-5

Doing I/O to Files, File Numbers
12.5 Opening Input Files •.
TAPE or PERMANENT FILES.

12-6

SCRATCH

.

12A-l

BUILT-IN FILES .

12A-1

SPECIAL GROUPS .

12A-2

PSEUDONYMS. . .

12A-2

FILE DIRECTORY DESCRIPTION
USER DIRECTORY DESCRIPTION .

l2A-3
l2A-4

12.4

FII~S.

12-5
12A-l

Opening Output Files •

12-8

12.7

Miscellaneous File Operations. .

12-10

12.8

Opening Scratch Files. . . . • .

. 12.6

.• . .

12-12

Format of the File Directory, Some Implementation
Details . . . ~ . . . . • . . . .
12.10 Miscellaneous Services . . .

12-14

Miscellaneous Executive Features .

13-1

12.9

13·0

14.0 StrinG Processing System .
14.1 Strine Pointer Load and Store Operations.
14.2 String Read and Write Operations • . . . . • .
14.3 String Compare Operations
14.4 String Input/Output . • • . •
14.5 Hash Table J~okup Instructions .
15.0 Floating Point Instructions • • • • . • • .
15.1 Floating Point Representation •.
15.2 Floating Point Arithmetic • . •
15.3 Input/Output Formats and Conventions
15.4 Input/Output Operations.. • • • .
BRS TABLE.

SYSTEM PROGRAMMED OPERATORS. .

12-13

14-1

14-1
14-1
14-3
14-3

14-4
15-1
15-1
15-2

15-3
15-4
A-I
B-1

1-1

1.0

Introductory
The Berkeley Time-Sharing System is divided into three major

parts:

The

monitor, the executive, and the subsystems.

Only

the first two of these are discussed in detail in this manual.
The manual attempts to describe exhaustively all the features
of the monitor and in addition to give a number of implementation
details. It also describes those features of the executive which
can be invoked by a program.
We use the word monitor to refer to that portion of the system
which is concerned with scheduling, input-output, interrupt
processing, memory allocation and swapping, and the control of
active programs. The executive, on the other hand, is concerned
with the control of the directory of symbolic file names and
backup storage for these files, and various miscellaneous matters.
Other parts of the executive handle the command language by
which the user controls the system fram his teletype, the
identification of users and specification of the limits of
their access to the system. These subjects are discussed in
the executive reference manual, Document R-22.
The next ten sections of this manual discuss various features
of the monitor.

The remaining sections deal with the executive.

2-1
2.0

The Scheduler
The primary entities with which the time-sharing system is

concerned are called active programs.

Each active program is an

abstract object capable of executing machine instructions.

At

least one active program is associated with each active user, but
a user may have many programs, each computing independently under
his control.

An active program is defined
active table (PAC table or PACT).

by its entry in the program

This table contains all of the

information required to specify the instantaneous state of the
extended computer which the user is programming, except for that
contained in the user's memory or in the system's permanent
tables.

The structure of' a PACT entry is displayed on the

following page, together with brief notes about the significance
of the various items.

These matters will be explained in more

detail in the following few sections.

It will be observed that

PACT contains locations for saving the program counter and the
contents of the active A, B and X registers.

It also contains

two pseudo-relabeling registers for the user.

A third one, which

specifies the monitor map, is kept in the job tables.

The matter

of pseudo-relabeling is discussed in detail in Section 5.

There

is a word called PTEST which determines the conditions under
which the program should be reactivated if it is not currently
running.

The panic table address in PTAB and the three pointers

called PFORK, PDOWN and PPAR are discussed in Section 3 on forks.
The word called PTAB contains in bits 2 through 8 the number
of the job to which this program belongs.

The top of PQU contains

information about the amount of time for which the program is
allowed to compute before it is dismissed.

A job table called QUR

counts the number of clock cycles remaining before the program is
dismissed, and three bits of QUTAB point to a table which specifies
the length of time which the program should be allowed to run
when it is activated.

All times 1n the discussion are measured

in periods of the 60-cycle computer clock.

2A
PAC TABLE

next queue or next program in queue

PNEXT
PL

~

U
M

0
V

0

file if of 8
subroutine 0
file

saved (p)

I

I

saved (A)

PA

j

1

PB

saved (B)

PX

saved (X)

I
r

I

I
I

I

RLl

l'i.rst pseudo-relabeling register

RL2

sec()nd pseudo-relabeling register
11 12

0

PTAB

PF¢RK

I
000

prEST

PQU

23

pj6w~r

PPTR

13

.

I ~ctl~a~lon

test word address, or other
relevant parameter

2

8
Job

number

PIM

UM

~I

T N

w

T

= user

I

PPAR

23

0-0

panic table address

0

~--

M
T

231
231

11 12
GlJrAB

Q,N

0

M

0

~o

8 9

B

L

8

~:ondltlon

E ~2

X

.

23
rEM

mode (l) or system

OV = overflow

pn¢WN = PACT address of lower fork (if any)
PFPRK
FPAR

=
:=

PACT address of upper fork (if any)
PACT address of pa.rallel fork (ends with 0)

QUTAB = address of word in table indicating quantum lengths

EX

= executive type program

Q~

= saved queue number

rEM

i~

EB
on QOV TW

= interrupt enabled mask

1M = local memory
MT = add no memory

= exec BRS
= waiting for

termination

NT

= non-terminable

EM

= destroy

memory when fork
is terminated

2-2

A program is a.lloT..red to run for a fixed period of time, after
which it is dismissed if any other programs are ready to run.
time is called a long quanttun.

This

It may be different for different

programs. In fact, the size of the long quantum is determined by
the entry in QTAB which is pointed to by the program's QUTAB in PACT.
When a program is activated, it is first allowed to run for a
short quantum. During this time it cannot be dismissed except by its
own request. The length of the short quantum is tentatively going
to be the same for all users. It is put into a word called TlME;
the long quantum is also put into a word called TTlME at this time.
Both are decremented at every clock cycle.
When

TIME

goes negative, a word called ACTR is checked to

determine whether any program which is dismissed for I/O can be
run.

If not, the program is allowed to continue.

At each subsequent

clock cycle the program may be dismissed if any programs dismissed
for I/O are ready to run.

It may also be dismissed when the long

quantum is exhausted if· any other programs are waiting to run.

In

either case it is said to. be dismissed for quantum overflow. If
ACTR indicates that another program dismissed for I/O is ready to
run at the end of the short quantum, the program is also dismissed
for quantum overflow.
In order to allow an efficient

~plementation

of this scheme,

ACTR is incremented by every interrupt routine which takes action
allowing a program which is waiting for I/O to run.

ACTR is set

to -1 when a program is activated.
When a program is dismissed for I/O, TT:mE is put into QUR.
When the program is reactivated, TTIME is set from QUR. TIME is reset
to the full short quantum. That is, the long quantum is allowed to
run down while a program computes, regardless of whether it has to
wait for I/O between compute,tions. On the other hand, a program is
always given a full short quantum. If a program is dismissed for
quantum overflow, it is given a new long quantum when it is reactivated.
There are two operations available to the user which are
connected with the quantum overflow machinery. BRS 45 causes the
user to be dismissed as though he had overflowed his quantum.
BRS 57 guarantees to the user upon return at least 16 msec of

2-3
computation. This feature is implemented by dismissing
the user if less tha.n 16 ;TI~;ec remain in his quantum.

uninterr~pted

Ordinarily, the code which is being executed at any particular
instant is that belonging to the program which is currently active.
This situation may be disturbed, however, by the occurrence of
interrupts from I/O devices.

These interrupts cause the computer

to enter system mode and are processed entirely independently of the
currently running program. They never take direct action to disturb
the running of this program, although they may set up conditions
in memory which will cause some other program to be activated when
the presently running one is dismissed. Interrupt routines always
run in system mode. Other code which may be running which may not
belong to the program currently active is the code of system
programmed operators or BRS routines.

These routines s.re not

re-entrant and therefore should not be dismissed by the clock.

To

ensure that they will not be, the convention is established that
the clock will not dismiss a program running in system mode.

In

order to ~larantee that a·user program will not monopolize the
machine by executing a large number of SYSPOPs, the user mode trap
is turned on when the clock indicates that a program is to be
dismissed. The trap will occur and cause dismissal as soon as the
program returns to user mode.
The PACT word called PTEST contains the activation condition
for a currently inactive program. The condition for activation
is contained in the 6 opcode bits of this word, while the address
field normally contains the absolute address of a word to be
tested for the ~pecified condition. (ThiS word is usually something
like TTYBRK for a user's teletype~ It is possible, however, for
the address to contain a time count, in the case where the activation
condition is that a certain amount of time should elapse.

It is also

possible for the address to hold a mask indicating which program
interrupt has occurred. The following activation conditions are possible:

o
I
2
3

4

5

Word greater than 0
Word less than or equal to 0
Word greater than or equal to 0
Word less than or equal to teletype early warning
Special test. The address points to a special activation
test routine.
Interrupt occurred. The address contains the number of
the interrupt which occurred.

2-4

7

11

12

Special: address

=

a

dead

1

running

2

BRS 31

3
4

BRS 106

5

BRS 109

executive BRS

Bit 1 of word is 1 (buffer ready)
Word less than zero

An executive program can dismiss itself explicitly by putting a queue
number (0 to 3) in X and a dismissal condition in B and executing BRS 72.

The

address of a dismissal condition must be absolute.
There is normally one running program in the system, i.e., a program which
is executing instructions, or will be executing instructions after the currently
pending interrupts have been processed.

An active program (i.e. a PACT entry)

which is not running is said to be dismissed, and is kept track of in one of
two ways.

1)

If it has dismissed itself with BRS 31, 106 or 109 (cf. section 5) it is

said to be in limbo and is pointed to only by the PFORK, PDOWN, and PPAR of the
neighboring programs in the fork structure.
2)

If it has been dismissed for any other reason, it is on one of the

scheduler queues.
QTI
QIO
QSQ

QQE

There are four queues of dismissed programs.
programs
programs
programs
programs

dismissed
dismissed
dismissed
diSmissed

for
for
for
for

In order, they are:

teletype inp11t/output
other I/O
exceeding their short quanta
exceeding their quanta.

Programs within the queues are chained together in PNEXT, and PNEXT for the last
program in each queue points to the beginning of the next queue.
Whenever it is time to activate a new program, the old program is put on
the

~

of the appropriate queue.

The scheduler then begins at QTI and

scans through the queue structure looking for a program whose activation
condition is satisfied.

When one is found, it is removed from the queue

2-5

structure antI

t;.~l";~C'(J

(~"ICl'

tc tJ}C s",rap:pcr to be read in and run.

If there

are no prograr:_s ,'Thich ca.!, be act:i vated the scheduler simply cont inues

scanninG the queue

strl._:t~ture.

Programs reactivated for various r.easons having to do with forks
(interrupts, rubouts, panics) are put onto QIO with an immediate
activation condition.

They therefore take priority over all

progrfu~s

dismissed for quantum overflow.
There is a permanent entry on the -teletype queue for an entity called
the phantom user.

The activation condition for this entry is a type 4

condition which tests for two possibilities:
a)

the cell PUCTR is non-zero

b ) three seconds have elapsed since the last activation of the phantom
user for this condition.
\'lhen the phantom user is act i vated by (b) , it runs around the system
that everything is functioning properly.

checkinF~

In particular, it checks that the

W-buffer has not been waiting for an interrupt for an unusual length of time,
and that all teletype output is pItteeding normally.

Details of this procedure

are described in sections 9 and 7.
If the phrultom user is activated by (a), it runs down the phantom user
queue looking for things to do.

A phantom user queue entry is drawn on page

2B; it is essentially a very abbreviated PAC table entry.

Such an entry is

made when the system has some activity which it wants to carry out more or
less independently of any user PAC table entry: testa for tape ready (on
rewind) and card reader ready, and processing of rubouts (an interrupt routine
kind of activity, but too time-consuming).
activation condition.
user queue.

The second word of the entry is the

PUCTR contains the number of entries on the phantom

2B

Pointer to next entry

p
5
test number

9

p

23
routine address
11 12

PACPrR for user

parameter for 23
routine

Phantom user queue entry

3-1

3.0 Forks and Jobs
3.1 Creation of Forks
A program

m~v

executing BRS 9·

create new, dependent, entries in the PAC table by

This BRS takes its argument in the A register, which

contains the address of a panic table, a 7-word table with the following
format:
Program COlmter
A register
B register
X register
First

relabelin~

register

Second relabeling

re~ister

status
The status word may be:
-2

dismissed for input-output

-1

running

0

dismissed on rub cut or BRS 10

1

dismissed on illegal instruction panic

2

dismissed on memory panic

The panic table -address must not be the same for two forks of the same program,
or overlap a

pru~e

boundary.

If it is, BRS 9 is illegal.

The first 7 bits of

the A register have the following significance:

o

make fork executive if current program is executive

1

set fork relabeling from panic table.
relabeling

2

propagate rubout assignment to fork (see ERS 90)

3

make fork fixed memor.l.. It is not allowed to
memory than it is started with.

Otherwise use current

obt~ ":.in

any more

,

.

I

1.

UP

0
lI-

~)

DOHl'J·
ACROSS

.

-:--

1

J
1-

1-

I.~.,....

t-

1,

"r

1

5.

1

~

O

6

)

0

b ::-----------.---..-.. -.--,

L

I

~

.)

6.

.J'

C)

l
"...

o

.-

')

I-

10
0

t.

8.

---

~

c

10.

6 ~
r---

o

r~l

9· r'

l)

~

o

! -

o

(j
~.

f'

V

"----

Hierarchy of Processes

3-2

4.

make fork local memory. New memory will be assigned
to it independently of the controlling fork.

5.

make fork ephemeral memory. Memory that it acquires
will be released when the fork terminates.

6.

set interrupt mask from seventh word of panic table.

When BRS 9 is executed, a new entry in the PAC table is
created.

This new program is said to be a fork of the program

creating it, which is called the controlling program.

The fork

is said to be lower in the hierarchy of forks than the controlling
program.

The latter may itself be a fork of some still higher

program.

The A, B and X registers for the fork are set up from

the current contents of the

p~~ic

table.

The address at which

execution of the fork is to be started is also taken from the
panic table.

The relabeling registers are set up either from

the current contents of the panic table or from the relabeling
registers of the currently running program.
may change the relabeling as it pleases.

An executive program

A user program is

restricted to changing relabeling in the manner permitted by
BRS 44.

The status word is set to -1 by BRS 9.

The fork structure is kept tract of by pointers in PACT.
For each program PFORK points to the controlling fork, PDOWN
to one of the subsidiary forks, and PPAR to a fork on the same
level.

All the subsidiary forks of a single fork are chained

in a list.

A complex situation is shown on the previous page.

The arrows indicate the various pointers.
The program executing a BRS 9 continues execution after the
instruction.

The fork established by the BRS

9 begins execution

at the location specified in the panic table and continues
independently until it is terminated by a panic as described
below.

It is connected to its controlling program in the

following three ways:
1)

The controlling program may examine its state and

control its operation with the following six instructions:

BRS 30

read.s the current status of a subsidiary fork into
the panic table.

It does not influence the operation

of the fork in any way.
BRS 31

causes the controlling program to be dismissed until
the subsidiary fork causes a panic.

When it does, the

controlling program is reactivated at the instruction
following the BRS 31, and the panic table contains the
status of the fork on its dismissal.
put into
BRS 32

The status is also

x.

causes a subsidiary fork to be unGondi tionally terminated
and its status to be read into the panic table.

All of these instructions require the panic table address of the fork in A.
They are illegal if this address is not that of a panic table for some fork.
ERS 31 and BRS 32 return the status word in the X register, as well as
leaving it in the panic table.

This makes it convenient to do an indexed

,jump ,.,i th the contents of the status word.

BRS 31 returns the paniC table

address in A.
BRS 106

causes the controlling program to be dismissed until any
subsidiary fork causes a panic.

When it does, the

controlling program is reactivated at the following
instruction with the panic table address in A, and the
panic table contains the status of the fork at its dismissal.
BRS 107

causes ERS 30 to be executed for all subsidiary forks.

BRS loB

causes BRS 32 to be executed for all subsidiary forks.

3-4

2)

If interrupt 3 is armed in the controlling fork, the termination

of any subsidiary fork will cause that interrupt to occur.
takes precedence over a BRS 31.

The interrupt

If the interrupt occurs and control is

returned to a BRS 31 after processing the interrupt, the fork will be
dismissed until the subsidiary fork specified by the restored (A) terminates.

3)

The forks can share memory.

The creating fork can, as already

indicated, set the memory of the subsidiary fork when the latter is started.
In addition, there is some interaction when the subsidiary fork attempts
to acquire memory.

3.2 Memory Acquisition
If the fork addresses a block of memory which is not aSSigned to it,
the following action is taken: a check is made to determine whether the machine
size specified by the user (cf .. Document R-22) has been exceeded.
memory panic (see below) is generated.
panic is also generated.

If the fork is fixed memory, a memory

Otherwise a new block is assigned to the fork so

that the illegal address becomes legal.
block is always assigned.

If so, a

For a local memory fork, a new

Otherwise, the following algorithm is used.

The number, n, of the relabeling byte for the block addressed by the
instruction causing the memory trap is determined.

A scan is made upwards

through the fork structure to (and including) the first local memory fork.
If all the forks encountered during this scan have Rn (the Nth relabeling
byte) equal to 0, a new entry is created in PMT for a new block of user
memory.

The address of this entry is put into Rn for all the forks

encountered during the scan.

If a fork with non-zero Fin is encountered, its Rn is propagated
downward to all the forks between it and the fork causing the trap.

If

any fixed memory fork is encolJ.ntered before a non-zero Rn is found, a

memory panic occurs.
This arr&"1gement permits a fork to be started with less memor;! than
its controlling fork in order to minimize the amount or drum swapping
required during its execution.
memory, it can be
natural way.

reassi[~ed

If the fork later proves to require more

the memory of the controlling fork in a

It is, of course, possible to use this machinery in other

ways, for instance to permit the user to acqutre more than 16K of memory,
and to run different forks with non-overlapping or almost non-overlapping
memory.

3.3

Panic Conditions
The three kinds of panic condition which may ca.use a fork to be

terminated are listed in the description of the status word above.

When

e~y

of these conditions occurs, the PACT entry for the fork being terminated is returned
to the free program list.
in the

control1int~

fork.

it too is terminated.

The status of the fork is read into its panic table
If the fork being terminated has a subsidiary fork,

This process will of course cause the termination of

all the lower forks in the hierarchy.
The pRnic which returns a status word of zero is called a program panic
and may be caused by either of two conditions:
A) the rubout button on the controlling teletype is pushed.
terminates some fork with a program panic.

This

A fork may declare that it is

3-6

the one to be terminated

by

executing BRS 90.

In the absence of such a

declaration the highest user fork is terminated ..

~~en

a fork is terminated

in this way its controlling fork becomes the one to be terminated.

If a user-

fork is terminated by rubout the teletype input huffer is cleared.

If the

controlling fork of the one terminated is executive, the output buffer is f.tlso cleared..
If the fork which sl1ou1d be terminated by rubout has armed interrupt 1,
this interrupt will occur instead of a termination.
not be af'fected.

The teletype buffers will

If there is only one fork active, control goes to the

location EXECP in the executive.

This consideration is of no concern to the

Executive programs can turn the rubout button off with BRS 46 and turn

user.

it back on with BRS 4'7.

A rubout occurring in the meantime will be stacked.

A second one will be ignored.

A program which is running with rubout turned off

is said to be non-terminable and cannot be terminated by a higher fork.

BRS 26

skips if there is a rubout pending.
If two rubouts occur within about .12 second.s, the entire fork structure
will be cleared and the job left executing the top level executive fork.

This

device permits a user trapped in a malfunctioning lower fork to escape.

Closely

spaced rubouts can be conveniently generated with the repeat button on the teletype.
B)

A BRS 10 may be executed in the lower fork.

This condition can be

distinguished from a paniC caused by the rubout button only by the fact that
in the former case the program counter in the panic table points to a word
containing BRS 10.
As an extension of this machinery, there is one way in which several forks
may be terminated at once by a lower fork.
provides a count in the A register.
structure, decrementing this count

This may be done

by

BRS 73, which

A scan is made upward through the fork
by

one each time a fork is passed.

the count goes to 0, the scan is terminated and all forks passed by are

When

3-7
terminated.

If an executive program is reached before the count

is 0, then all the user programs below it are terminated.
An executive program can clear the fork structure of a job

by putting the job number in A and executing BRS 22.

The effect

is as though enough rubouts had occurred to send the job back
to the top-level executive fork.
The panic Which returns a status word of 1 is caused by the
execution of an illegal instruction in the fork.
are of two kinds:

Illegal instructions

1)

Machine instructions which are privileged

2)

SYSPOPs which are forbidden to the user or which have been
provided with unacceptable arguments.

If interrupt 2 is armed and the fork is executive, interrupt 2 will
occur instead of an illegal instruction panic.
A status word of 2 is returned by a memory panic.

This may be

caused by an attempt to address more memory than is permitted by
the machine size which the user has set, or by an attempt to store
into a read-only block.

If interrupt 2 is armed, it will occur

instead of the memory panic.

Every complete fork structure is associated with a job, which
is the fundamental entity thought of as a user of the system, from
the system's own point of view. The job number appears in the PAC
table entry for every fork in the job's fork structure. In addition
there are several tables indexed by job number.

These are shown

on page 3B, and indicate more or less what it is that is specifically
associated with each job.

3B

TSDA

drum address of TS block

TTNO

teletype associated with this job

ETI'B

amount of CPU time used

DBA

drum blocks available

QUR

time left in long quantum

Job Tables

4-1

4.0 Program Interrupts
A facility isprovideci in the monitor to simulate the
existence of hardware interrupts.

There are 20 possible interrupts;

four are reserved for special purposes and 16 are available to
the programmer for general use.

A

,fork may arm the interrupts

by executing BRS 78 with a 2O-bit mask in the A register.

This

causes the appropriate bits in PTh1 to be set or cleared according
to whether the corresponding bit in the mask is 1 or O.
of A corresponds to interrupt. number 1, etc.
taken at this time.

Bit 4

No other action is

When an interrupt occurs (in a manner to

be described) the execution of an SBRM* to location 200 plus the
interrupt number is simulated in the fork which armed the interrupt.
Note that the program counter which is stored in the case is
the location of the instruction being executed by the fork
which is interrupted, not the location in the fork which causes
the interrupt.

The proper return from an interrupt is a BRU

to the location from which the interrupt occurred.

This will do

the right thing in all cases including interrupts out of inputoutput instructions.
A fork rnay generate an interrupt by executing ERS 79 with
the number of the desired interrupt in the A register.
number may not be one, two, three or four.

This

The effect is that

the fork structure is scanned, starting with the forks parallel
to the one causing the interrupt and proceeding to those above
it in the hierarchy (i.e., to its ancestors) .

The first fork

encountered during this scan vlith the appropriate interrupt mask
bit set is interrupted.

Execution of the program in the fork

causing the interrupt continues without disturbance.

If no

interruptable fork is found, the interrupt instruction is treated
as a NOP; otherwise, it skips on return.
Interrupts 1 and 2 are handled in a special way.

If a fork

arms interrupt 1, a program panic (ERS 10 or rubout button) which
would normally terminate the fork which has armed interrupt 1,
will instead cause interrupt 1 to occur, that is, will cause

4-2
the execution of an SBRM* to location 201.

This permits the

programmer to control the action taken when the rub out button
is pushed without establishing a fork specifically for this
purpose.

If pushinG the rubout button causes an interrupt to

occur rather than terminating a fork, the input buffer will not
be cleared.

If a memory panic occurs in a fork which has anned interrupt
2, it will cause interrupt 2 to occur rather tha.n terminatin;;

the fork.

If an illeF.'-al instruction panic occurs in an executive

fork which has armed interrupt 2, it will cause interrupt 2
to occur rather than terminating the fork.
Interrupt 3 is caused, if armed, \·,hen any subsidiary fork
terr:1inates.

Interrupt 4 is caused, if armed, \{hen any input-

output condition occurs 1<[hich sets

a flag

bit (end of record,

end of file and error conditions can do this).
vfuenever any interrupt occurs, the corresponding bit in
the interrupt mask is cleared and must be reset explicitly if
it is desired to keep the interrupt on.

Note that there is no

restriction on the number of forks which may have an interrupt
on.
To read the interrupt mask into A, the proGram may execute

BRG 49.

5-1
5.0 The Swapner

arid Memory

Allocation

Pseudo-re~abeling

The 940 hardware allows the user's address space to be
fragmented into eight pages of 2048 words each.

This means

that the monitor must keep track of eight drum addresses for
each process.

This is done by means of eight six-bit pseudo-

relabeling registers.

Each of these registers is an index to

a table which contains the drum address of the user's page.
This table is called the Private Memory Table (PMT) and
is held in the job's TS block.

Each of the 64 entries in RvlT

has the following format:

¢ s IE IR
H IX !0
j

I

o

1

2

IE I

I

1P .

¢

drum address

3·4

17

23

EX - Process must be executi.ve to reference the page.
RO - Read only (attempt to store will generate a trap).

SH - Shared.
EP - Will be d.estroyed when not in any map.
During the startup for each user, the system copies the
first NCMEM (currently 35) entries out of a resident table
called the Shared Memory Table (SMT) into the new PMT.

These

entries describe memory that most processes will need, such
as the monitor, the exec, and some of the subsystems.

ThUS,

a program has a max:im.um of (64 - NCMEM) private pages.
When a program is run, his TS block is swapped and its
pseudo-relabeling registers (in the PACT table) are used to
read out the proper bytes from PMT and construct a list of
drum pages that may need to be read from drum.

When this list

has been constructed, the current state of core is examined to
determine whether

any

blocks need to be written out to make

room for these which must be read in.
to be written out is constructed.

If so, a list of blocks

The drum command list is then

5-2
set up with the appropriate commands to write out and read in
the necessary blocl\:s.

In the course of optimizing the drum

commands, the swapper may skip a sector.
it searches through the
page in that sector.

~mory

If this is the case,

tables and writes out a dirty

The scheduler then simply hangs up until

the swapping is complete.

In the scan which sets up the drum

read commands, the swapper collects from DHT the actual
absolute memory addresses of the page called for by the pseudorelabeling and constructs a set of real relabeling registers
which it puts in two fixed locations in the monitor.

It then

outputs these relabeling registers to the hardware and activates
the program.
There are two BRS's which permit the user to read and
write his pseudo-relabeling.
relabelin(~

BRS 43 reads the current pseudo-

registers into A and B.

BRS 44 takes the contents

of A and B and puts then: into the current pseudo-relabeling
registers.

An executive program may set the relabeling registers

in arbitra.ry fashion

b~{

using this instruction.

A user program,

however, may add or delete only blocks which do not have the
executive bit set tn FMT.

This prevents the user from gaining

access to executive blocks whose destruction may cause damage
to the system.

Note that the user is doubly restricted in his

access to real memory, firstly, because he can only access real
memory which is pointed to by his pseudo-relabeling, and secondly,
because he is only nllo. . .,ed to adjust those portions of his pseudorelabeling which are not executive type.
The user can also set the relabeling of a fork when he
creates it.

See Section 3.

The same restrictions on manipulation

of executive blocks of course apply.
The system maintains a pair of relabeling registers which
the executive and various subsystems think of as the user's
program relabeling.

For the convenience of subsystems, any

program can read these registers with BRS 116 and set them with
BRS 117.

5-3
The memory allocation a.lgorithm is described on page 3-2.

A user can release a block which is in his current relabeling
by putting any address in that block into A and executing BRS !t.
The PMT entry for the block is removed and in any other fork
which has this PMT byte in its relabeling, the byte is cleared
to o.
Equivalent to BRS 4 is BRS 121, which takes a pseudorelabeling byte in A rather than an address.

An inverse operation

is BRS 120, which takes a pseudo-relabeling byte in A, generates
an illegal instruction trap if the corresponding PMT entry is
occupied, and otherwise obtains a new page and puts it in that
entry.

This is an exec-only operation and is implemented parti-

cularly for the Exec 'RECOVER FROM FILE' operation.

If A is 0,

BRS 120 assigns a 2K page and skips; this operation is not execonly.
Shared Memory.

The system maintains a table

called the shared

memory table (SMT) which describes all the memory which can be
shared between jobs in the system.

All the cornmon subsystems

occupy positions in SMT, and some part of SMT is copied into
each job's FMT permanently.

To run a subsystem, the exec must

determine if the subsystem map is already in PMT (which it will
be if all the bytes are below NCMEM) and, if not, arrange for
the bytes to be put into PMT.
The exec makes an entry in SMT by executing BRS 68 with a
byte ntunber in A.

The block addressed by the specified byte in

the pseudo-relabeling registers is put into SMT and the pointer
in SMT of this byte is returned.

By putting an index in SMT in

A and executing BRS 69, the SMT entry is copied into the first
free byte of a userts PMT and the byte number is returned in A.
The read-only bit in the SMT entry is propagated to the PMT
entry thus created.

To delete an entry in SMT, the exec may

deliver its index in A and execute BRS 70.
The user may declare a block read-only by executing BRS 80
with the pseudo-relabeling byte number of the block in A and
with bit 0 of A set.

To make a block read-write, bit

° of A

5-4
should be clear.

Bit 0 of A will be reset if the block was

formerly read-write or set if it was formerly read-only.

If

the program doing this is not an executive program, then the
block must not be an executive block.

Only executive programs

may make a shared page read-write.
The drum is divided into 84 bands, each containing 16,000
words arranged in 8 blocks of 2K each.

Up

to '72 of these bands

may be used by the swapper for program storage.

A bit table is

maintained to indicate the availability of 2K blocks in these
bands.

The table consists of 8 words, each containing 24 bits,

one for each band.
block is in use.

If a bit is zero, it indicates that the
If it is set, the block is available.

wllen

the user's memory is acquired, it is written as nearly as possible
in adjacent blocks, so that it rnay be read in without undue drum
latency time.

Rotational positions are chosen by adding, mod 8,

the user's job number to the PMT byte number of the new block.
It should be noted that whenever a user is activated, all
of the memory in his current relabeling registers is brought in.
The user does, however, have considerable control over precisely
what memory will be brought in, because he can read and set his
own relabeling registers.

He may therefore establish a fork with

a minimal amount of memory in order to speed up the swapping
process if this is convenient.
To make a block executive, execute BRS 56 with the same
argument as for BRS 80, make block read-only.

This instruction

is legal only for executive type programs.
Real memory is housekept by means of several tables.

The

most important of these is a table (hash)-indexed by drum address
which describes all those drum pages which are currently in
core.
pages.

The Drum Hash Table (DHT) has more entries than core
An entry has the following format:

IF

18

¢
F ==

Core
Address

Drum
Address

Free entry

27

5-5
The core address field of DHT indexes two tables called the

(RMe).

real memory table (RMT) and the real memory use count table

An RMC entry is -1 if a page is not in use; otherwise, it is one
less than the number of reasons why it is in use.

Every occurrence

of the page in the relabeling of a process which is running or
about to be run counts as such a reason.

In addition, other

parts of the system can increment an RMC word to lock a block in
core.

No block with non-negative RMC will be used by the swapper.
The format of an RMT entry (one per real page) is

4 5 6
2
0

D

E

I

R

R

¢ ¢

T
y

R
I
p

W R

I
P

~

9

23

0-0

0

address of DHT entry
responsible

T

RIP - drum read in progress
DIRTY - Page has been modified WIP - drum write in progress
ERRBIT - drum read error
There is one more table indexed by real memory, called the
real memory aging table. Whenever the swapper is entered, every
word in this table is shifted right one bit.

All blocks which

show up in the real relabeling computed from the pseudo-relabeling
with which the swapper was entered then have bit I turned on.
The blocks with lowest RMA are selected for swapping out; of
course, their RMC entries must be negative.
BRS 140 scans through the real memory tables and for each
page with a negative RMC takes one of two actions:

If the page

is not dirty, the PMT/SMT entry is marked as on drum and RMT is
emptied.

If the page is dirty, a write is started.

This has the

affect of forcing core and drum copies of most pages to correspond.

6-1

6.0 Miscellaneous Features
A user may dismiss his program for a specified length of
real time by executing BRS 81 with the number of milliseconds
for which he wishes to be dismissed in A.

At the first

available opportunity after this time has been exhausted, his
program will be reactivated.

This feature is implemented with

a special activation condition and the value of the clock at
the time when a user is to be reactivated is kept in PA.

The

activation condition causes the current value of the clock to
be compared with this value.

When the clock becomes greater,

it is time to reactivate the program.
He can read the real-time clock into A by executing BRS 42.
The number obtained increments by one every 1/6Oth of a second.
Its absolute magnitude is not significant.

He can read the

elapsed time counter in A by executing BRS 88.

This number

is set to 0 when he enters the system and increments by I at
every 1/60th second clock interrupt at which his program is
running.
To obtain the da,ta and time, he can execute BRS 39.
puts six 8-bit characters into AB.

This

These characters contain,

in order, the year, month, day, hour (0-23), minute and second
at which the instruction is executed.
A user may dismiss his program until an interrupt occurs
or the fork in question is terminated by executing BRS 109.
A program can test whether it is executive or not by
executing BRS 71, which skips in the former case.
An executive program can dismiss itself explicitly.

See

Section 2.
There are some operations designed for so-called executive
BRSs, which operate in user mode with a map different from the
one they are called from.

BRS 111 returns from one of these

BRSs, transmitting A, B and X to the calling program as it finds
them.

BRS 122 simulates the addreSSing of memory at the location

specified in A.

If new memory is assigned, it is put into the

6-2
relabeling of the calling program. A memory panic can occur,
in which case it appears to the calling program that it comes
from the BRS instruction.
BRS 141 reads the panic table of the caller, and BRS 142
sets the state from a table specified by X.

An executive program can cause an instruction to be executed
in system mode by addressing it with EXS.

7-1
7.0 Teletype Input-Output
We begin with an outline of the implementation of the
teletype operations.

This may serve to clarify the exact disposal

of the characters which are being read and written.

Every

teletype has attached to it a table which is shown in Figures
7A and 7B.

No buffers are attached to the teletype unless

input from or output to the teletype is taking place.

As

characters are output by the program, buffers are attached to
the teletype.

These buffers are released as soon as they are

emptied by the teletype interface.

On input buffers are attached

to the teletype as characters are received from the teletype,
and they are released as soon as the program empties them.
Input and output buffers are logically and physically
independent, although they come out of the same buffer pool.
When a character is typed in on a teletype) it is converted
to internal form and added to the input buffer unless it is
rubout on a controlling teletype.
is discussed in Section 3.

The treatment of rubouts

The echo routine address is then

obtained from TTYTBL and called.

It figures out what to echo

and whether or not the character is a break character.

The

available choices of echos and break characters are listed
below.

If the character is a break character, and if a user's

program has been dismissed for teletype input, it will be
reactivated regardless of the number of words in the input
buffer.

In the absence of a break character, the user's program

is reactivated only when the input buffer is nearly full.
If the teletype is in the process of outputting (TOS2 > -1)
then the character to be echoed is put into the last byte of
the buffer word which contains the input character.

When the

character is read from the buffer by the program, the echo,
if any, will be generated.

This mechanism, called deferred

echoing, permits the· user to type in while the teletype is
outputting without having his input mixed with the teletype
output.

7-2
There are four standard echo routines in the system, referred
to by the numbers 0, 1, 2 and 3.

a

is a routine in which the

echo for each character is the character itself, and all cha.racters
are break characters.

Routine 1 has the same echoes, but all

characters except letters, digits, and space are break characters.
Routine 2 again has the same echoes, but the only break characters
are control characters (including carriage return and line feed).
Routine 3 specifies no echo for any character, and all characters
are break characters.

This routine is useful for a program

which wishes to compute the echo itself.
To set the echo routine, put the teletype number in X and
the echo routine number in A and execute BRS 12.

Note that

BRS 12 is also used to turn on 8-level mode (see below).

To

read the echo routine number into A, put the teletype number
in X and execute BRS 40.

This operation returns in A the word

listed as TTYTBL on page 7A.
To input a character from the controlling teletype (the
teletype on which the user of the program is entered) into
location M in memory the SYSPOP

Tel
is used.

M

(teletype character input)

This SYSPOP reads the character from the teletype

input buffer and places it into the 8 rightmost bits of location
M.

The remainder of location M is cleared.

The character is

also placed in the A register, whose former contents are destroyed.
The contents of the other internal registers are preserved by
this and all the other teletype SYSPOPs and BRS's.
To output a character from location M, the SYSPOP

TCO
is used.

M

(teletype character output)

This instruction outputs a character from the rightmost

8 bits of location M.

In addition to the ordinary ASCII characters,

7-3
all teletype output operations will accept 135 (octal) as a
multiple blank character.

The next character will be taken as

a blank count, and that many blanks will be typed.
The TTYTIM cell in the teletype table is set to the current
value of the clock whenever any teletype activity (interrupt
or output SYSPOP) occurs. The top bit is left clear unless the
activity is a rubout input. This cell is checked by the
rubout processor to determine whether the rubout should reset
the job to the exec. See p. 3-6.
Every teletype in the system is at all times in one of
three states:
a)

It may be the controlling teletype of some user's program.
It gets into this state when a user enters on it.

b)

It may be attached to some user in a manner about to be

c)

described.
It may be completely free.

The status of the teletype is reflected by the contents of TTYASG.
There are mechanisms to be described by which the user may direct
output to any teletype in the system which is willing to a.ccept
it and receive input from any teletype which is not free. If,
however, he wishes to have better control over a teletype (for
instance, to prevent other users from accessing it) he may attach
it by executing the instructions
LDA
=teletype number
BRS
27
If the indicated teletype is free, it is attached to the user whose
program executes the instruction, and the BRS will skip. Otherwise
the teletype status is not affected, and the BRS does not skip.
In the following discussion we will say that a teletype is attached
to a user even if it is the controlling teletype.
To release an already attached teletype, execute the
instructions
LDA
BRS

=teletype number

26

If the specified teletype is not already attached to the user, this
is an illegal instruction and causes a panic.

All attached teletypes

are, of course, released when the user logs out.

7-4
A teletype becomes a controlling teletype if it is dormant
and rubout is pushed on it.

It can be returned to its dormant

state by BRS 112, which takes the job number of the job associated
with the teletype in X.

A job may terminate itself.

This

operation also releases all teletypes attached to the job.
The user may specify for his controlling teletype or for one
which he has attached, whether or not messages from outside will
be accepted, and whether or not input from outside will be
accepted.

The former condition is governed by the accept

messages bit, the latter by the accept input bit.

The accept

message bit controls execution of OST instructions and the setting
of teletype output links.

The accept input bit controls execution

of STI instructions and the setting of teletype input links.
To set these bits, the user may execute
LDA

=teletype number

LDA

BrrS

BRS
25
The last bit of BITS will set the accept input bit, the next to
last the accept messages bit.

Setting or clearing these bits

will not affect any teletype links currently active.
To do input and output to specified teletypes (rather than
implicitly to a controlling teletype as in TCI and TCO) the
SYSPOPs 1ST and OST are available.

To input a character from

a specified teletype, execute the instruction
IST

=teletype number

(input from specified teletype)

which brings the character into the A register.

This instruction

is illegal unless the teletype is attached to the user.
output

a

To

character to a specified teletype, execute the instructions
LDA

=cha.racter

=teletype number
(output to specified teletype)
OST
This instruction is illegal if the following three conditions
are satisfied:
(1) The spec ified te letype is not atta.ched to the user,
(2)

The specified teletype does not have its accept messa.ges

(3)

bit set,
The program executing an instruction is a user rather
than an executive program.

If these conditions are

7-5

satisfied, an illegal instruction panic will be generated.
Note that attached teletypes do not have the same status as
the controlling teletype for a user. In particular, pushing the
rub out button on an attached teletype will have no effect.
The instruction
=teletype number + 1000
is exactly equivalent to
=teletype number.
IST
eIO

The instruction
=teletype number + 2000

eIO

is exactly equivalent to
OST
=teletype number.
This mechanism permits the user to do Ilo to specified teletypes
within the frrumework of the sequential file machinery.
The user has considerable control over the state of the
teletype buffers for the teletypes attached to him. In particular,
he may execute the following BRS's. All these take the teletype
number in X. Recall that ·-1 may be used for the controlling
teletype.
BRS

11

BRS

29

BRS
BRS

13
14

BRS

138

clears the teletype input buffer.
clears the teletype output buffer.
skips if the teletype input buffer is empty.
waits until the teletype output

bu~fer

is empty.

waits until a process gets dismissed because
the input buffer is empty.

There is one additional piece of machinery which permits output
to go to a teletype other than the controlling teletype. This
machinery is ~plied by the top bits of TTYTBL, which specify
whether any link bits are set.

Associated with each teletype are

two words called the absolute input link control word (LeW) and the
absolute output LCW. Each of these words contains one bit for
each teletype in the system. If the bit for teletype m is set in
the input LCW for teletype n, every chs.racter which goes into n' s
input buffer will also go into m's input buffer.

If the bit is

set in the output LCW, every character which is output to n,
including echoes, will also be output to m.

7-6
Also associated with each teletype are relative LCW's for
input and output.

The bits in these LCW's are set by BRS 23.

Each

time any relative WW is changed, the absolute LCW' s are all
recomputed. The Boolean matrix formed by the absolute input
(output) LeW's is the infinite product of the matrix of the relative
input (output) LCW's.
The instructions
=teletype number
LDX
LDA

=TABLE

LDB

CTL

23
will set one of the relative LCW' s for the indicated teletype.
TABLE is the address of a list of teletype numbers terminated
with -2. The bits of CTL are interpreted as follows:
o
O=output LCW
BRS

1

2

l=input ICW
O=clear all links first
l=do not clear links first
O=set link bits for teletypes whose numbers
are in the table.
l=clear link bits for teletypes whose numbers
are in the table.

Fran the old relative LCW and the information supplied by BRS 23
a new relative LCW is created. New absolute LCW's for all
teletypes are then computed.
An output link can be set up between two teletypes only if
each of the teletypes satisfies at least one of the following
conditions:
a) It is the controlling teletype of the program executing
b)
c)
d)

BRS 23
It is attached to the program
Its accept messages bit is on (destination only)
The fork executing the ERS is executive.

An input link can be set only if the same conditions are satisfied

for the accept input bit.

7-7
To clear all

liIL~S}

input and output, to or from a teletype,

execute
LDX

=teletype number

BRS

24

Special provision is made for reading 8-bit codes from the
teletype without sensing rub out or doing the conversion from
ASCII to internal which is done by TCI.

To switch a teletype

into this mode, execute
LDX

=teletype number

LDA

=terminal character + 40000000B

BRS

12

This will cause each 8-bit character read from the teletype
to be transmitted

lli~changed

to the user's program.

The teletype

can be returned to normal operation by

1.
2.

Reading the terminal character specified in A, or
Setting the echo table with BRS 12.

No echoes are generated while the teletype is in 8-level mode.
Teletype output is not affected.

A parallel operation, BRS
output.

85,

is provided for 8-level

BRS 86 returns matters to the normal state, as does

any setting of the echo table.
To simulate teletype input, the operation

STr
is available.

=teletype number
STI puts the character in A into the input buffer

of the specified teletype.

It is legal if the accept input bit

is on.
To steal teletype output, the operation
STO

=teletype number

takes a character from the teletype's output buffer and returns
it in A.

STO is legal only if the accept input bit is on.

To disable output from a buffer to a teletype, execute

BRS 139 with the teletype number in X. If bit ¢ of A is 1,
the NO bit will be set; otherwise, the NO bit will be cleared.

7A

TELETYPE SYSTEM POINTERS

TTYOB
TTYOBC

Pointer to next available buffer in buffer pool
Count of available buffers in buffer pool

N N A
S 0 P

TTYTBL

TTYBRK

S

S

I

0

I
L

0
L

10

A A A
K I M

address of echo routine 23

Waiting for break character when -1
TTY Status
PACPl'R of fork to terminate on rub out

TTYASG

3

7

7

7

TTYTIM

TTYDEV

R
B

value of clock when last action occurred on this tty

device (normally physical teletype) using this buffer.

AM

= accept message
= input linked
= output linked
= don't output to TTY
= accept input links

AK

. b 23 attached
controlling JO

Relative input link control word

= not

OL
NO

18

Relative output link control word

NS
IL

inactive

7
1

ROLCW
RILCW

active

linked or 8-level

AI = accept input

8I
SO

= 8-level
= 8-level

input
output

RB = last action was input of rubout
interface

AP

= accept

output links

7B
TELETYPE TABLE

TIS2

number of characters in input buffer

TIS4

next available space in input buffer (pointer)

7

8

10

I

23
WORD ADDRESS

bits '7 and 8:

TIS5

o

1

byte 1

1

0

byte 2

1

1

byte 3

next filled space in input buffer (pointer with same format
as TIS4)

TIS6

deferred echo byte count.

Input characters are echoed when

the NO bit is set in TTYTBL and this count goes negative.

It

is decremented when a character is taken out of the input buffer.
TIBBl

word pointer to the oldest acquired input buffer: =0 no buffer
attached

TIBB2

word pointer to the last acquired input buffer

TIBLC

count of input buffer that can be acquired

TOS2

number of characters in output buffer:

TOS3

< 0 = not in mult iple blank mode; 400 = just saw 135
(multiple blank character); other

-1

= number

= inactive
of blanks

TOs4

next filled space in output buffer (pointer same as TIS4)

TOS5

next available space in output buffer (pointer same as TIS4)

Tos6

<0

= not

terminated during output to links; > 0

= next

link that output has to be sent to.
TOBBl

word pointer to oldest acquired output buffer;

=0

no buffer

attached

TOBB2

word pointer to last acquired output buffer

TOBIC

count of output buffers that can be acquired

TTYPN

contains physical teletype number associated with this buffer,

TTYLN

or 4B7 if no physical teletype attached
contains logical teletype buffer associated with this physical
teletype or zero (¢) if no buffer is attached.

7C

TELETYPE BUFFERS

TTYOC

1

1.

2

2.

3

N

1-----0004

BUFFER POOL POINTERS

TOBB2IL--_3_~

1

TOBBl

1.

2

1-----....

2.

3

TOS41

3·

lXl= byte count in word
N

= word

displacement in buffer.

PROGRAM OUTPUT BUFFER PO:rnTERS

lX1

1. +N

I

1-----....

8-1

8.0 Drum and Buffer Organization; Devices
8.1 File Storage on the Drum
The drum is divided into two major sections, program swapping
and file storage.

The organization of the program swapping area

is discussed in Section 5.

The file storage area is divided

into 256 word blocks which form the physical records for storage
of files.
Every file has one or more index blocks which contain
pointers to the data blocks for the file.

An index block is a

256 word block, as are all other physical blocks in the file
area.

Only the first 141 words of the index block are used,

however, for data storage.

A couple of additional words are

used to chain the index blocks for any particular file, both
forward and backward.

The index blocks for a file contain the

addresses for all the physical blocks used to hold information
for the file.
Available storage in the file area of the drum is kept
track of with a bit table similar to the table used to keep
track of program swapping storage.

Since there are sixty-four

256-word blocks around the circumference of the drum and a
maximum of 72 drum bands (out of the 84 available) may be used
for file storage, a 192-word bit table which contains 3 words
of 72 bits for each row of physical blocks suffices.

If a

bit in this table is set, it indicates that the corresponding
block on the drum is in use.

Again, as with program swapping

storage, the organization of this table makes it easy to
optimize the writing of files.

This is done by putting consecutive

physical blocks in the file in alternating rows on the drum.
The intervening row between each two physical blocks provides
the time for the channel to fetch a new command and the heads
to switch.

The result of this organization is that information

may be transferred from a file on the drum into core at onehalf core memory speed if conditions are right.

8-2

8.2 File Buffers
Every open file in the system with the exception of purely
character-oriented files such as the teletype has a file buffer
associated with it.

The form of this buffer is shown on page

BA.

Part (a) of this figure shows the buffer proper, and part (b)
shows the index block buffer and pointers associated with it.
Part (b) is not used only by drum files, but is present in all
cases.
Each job has associated with it a temporary storage block,
which is always the first entry in the job's FMT. This block is
used to hold information about the user and for the system's
temporary storage. It also has room for three buffers. An
additional block may be assigned with room for five more buffers
if more than three file s are open at one time. The pseudorelabeling for the extra buffer block and the TS block is held
in a table called RL3 which is indexed by job number, and is
put into the monitor map whenever any fork belonging to that
job is run.
Note that the amount of buffer space actually used is a
fuu~ction of the device attached to the file.
In all cases the
two pointer words at the head of the buffer indicate the location
of the data.

The first word points to the beginning of the

relevant data and is incremented as data are read from an input
buffer.

The second word points to the end of the data on input

or end of the buffer on output or written in an output buffer.
When the buffer is in its dormant state, both words point to
the first data word of the buffer. Whenever any physical I/O
operation is completed, the first pointer contains the address
of this word.

B-3
8.3 Devices
Every different kind of input-output device attached to the
system has a device number. The numbers applicable to specific
devices are given in Section 9; here the various tables indexed
by device number are described.

The entries in these tables

addressed by a specific device number together with the unit
number (if any) and the buffer address, completely define the
file. All this information is kept in the file control block
(Section 4.3) which is addressed by the file number.
Page 8B shows the tables indexed by device number.

Note

the multiplicity of bits which specify the characteristics of
the device. Some of these call for comment. A device may be
common (shared by users, who must not access it simultaneously;
e.g., tape or cards) or not common (e.g., drum); this characteristic
is defined by NC.
magtapes.

It may have units; e.g., there may be multiple

The U bit specifies this.

The DIU word indicates

which file is currentLy monopolizing the device; in the case of
a device with multiple units, DIU points to a table called ADIU
which contains one word for each unit.
The major parameters of a device are:
- the opening routine, which is responsible for the operation
necessary to attach it to a file.
- the GPW routine, which performs character and word I/O.
- the BIO routine, which performs block I/O.
Minor parameters are:
- physical record size (determining the proper setting of
buffer pointers and interlace control words for the channel).
- the expected t~e for an operation; the swapper uses this
number to decide whether it is worthwhile to swap the
user out while it is taking place.

8A

pointer to first data word in buffer
pointer to last data word
1st data word

·
··

data block

·
256th data word

a)

layout of a file buffer

drum address

of data block, or

¢

·
·
·

·
drum address of data block, or

'/J

BFP

pointer to next index block

BBP

pointer to previous index block

1 ,,7

BDS

log 2 (data block size!256)

L'v

BLX

file length

?- I I

BCK

check sum

'Z..O)

1- ()

G

b)

format of an index block

23
word or
character I/O
routine

GPW routine

DEV

CH

DRM

¢
BUFS

buffer size

~

1

2'

1¢

~

I

char oriented
dru.rn

RX random access

3
max. unit number

8

U

r/o routine

23

I
NC

0
block

l¢

9

U check unit number

BDEV

W buffer
OUT output

WB

BF requires buffer

physical record size
not common (i.e. don't set DID)

9

I¢

BIO routine

23

t/J

DID
device in use

OPNDEV
opening routine

t/J

1

2

(/)

(/)

~

\

file number using this device or -1

U = 0

points to ADN (has unit number added)

u =1

8

3
expected wait time
in clock C:lC Ie s
EO

9

l~

0

exec only allowed to open

•
DEVICE INDEXED TABLES

23

opening subroutine

9-1

9.0 Sequential Files
9.1 Sequential Drum Files

1.94

includes a major revision to the drum file system.

Basically, a file appears as an address space with an arbitrary
upper bound called its "length."

The maximum possible length

is around four million words (22 bits).

The file is internally

paged into an arbitrary number of data blocks whose size may be
any power of two larger than 256 words.
The following discussion will be of interest to those who
need to make efficient use of large, randomly accessed files:
1.

The data blocks are kept track of by the use of index blocks
chained together.
data blocks.

Each index block can describe about

14¢

Random access will be slow if there are several

index blocks to chain through.

A large data block size will

minimize this source of inefficiency.
2.

Block transfers are implemented in the most efficient manner,
with as much as possible of the data requested transferred
directly into the user's memory.
buffered in 256-word blocks.

The slop on either end is

Programs cognizant of the

structure of their files can avoid all buffering.

All word

operations use the 256-word buffer.
The user's access to an open file is housekept by means of
a position pointer to the file.
explicit~

This pointer may be moved

by the user or implicitly by any of the I/O operations.

The I/O operations always leave the pointer pointing at the word
following the last transfer.

eIO is a confusion factor.

When a file is opened, any of three types of access to that
file may be given to the user:
ac~ess

read, write, or position.

is intended to implement append-only files.

Position

You may not

move the pointer or perform random operations unless you have
position access to the file.

9-2
file o12ened as
sequential input

access given
r p

sequential output

w

random re ad-only

r

p

random read-write

r

w p

The mechanisms for setting the length, data block size,
or for moving-----ene-po~nter_are described undeI BRS 143-144.
BRS 66 deletes the contents of an open drum file.

In the

case of a sequential output file, it sets its length to zero.
You must have write access to the file to use BRS 66.
BRS 67 takes a file number in A and deletes all trace of
the file. Use of this BRS is limited to the EXEC.
ERS 143, 144 have been implemented as general read and
set status of a thingy. The calling sequence is:
A:

table address or data (depends on B¢)
If a table address, A is incremented to point to one
past the last word transferred.

X:
B:

thingy number
decodes as follows
bit ¢: ~ if A has data, 1 if A points to a table
bits 1-11: "type" of thingy
bits 12-23: "attribute"

"type" is I for a drum file, 2 for a job.

No other thingies

have been implemented as yet.
For drum files, the attribute field specifies the following:
1.

(Position)

One may read or set the sequential I/O pointer.

The bottom 22 bits are the current word pointer, the top
two the character offset. ('/IIJ means a word boundary.)
The offset must be ¢ if the pointer is set.
2.

(Length)

3.

(Sequential I/O mode) The sequential I/O operations (CIO,
WIO,BIO) are interpreted as input if the sequential mode is

¢,

Reads or sets the length of a file.

output if the mode is 4B7.

9-3

4.

(Capabilities) Opening a file may give read/write/position
access to the file. These bits may be read in bits 21-23.
If you try to set them, they are
capabilities.

5.

(Data Block Size)

~d

with the existing

Returns n where 2n+8 is the number of

words in a data block.

May be set only if the file length

is (1.

6.

(User words) Each file in the system has five arbitrary
words associated with it. Anyone may read them but only
the. exec may set them.

7.

( "structure")

A file may have voids in it.

If you are

interested, you can find out where these are.

BRS 143

returns the number of words from the current sequential
pointer to the next transition. It also moves the pointer.
If you are crossing a void part of the file with this
operation, the sign bit of the number is turned on.
this state with BRS

Setting

144 is interpreted by releasing this

many words beyond the pointer.

8.

(count data)

9.

beginning of the file.
(copy the index block)

Can only be read.

This also moves the pointer.
Sets the pointer to the

Can only be read.

Gives a copy of

the entire index block.
For jobs (type
thusly:
1. (files)
2.

= 2)

BRS 143 and

144 interpret the attribute field

Returns a bit word telling which files are open.

This word may not be set.
(mT) Reads the private part of Ht1T.

9-4
The Exec opens a sequential drum file by the following
sequence of instructions:
LDX
LDA

=device number, 8 (input) or 9 (output)
=unit number, address of first index block

BRS

I

If the file is opened successfully, the BRS skips; otherwise,
it returns without skipping. Use of this BRS is restricted to
executive type programs.

User programs may access drum files

only through the executive file handling machinery.

BRS I can

also be used to open other kinds of files. The device and unit
numbers are used to determine the physical location of the file.
See Section 9.2.
If BRS I fails to skip, it returns in the A register an
indication of the reason:
-2

too many files open -- no file control blocks or no
buffers available.

-1

device already' in use.

o

For the drum, produced by an

attempt to open a file for input if already open for
output or for output if already open at all.
no drum space left. This inhibits opening of output
files only.

See Section 9.2 for other error conditions.
BRS I returns in the A register a file number for the file.
This file number is the handle which the user has on the file.
He may use it to close the file when he is done with it by putting
it in the A register and executing BRS 2. This severs his
connection with the file. BRS 2 is available only to
executive progrwms, user programs should use BRS 20 instead.
To close all his open files an executive program may execute
BRS 8. The corresponding operation for nor.mal user programs is
BRS 17.

Three kinds of input-output may be done with sequential
files.

Each of these is specified by one SYSPOP.

Each of these

SYSPOPs handles input and output indifferently, since the file

9-5
must be specified as an input or an output file when it is opened.
It is not possible to have a file open for both input and output
at the same time:

this may be circumvented by using random

:tiles.
To input a single character to the A register or output it
from the A register, the instruction
CIO
is executed.

=file number
On input an end-of-record or end-of-file condition

will set bits .Q. and Q ~ I in the file number (these are called
~ bits) and return a 134 or 137 character, respectively.
If
interrupt 4 is armed, it will occur. The end-of-record condition
occurs on the next input operation after the last character of
the record has been input.

Note that an end-of-record condition

only occurs for type files and is of concern only to the Exec.
~

The end-of-file condition occurs on the next input operation
after the end of record, which signals the last record of the file.
The user may generate an end of record while writing a file by
using the control operation to be described.
To input a word to the A register or output it from the A
register,
WIO
=file number
is executed. An end-of-record condition returns a word of three

134 characters as well as setting the flag bit, and an end of
file returns a word of three 137 characters. If the condition
occurs when a partially filled-out word is present, the word
is filled out with one of these characters.
Mixing word and character operations will lead to peculiarities
and is not recommended.
To input a block of words to memory or output them from
memory, the instructions
LOX
=first word address
LDA
=number of words
BIO
=file number
should be executed. The contents of A and X will be destroyed.

9-6
The A register at the end of the operation contains the first
memory location not read into or out of.
I f the operation causes any of the flag bits to be set, it

is terminated at that point and the instruction fails to skip.
If the operation is completed successfully, it does skip.

Note

that a BIO cannot set both the EOR and the EOF bits.
BIO is implemented with considerable efficiency and is
capable of reading a file at one-half the maximum drum transfer
rate.
The flag bits (0 and 7) of the file number are set by the
system whenever end of file is encountered and cleared on any
input-output operation in which this condition does not occur.
Bit 0 is set on any unusual condition.

In the case of a BIO

the A register at the end of the operation indicates the first
memory location not read into or out of.

Bit 6 of the file

number may be set on an error condition.

Whenever any flag bit

is set as a result of an input-output operation in a fork,
interrupt

4 will occur in that fork if it is armed.

The user may delete all the information in a drum file by
executing the instructions
LDA

=file number

BRS

66

He may also eliminate the file entirely by giving an executive
command described in Document R-22, or via ERS 63 (vide infra).
The index block for a sequential drum file contains one
word for each physical record in the file.

This word contains

the address on the drum of the physical record in the bottom
bits.
Three operations are available to executive programs only.
They are intended for use by the system in dealing with file
names and executive commands.
A new drum file with a new index block can be created by
BRS 1 with an index block number of 0 in A.

The file number is

9-7
returned in A as usual and the index block number in X. The
initial settings of the r, w, and p capabi~ities, and the
sequential I/O mode flag, should be given in B.

To read an index block into core
BRS

ma.y be used.

87

It takes the address of the block in A and in X

the first word in core into which the block is to be read.

9.2 other Sequential Files
In addition to drum sequential files, the user has some
other kinds of sequential files available to him.

These are all

opened with the same ERS 1, except for the device number.
Available device numbers are
Paper tape input
Magtape input

4

Magtape output

5

PDP-5 link input
PDP-5 link output

6

1

7

The device number is put into X. The unit number, if any, is
put into A. The file number for the resulting open file is
returned in A.

If BRS 1 fails, it returns an error condition

in A as described in Section

9.1.

Three error conditions apply

to magtape only:
o Tape not ready
1

Tape file protected (output only)

2
Tape reserved (see p. 9-8).
ERS 1 also accepts the following three character mnemonics
instead of the device numbers.
goes in X for the call.

Either the name or the number

9-8
1

PrI

paper tape input

2

PrO

paper tape output (not available)

3

eDI

4

MrI

card input (not available)*
mag tape input*

5

MfO

mag tape output*

6
7

PDI

PDl:5 input

PDQ

8
9

FSI

PDl:5 output
drum input*
drum output*

10

FSO
FIL

drum input and output*

11

LPO

line printer out (not available)*

12

MDI

direct mag tape input*

13

MOO

direct mag tape output*

14

eSI

controlling teletype input

15

eso

controlling teletype output

16
17

specified teletype input

20

TTl
TTO
NON
lOS
SNP

*

requires executive status

18
19

specified teletype output
nothing
subroutine file
snooper counters (Berkeley only)

ERS 1 is inverted by ERS 110, which takes a file number in
A and returns the corresponding device name in X and unit number
in A.
These files may also be closed and read or written in the
same manner as sequential drum files.

The magtape is only

available to executive·type programs.
LDA

eTRL

=1 (end of record)
=file number

is available for physical sequential file 5 (magtape output).
Several other controls are also available for maptape files only.

9-9
These are:
2

backspace record

3

forward space file

4

backspace file

5

write three inches blank tape

6

rewind

7

write end of file

8

write 15 inches blank tape

These controls may be executed only by executive type programs.

I/O operations to the magtape may, of course, be executed by
user programs if they have the correct file number.
An executive program may arrogate a tape unit to itself by

putting the unit number in A and executing BRS 118, which skips
if the tape is not already attached to some other job.

BRS 119

releases a tape so attached.
It is possible for magtape and card reader files to set
The first I/O instruction

the error bit in the file number.

after an error condition will read the first word of the next
record--the remainder of the record causing the error is ignored.
The magtape routines take the usual corrective procedures when
they see hardware error flags, and Signal errors to the program
only as a last resort.
The phantom user's three second routine checks to see
whether a W-buffer interrupt has been pending for more than
three seconds.

If so, it takes drastic and ill-defined action

BRS 114 also takes this drastic action;
it can be used if a program is aware that the W-buffer is
malfunctioning.
to clear the W-buffer.

Direct tape I/O pa.ckage.

A mechanism for accessing arbitrarily

formatted mag tape is available.
~Sl

~n

BRS 2
BrO
CTRL

(or 17 or

~he

2p)

appropriate operations are:

close

block input/output
control

9-10

BIO is used in the normal way, with a word count in A and core
address in X. BIO will not give you more data than specified
by A.

In no case may the block requested cross a page boundary.

On input, BIO will skip if the word count presented is exactly
right; otherwise, it will not skip, and will leave the number
of words actually transferred in A and the next core address in
X. The flag bits (EOR and EOF) in the user's file number are
set as with the normal BIO for tapes.
In addition to controls 3-8 for tape in the CTRL operation,
CTRL 9 has been ~plemented to allow the user to set the mode
for the tape. This operation takes a ¢ or 1 in B2l for setting
the tape in odd or even parity. (TSS tapes use odd parity.)
B22 and B23 contain the "frame count," a mysterious. feature of
the W-buffer. Use one less than the number of 6-bit characters
per word to be shipped. On reading the characters are stored
right-justified in memory.

On writing they are taken out left-

justified. The word count for transfers covers the numbers of
words in core actually used. When the tape 1s opened, the mode
is set to odd parity, four characters per word.

Snooper Counters.

The Berkeley system has a collection of

hardware counters which monitor external signals.
be opened as a file with ERS 1.

These may

In addition, two operations

are provided.
CTRL

fn

requires a 1 in A, and 1/32 of the number of machine cycles
to be monitored in B.
BIO
fn
reads in the counters.

9-11

9.3 File Control Blocks
Every open file in the system has associated with it a file control
block. This block consists of four words in the following format:

2

0

FA
FW

first index block address or 0
subroutine address
15 16
C
C
2
3

0
0

7 i5

C
l

c

FD

0

D R
H F X

R
D

0

0

0

0

0

0

U
T

0

device

0

2 3 job 8 9
char number
count
0
0

normal file
subr. files
23

normal file
subr. file

0

Fe

drum buffer address or 0

busy count (-1 if file not busy)

FB

Cn = word being packed or unpacked
char count = -1 to 2
CH = character oriented
OUT

DF

Drum

files
only

{

= output

= drum

file
RX = random access
RD = read only
ERR ::: error

9.4 PermanentlY Open Files
There are a few built-in sequential files with fixed file numbers:
o
controlling teletype input
controlling teletype output
1
2

nothing (discard all output)

input from teletype n
output to teletype n
2000-+n
These files cannot be opened and need not be closed.
looo+n

10-1
10.0 Random Drum Files
A random drum file is identical in physical structure on
the drum to a sequential drum file. The only major difference
is that the non-zero words of the index block are not necessarily
compact. Th~ reason for this is that information is extracted
from or written into a random file by addressing the specific
word or block of words which is desired. From the address which
the user supplies, the system extracts a physical block number
by dividing by the data block size and a location of the word
within the block which is the remainder of this diviSion.
Further division by 144 yields the appropriate index block.
file may have any number of index blocks.

A

A random file may be opened by using BRS 1 with a device
number of 10. No distinction is made between input and output
to a random drum file.

A random file may also be closed by

BRS 2, like any sequential file, and CIO, WIO, and BIO may be

used for input-output to random files.

The sequential

Ilo

mode (input or output) is controlled with BRS 143 and 144.
The following additional operations are available:
To read a word from a random file, execute the instructions
LDB

=address

DWI
=file number
The word is returned in A.
To write a word on a random file, put the word in A and
execute the instructions:
LDB

=address

DWO
=file number
Block input-output to random files is also possible.

To

input a block, execute the instructions:
LDX
=first word address
LOA

=number of words

LDB

=first address in file

DBI
=file number
To output a block of words to a random file, execute the instruction
DBO

=file number

10-2

with the same parameters in the central registers. These block
input-output operations are done directly to and from the user's
memory, as is BIO. Drum buffers are not involved and the
operation can go very quickly.
It is possible to define a random file which has been
previously opened as the secondary memory file.
execute the instructions
LilA

=file number

BRS

58

To do this,

The specified file remains the secondary file until another
secondary memory file is defined or until the file is closed.
To access information in the secondary memory, two SYSPOPs are
provided.

These POPs work exactly like DWI and DWO except that

they take the drum address from memory instead of requiring it
to be in B.

To read a word of secondary memory into the A

register, the instruction
LAS
should be executed.

address
To store a word from A into the secondary

memory, the instruction
SAS
address
should be executed.

The word addressed by either one of these

SYSPOPs should contain the drum address which is to be referenced.
This word may also have the index bit set, in which case the
contents of the index register will be added to the contents
of the word to form the effective address which is actually
used to perform the input-output operation.
The mechanism for acquiring and releasing random drum file
space is very s~ilar to the mechanism for allocation of core
memory.

Whenever the user addresses a section of a random

drum file which he has not previously used, the necessary blocks
are created and cleared to O. Note that the user should avoid
unnecessarily large random drum addresses, since they may result
in the creation of an unnecessary number of index blocks.
release random drum memory, use BRS

144.

To

10-3

10.1 Direct Drum Access
An even more efficient method of acceSSing information on the

drum is provided by an interface Which alloys the user to acquire

2K pages on the drum and read or write on them directly.

This

space is ass igned fran the swapping area on the drum and referred
to directly by its drum address; a bit table private to the user
is used for validity checking.
To acquire a 2K page, execute
BRS

126

with the desired angular position on the drum of the page to be

If no more space is available,

assigned in the bottom bits of A.
BRS 126 returns without skipping.

otherwise, BRS 126 skips and

returns, in A, the drum address of a 2K page as a word address
(i.e., with the bottom 11 bits zero).

A page may be released by

putting this address in A and performing
BRS
To release

~

1~.

pages acquired in this manner, execute

CLA

BRS

7.

This is done automatically by the RESET cClllllland in the executive,
as well as by RECOVER and by a call for a new subsystem.
should be noted that DUMP does

~

preserve pages acquired by ,BRS 126.

To read or write on a page acquired with BRS 126, use
LDA
LDB
LDX

=core address
=drum address
=word count

S

124

BRS

125

b

It

readJ-

to
to write

10.4

These BRS's preserve all the central registers and normally skip.
A no-skip return indicates an uncorrectable transmission error.
The following restrictions are checked by the monitor and
will result in an illegal instruction trap if violated:
1)

The drum address must be a multiple of 256 (decimal)
and lie within some page assigned to the user via BRS 126.
(The latter restriction does not apply to executive programs.)

2)

The transfer must not cross a 2K page boundary either
in core or on the drum.

3)

It is illegal to attempt to read into a read-only page
with BRS 124 (this produces a memory trap if violated).

11-1

Subroutine Files

11.0

An addition to the above-mentioned machinery for performing

input-output through physical files, a facility is provided in
the system for making a subroutine call appear to be an inputoutput request.

This facility makes it possible to write a

program which does input-output from a file and later to cause
further processing to be performed before the actual inputoutput is done, simply by changing the file from a physical to
a subroutine file.

A subroutine file is opened by executing the

instructions
LOX

parameter word + subroutine address

BRS

1

This instruction skips or returns an error code, as for sequential
files.

The opcode field of the parameter word indicates the

characteristics of the file.

It may be one of the following

combinations:
11000000

CharOacter input subroutine

1ll0ooo0

Character output subroutine

01000000

Word input subroutine

01100000

Word output subroutine

I/O to the file may be done with CIO or WIO, regardless of
whether it is a word or a character-oriented subroutine.

The

system will take care of the necessary packing and unpacking
of characters.

BIO is also acceptable.

The opening of a subroutine file does nothing except to
create a file control block and return a file number in the A
register.

When an I/O operation on the file is performed, the

subroutine will be called.

This is done by

s~ulating

run SBRM

to the location given in the address field of the X register
given to the BRS 1 which opened the file.

The contents of the

B and X registers are transmitted from the I/O Syspop to the
subroutine unchanged.

The contents of the A register may be

changed by the packing and unpacking operations necessary to
convert from character-oriented to word-oriented operations or
vice versa.

The I/O subroutine may do an arbitrary amount of

11-2
computation any may calIon any number of other I/O devices or
other I/O subroutines.

A subroutine file should not call itself

recursively.
When the subroutine is ready to return, it should execute
BRS

41. This operation replaces the SBRR which would normally

be used to return from a subroutine call.

The contents of B

and X when the BRS 41 is executed are transmitted unchanged buck
to the calling program.

The contents of A may be altered by

packing and unpacking operations.

A subroutine file is closed

with BRS 2 like any other file.
In order to implement BRS 41, it is necessary to keep track
of which I/O subroutine is open.
six bits of the PAC table.

This information is kept in

The contents of these six bits is

transferred into the opcode field of the return address when an
I/O subroutine is called, and is recovered from there when the
BRS 41 is executed.
The user should be warned that a subroutine file should
not be used by a progrrum in a different address space from the
subroutine itself.

In particular, subroutine files may not be

given to the BRSs which involve acccess to nwned files (described
in the next section).

12-1
12.0

File Naming System
Because of the possible conrlicts which may arise when

several users are

s~ultaneously

trying to access the same

peripheral device, such devices cannot be handled directly by
users at the level offered by BRS 1 -- which is available only
to programs with executive status.

At the user level, storage

devices can only be referenced in an indirect manner, by writing
or reading a "file."
Files are the primary means by which the user establishes
continuity between one computer run and the next.

A file is

any named block of information which the user finds it convenient
to regard as a single entity; the commonest example of a file
is a program.

To provide a check against inappropriate use,

files created by the Exec and TSS subsystems are classified,
according to the nature of the information in them, into one
of four types, numbered I to 4.

This type number is carried

along with the information content and may be checked whenever
the file is referenced.
The file types are:
1. Core Image - The information in this originates from
specified segments of core memory.
2.

Binary

- The information has the form of an assembled,
but unloaded program.

3.

Symbolic

- The informa.t ion is of a form. which can be
readily listed on some printing device.

4.

Dump

- Comprises all the information in memory
necessary to restart the user from his
current situation, i.e., the situation at
the time of creation of the dump file.

Symbolic information may come directly from paper tape or
teletype.

These devices may be referenced as type 3 files by

using the name of the corresponding physical medium, viz. PAPER TAPE
TELETYPE

12-2

These names are built into the system and are always appropriately
recognized.

Another built-in file name is

NOTHING
which always contains precisely nothing and whose function is to
act as an infinite sink in which limitless unwanted output can
be lost.

A commoner source for symbolic files is the output from
some subsystems, notably the text editor, QED.
Type 2, binary files normal~y arise as the output from the
machine-language a,ssembler ARPAS.
Until the actual process of output from the subsystem occurs,
identification of the information is handled by the subsystem
and is usually implicit since the subsystems can handle only
one file at a time.

However, when the information is ejected

into a context involving many other blocks of information of a
similar kind, some explicit identification must be attached to it.
12.1

File Naming

The names which the user is free to invent and assign to
files are of two types:
1.

Permanent name s

2.

Scratch names

Scratch names differ from permanent names in that they and
the files associated with them are lost when the user leaves the
system, USing the LOGOUT command; they are otherwise treated
identically.
A permanent name is an arbitrary string of characters not
beginning with / or:.

A scratch name is an arbitrary string of

characters beginning with / or:.

To those users who have drum

file privileges, a / identifies a drum file, : a disk file.
As permanent names we have -

ABC
PROGRAM 1
124

while as scratch names we have -

/ABC
:421/

12-3
Any permanent or scratch file name may be quoted by surrounding
it with single quote marks.
file names.

Thus, 'ABC' and '/001/' are quoted

The quoted name refers to exactly the same file as

the unquoted one; it differs only in the way it is recognized by
the exec.

Control A (backspace) is legal on any name being typed

to the file system unless command recognition is taking place.
When reference is made to an unquoted name, the exec will
anticipate the user and consider the name to be fully delivered
as soon as it has received sufficient characters to distinguish
the name from all others currently defined by the user.
means that a new name can
form.

~

This

be introduced in its unquoted

A quoted name, on the other hand, is always accepted in its

entirety from the user.

The initial and terminal quotes are

then removed and the name compared with the directory of nwmes
currently defined by the user.

If it matches one of them, it is

taken to refer to that file, just as though it had been presented
in unquoted form.

If it is new, however, it will normally give

rise to an error message unless it appears in one of the
following contexts:

5.5)

a)

In the DEFINE NAME command (c.f. Doc. R-22, Section

b)

As an output file name, in which case a new file with
the specified name will be created to hold the output.

For example, let XYZ be the name of an existing file and
/123 be a new unattached file name.
~Opy

Then the exec command

XYZ TO '/123'.

has the effect of creating a new scratch file, called /123, having
the same information content as XYZ.

If /123 is, however,

already attached to some existing file, then the information
content of that file is replaced by that of XYZ.
In summary, it will be seen that the exec's file name
recognition apparatus works in two ways, depending essentially
on whether the name is quoted or not.

Quoted names must always

be given in entirety; the exec waits for the terminating quote
before attempting to recognize the name.

Unquoted names are

anticipated; the exec recognizes or rejects them as soon as it
can, inSisting that they match some name already in the user's
directory of file names.

Note tha.t the BEGINNER, NOVICE and

EXPERT commands apply to file name recognition (see R-22,Section

5.7).

12-4

12.2 Accessing Other Users' Files, Special Groups
The naming system described is adequate to reference all
the files belonging to the current user, in whose name the exec
was entered.

However, to refer to files belonging to another

user, it is possible to augment the file name by that user's
name together with, optionally, a special accessing code called
the~~.

To do this the basic file name must be prefixed by one of:

( < user name > )
or
( < user name >, < group name > )
Thus for example:
(JONES) 'FIIEl'
or

(JONES,GROUP1) 'FILE1'
When such a string as the last is collected from a teletype

by

BRS 15 or 16, the characters

II, GROUPl"

are not echoed to the

teletype so that the secrecy of the special group name is preserved.
The access that any other user may have to each of Jones' files
is in the hands of Jones .himself.

Jones may declare that a

member of the public at large who tries to access his 'FILEl'
using (JONES)'FII£l' has entire (read-write) access, read-only
access, or no access at all.

It is also open to Jones to

define independently a greater degree of accessibility to a
user who supplies the group name.
Special groups can be created by BRS 61 and the command
SET MODES FOR FILE (R-22, Section 5.5) or deleted by BRS 62 and
the same command.
ERS 61 - Define Special Group
Takes a string pointer in AB.
The string is an arbitrary string of characters and is taken to
define a new special-group name.

The BRS assoctates with it a

number, n, in the range IS ~ 15, which it skip returns in A.
A file may then be placed in that special group by setting this
number in the appropriate bits of the file mode word (see BRS

48).

A user may have up to 15 currently defined, distinct special
groups; an attempt to define more results in a no skip return with
A=O.

An attempt to define an already existing special group

name also results in a no skip return, but with the group number
in A.

12-5
BRS 62 - Delete Special Group
Takes a special group number in A.
The associated special group name is deleted and the number made
available for reassignment to a new name.
to the special group are released from it.

All files belonging
If no name is

attached to the number, the BRS has no effect.
12 . 3

Pseudonyms

By means of the command USE NAME it is possible for a user
to insert in his file directory a pseudonym, that is, a name
which, instead of being a tag for a real file, is a tag for
another name possibly including a user name and group name.

If

he later uses the pseudonym, the action taken is exactly the
same as if he had typed the entire name for which the pseudonym
stands.
12. t~

Doing

r/o

to Files, File Numbers

The file name is an unwieldy and inconvenient handle for
the I/O routines to use in transferring data.

These routines

instead reference the file by a compact, I-word file number
which is more closely related to the file's whereabouts.

Thus

system subroutines. are provided to assign to a given file name
some temporary file number.
The user may find it useful to remember that the system
subroutines which perform information transfers to and from
sequential files are the same for input as for output.

The

distinction is carried by the file number with which they are
used--whose character is in turn determined by whether it was
returned by BRS 15 (input) or BRS 16 (output).

Hence a program

which was designed to output information can, without ill-effect,
be delivered an input file number.

The effect will be to lose

the characters \'Thich the program would be trying to output, while
taking in characters in their place--these too, due to the nature
of the program, will in general be ignored and lost.
Names are recognized and a file number provided, if required,
by the system subroutines BRS 15, 16; they may be deleted by

12-6.
ERS 63.

The preceding description of the manner in which file

names are recognized largely assumes that they are being typed
in on a teletype.

They may, however, be presented to the BRS' s

as a ready-made string of characters in core.

Entry parameters

for the BRSs include a string pointer to a string in core
together with an input-file number (most commonly teletype).

The

character, string may be null or an initial part of a file name
or an entire file name.

In the first two cases sufficient

characters are appended from the input file to ensure recognition
or rejection of the name.
[A Remark on "Random" Files on Tape
Random and sequential files may be stored and accessed with
equal facility on "random" storage devices, such as the drum
and disk.

On the other hand sequential devices, such as magnetic

or paper tape, cannot be conveniently or efficiently accessed
in the manner of random files and are restricted to holding only
sequential files.

However, the command 'COPY FILE' will allow a

user to copy information from an existing random file, say on
the drum, to a sequential but has a special format which does
not allow it a sensible interpretation as a sequential file but
permits the original random format to be restored when it is
copied back to a random device. Such a "random tf file on a
sequential medium will result in the return of the apparently
paradoxical information, 1-0 in bits 0,1 of X when the file is
opened by BRS 15, 16.

Before accessing information in such a

file the user should copy it (using the Exec command or BRS 92)
to a non-sequential medium.]
12.5

Qpening Input Files

BRS 15 - Open named file for input:
Takes in A a control word
in B the address of a string pointer, or

~

in X a dual file number.
The function of this BRS is to recognize an existing file name,
optionally, open the file for input and return a file number for
use with subsequent data-input commands.

12-7

Designation of the File
The string addressed by B must be the complete or incomplete
name of a predefined file.

If

the name is incomplete, characters

will be appended from the input file whose number is given in
the least significant 12 bits of X -- until sufficient characters
are available to detennine uniquely a file name (or no such name).
If

the file name is unquoted so that prerecognition occurs, the

"tail" of the name is echoed back to the output file whose number
is given in the most significant 12 bits of X.
If B=O on entry a null string is assumed and characters
collected from the input file are not transmitted to the caller's
memory. If bit a of B is set, the string delivered is considered
null--its position being defined by the first word of the string
pointer. Unless B=O on entry the completed or, in the case of
non-recognition, partially completed file name will be transmitted
to the caller's memory.

If a pseudonym was delivered, it will

be replaced by the string for which it stands.
Unless the file name ·was complete on entry (i.e., no characters need be taken from the input file), a tenninating character
must be delivered to confirm or abort the file name.

Confirming

characters are those with an internal code representation 0 to
16 , also semicolon, tab, line feed and carriage return; the

8

aborting character is 7.

All other characters cause 7 to be

output and are other\vise ignored.
Action:
This is dependent on options which are specified by bits 1
and 2 of A on entry. These are:
Bit 1, if set, $uppresses opening the file (no file number
is returned)
Bit 2, if set, suppresses the need for a terminating
character; when these bits are not set, the action is as
follows:
If the name is recognized and a valid terminating character
is received, the file is opened for input. There is a skip
return with
In A, a file number
In B, the terminating character
In X, is a composite word comprising

12A-l
1.

TAPE or PERMANENT FILES

WORD a
WORD 1
WORD 2
WORD 3

Mask for
BRS 48
SR

PRA

PUA

W?1

= sequential or random

1

= private accessibility
= public accessibility

1

= random
= read only

o=
1

denied to public

= public read only

= public read and write
accessibility a = read and write
2

SGA

= special group

1

= read

only

o = none
SGN = special group number
o = file permanently on drum
S = status
1 = file on drum
2 = file on system tape
3 = file on private tape
U = unused
2.

SCRATCH

WORD 1
WORD 0

3.

FILES
=
=

-1
0, WORDS 2,3 as for TAPE FILES

BUILT- IN FILES

WORD 3
a.

=

-2; WORD 2 = 0

Device

WORD
WORD
WORD
WORD

0 =0
1 (9 to 11]

1 [12 to 17]
1 [18 to 23]

= no. of tape unit

= device
=

no (O/p)
device no. (lip)

12A-2

b.

Permanent file no.

WORD 0

f

0

WORn 1 (6 to 11] = file no. (O/P)
WORn 1 [18 to 23] = file no. (rip)

4.

SPECIAL GROUPS

WORD 2

= -1

WORD 0 =

0

WORD 1 =

creation date

WORD 3 [20

to 23] --

group no.

5.

PSEUDONYMS

WORD 3 = -1
WORDS 0,1 = string pointer to real string
Description Block Format

WORD 2

=0

12A-3

FILE DIRECTORY DESCRIPTION
(A)

PREAMBLE AND STORAGE ARRANGEMENTS
0

1
2

3
4

5

6

II,
1,
12

13

FLTH
eFTA
SGUS

ZRO
ZRO

FDIX
FUNO
BSS

SRO
ZRO
ZRO

HTL
EHTL
FDSS

ZRO

ZRO

ZRO
ZRO

EFDSS ZRO
ZRO

File directory length
Address of compressed file input table (eFIT)
(Bits set to indicate special group numbers
in use)
Drum index block address for this file directory
User number
Address of beginning of description block
storage
Beginning of hash table (BRS 5,6 table)
End of hash table
On.S
IoVQItt)
Character address of beginning of string

r,

storage (WCH table)
End of string storage
Garbage collection option

The remaining parts of the file directory appear in the
following order:
Hash table (HTL, EHTL)
String storage (EHTL, BSS)
File description block storage (BSS, eFTA)

l2A-4
USER DIRECTORY DESCRIPTION
(A)

PREAMBLE AND STORAGE ARRANGEMENTS
0

BURT

ZRO

1

EUHT

ZRO

2

ZRO

3

BUDSS ZRO

4
6

EUDSS ZRO
ZRO
BUDBT ZRO

7

BUDB

5

ZRO

Beginning of hash table (BRS 5,6 table)
End of hash table
BRS 5,6 link
Character address of beginning of string
storage (WCH table)
End of string storage
Garbage collection option
Address of beginning of description block
table
Length of each user description block

The remainder of the directory appears in the following order:
Hash table (BUHl',· EUHT)
String storage (EUHT, BUDBT)
User description blocks (BUDBT, end of directory)

(B)

TYPICAL HASH TABLE ENTRY

~2~______________________S_TR__IN_G__~_S_~
__~
___TO____________~
.

(c)

USER NUMBER

TYPICAL DESCRIPI'ION BLOCK ENTRY

1

HTA
FDL

2

DA

3
4

AW

5

CTW
LTW

0

6

PW

ZRO
ZRO
ZRO
ZRO
ZRO
ZRO
ZRO

Address of hash table entry
File directory drum address
Maximum. drum block allowance
Access word
Password hash code
CPU time word (6oths of a second)
LOGIN time word (seconds)

l2A-5

ACCESS BITS ARE
0

WAr!' }

1

IDIOT
PRFFLG

2

3
4

XMOK

5

NTFFLG
UTTFLG

6

OPI'FLG

BRS 37 mode
permanent file flag
exec mode OK
new tape file flag
new files to user tape
operator flag

12-8
In bits 6 to 23, the file length

In bits 3 to 5, the file type

Bit 0 is set if the file is random
Bit 1 is set if the file is not stored on a
sequential medium.
Error Conditions
All error conditions are followed by a no-skip return with an
indicator in X; A and B are undisturbed.
shows that the file could not be opened.

-5~~-1

The possible

reasons correspond one-one with those associated with a
no-skip return from BRS 1 with -2~~2 (see pp. 9-1, 9-7).
X=l This exit occurs if the name given is not a predefined
name in the specified user's file directory.
X=2
?

Indicates that the file name was aborted by delivering
as a terminating character.

X=O Any such error is accompanied by one of the following
'error messages' being sent to the command output file
(normally the teletype).
?

ILLEGAL USE OF PSEUDONYM

-NOT PUBLIC

-NO GROUP NAHE ATTACHED
-VlRONG GROUP NAME
When the requested file exists on magnetic tape it is possible
to receive about 20 different error messages, most of which are
self explanatory.

The pcs ition check message, "( ~: n)" means

only that the tape has reset its position after becoming "lost"
and should be of no concern.
12.6 Opening Output Files
BRS 16 - Open named file for output
Takes in A a control word
In B the address of a string pointer, or ~
In X a dual file number.
This BRS is provided to read an existing or new file name and,
optionally, open the file for output and return a file number for
use with subsequent data-output instructions.

12-9
Designation of the File
The file name is obtained from B and X in exactly the
manner of BRS 15 (q.v.) except that if the name is enclosed
between quotes and is not delivered in association with some
other user's name, then it may be new.
Action
This is again dependent on the control word in A, on entry.

°

Bit 0, according as it is
or 1, specifies that the file
to be created is sequential or random.
Bit 1 is normally zero, to indicate that the specified file
should be opened and a file number returned in A. If the user
does not wish to open the file this bit should be set.
Bit 2 if set suppresses the need for a terminating character.
It also suppresses output of the message OLD FILE or NEW FILE,
which is normally produced after identification of a quoted
file name.
Bits 3 to 5 = t, indicate the file type.
The type of a new file is always set to be t.
The type of an old file is changed to t unless t=O, when the
old file type is retained.

An attempt to open the teletype as

anything but a type 3 file is an error.
Bits 6 to 23 = S, significant only for tape files.
S is taken to be the number of words of information about to be

written. If a new tape file is specified, a space of 3/2 S
words is reserved after the current last file on tape. For an
old tape file, S is compared with the amount of tape space
currently reserved for the file.

If it is greater, an error

message - TOO SHORT is produced, followed by a no-skip exit;
the file is not opened.
The normal return from the BRS is with a skip, the same
parameters being returned in A, B and X as for BRS 15 viz.
in A

a file number number (if opened)

in B

the terminating character (if delivered)

in X

a composite word comprising the file length, type
and logical structure (random or sequential)--See
BRS 15.

R-21
12-10
Error Conditions
All error conditions are followed by a no-skip return with
an indicator in X; A and B are undisturbed.
-5~~-1

shows that the specified file could not be opened.
The possible reasons correspond one-one with those
associated with a no-skip return from BRS I with
-~~2 (see pp.9-1, 9-7).

X=O

This exit follows the printing of one of the following
error messages on the command output file (in addition
to the possible messages given for BRS 15):
READ ONLY
WRONG TYPE
FILE TOO SHORT
FILE DIRECTORY FULL

X=l

if the file name is new and either unquoted or is
delivered in association with the name of another user.

X=2

if the abort terminator (?) is delivered.

Notes:
1)

Although new tape files for the ordinary user will be created
on the standard user's tape, same users can specify the
tape on which a new file is to be created.

For such users

a message
TAPE SYS. NO. =

is printed and a decimal number must here be delivered
through the command-input medium.
2)

If the file name is quoted and not built in, one of the
messages OLD FILE or NEW FILE is sent to the command output
medium.

As described above, this message may be suppressed

by setting bit 2 of A on entry.

3)

An attempt to change the logical structure of an old file
(from random to sequential or vice versa) will elicit a
message to notify the user before the name terminator is
delivered.
12.7

Miscellaneous File Operations

ERS 63 - Delete name from file
Takes in B a string pointer
in X a dual file number

dire~tory

12-11
The entry parameters are used to designate a name in the
file directory in the manner of BRS 15.

The name is removed

from the directory subject to the following conditions:
A built-in file cannot be deleted.

The BRS will, however,

allow the user to delete all its names except the last.
When a pseudonym is delivered to the BRS the pseudonym
itself is lost.

When the last name of a file is deleted,

the file's contents are also lost.
A successful deletion is followed by a skip return.
A no-skip return indicates that the attempt to delete
failed.

The contents of X will indicate the reason for failure

as follows:
X=3,-2,-1

correspond to no-skip returns from BRS 1 with
A=-2, -1,0 re spect i ve ly .

Such an exit results

only from an attempt to delete a drum :file.
X=O

indicates an attempt to delete the last name of
a built-in file.

X=l

if the name is not in the file directory.

BRS 60 - Interrogate file description block
Takes in B the address of a string pointer
in X a dual file number
The entry data are used, in the manner of BRS 15, to determine
a file.

The first three words of the description block for that

file (see p. l2A) are Skip-returned in A, B and X respectively.
BRS 48 - Set file modes
Takes in A a file mode word
in B a string pointer address
in X a dual file number.
B and X are used, in the manner of BRS 15, to determine a file
name.

BRS 48 will then use the information in A to set or change

the special group membership, type and accessibility of the
specified file (which must belong to the caller).
All of these characteristics are determined by bits 1 to 4, and

6 to 16 of the third, "mode", word of the description block

12-12

BRS 48 directly replaces
these bits by the corresponding bits of A after checking A for
consistency and existence of the specified special group.
A successful mode change is denoted by & skip return,
failure by a return without skipping.

associated with the file (see p. l2A).

12.8 Opening Scratch Files
Scratch files are all kept on the drum. They differ from
ordinary files in that they disappear completely when the user who
created them logs out. A fixed amount of drum space is available
to each user for scratch files, which he may allocate as he sees
fit. If he attempts to exceed the allocation a message will be
given.

A scratch file may be created by BRS 16 or any of the commands
which create a new file, by delivering to them a new scratch
name (see 12.1). Alternatively, for a scratch file with a name
of the form /ddd/ where d is any decimal digit, the elaborate
string delivery and recognition procedure of BRS's 15,16,63
can be bypassed by using BRS's 18,19,65 respectively. Instead
of a string ~ointer and dual file number, these three BRSs take,
for file identification, an integer in X. The decimal equivalent
of this number is a string of three digits enclosed between
slashes is then used as a file name to refer to the file in the
conventional way.
BRS 18
Takes in A a code word
in X an integer
This provides an alternative way of referencing and opening for
input scratch files whose names are decimal integers.
The number in X is transformed into its equivalent string
of three decimal digits enclosed between slashes, 5 characters
in all, (a number which exceeds 999 is taken to de$ignate the
string /999/). This string should be a predefined name in the
caller's file directory. The subsequent action of this BRS is
to open the file for input in exactly the manner of BRS 15,
i.e., dependent on bits 1 and 2 of A; the return conditions are
the same as for BRS 15.

12-13
BRS 19
Takes in A a code word
in X an integer
By means of this BRS a scratch file with a decimal-integer name
can be opened for output.

As for BRS 18, the number in X is

first transformed to a string of three decimal digits enclosed
between slashes.

The name is then treated as a possibly new

name for a scratch file, belonging to the caller, in exactly
the manner of BBS 16 .

Hits 0 to 5 of A also have the same

Significance as for BRS 16.
BRS &5
Takes in X an integer
The integer is converted into a string of three decimal digits,
as in BRS 18, 19.

The action thereafter is exactly as for

BRS 63, successfUl deletion being indicated by a skip return.
12.9

Format of the File Directory, Some Implementation Details

File names, group names and pseudonyms are contained in
hash structure of the type described in the Section
manual.

8.

14 of this

The first two words of each hash table entry are the

conventional string pointers to the file name.

The third word

(the string "value") is a pointer to a 4-word "description
block."

In these four words is held all the information

necessary to characterize the name, whether it be the name of
a drmn file, tape file, special group, pseudonym, etc.

Notice

that several entries in the hash table may point to a Single
description block; the associated names are then synonyms for
the same object, which can be referenced by anyone of them.
The conunand DEFINE NAME creates a new name to point to an
existing description block; conversely DELETE NAME detaches the
name from its description block, the description block itself
is lost only if this was the only name pointing to it.
The format of a single hash table entry with attached file
description block is sketched on page 12 A.

12-14

Executive commands and BRSs are available for interrogating
and changing parts of the user's file directory. The commands
FILE DIRECTORY and SET MODES FOR FILE are described in the
manual for the TSS Executive (Document R-22).

The corresponding

BRSs are BRS 60 and 48.
12.10 Miscellaneous Services
BRS 92 - Copy file to file
By means of this BRS infor.mation can be copied from one file
to another. The entry parameters consist of an input file number,
an output file number and some bits to determine the nature of
the files. If the information transfer is successfUl,there is a
skip-return; if unsuccessful, a no-skip return, possibly preceded
by a message.
On entry, the contents of A are taken to refer to the input
fi Ie as fo llows :
bits 15 to 23
bits 3 to 5
bit 1
bit 0

give the input file number
give the file type
is 0 for a sequential device (tape, teletype)
or 1 for a random device (drum, disk)
is 0 for a. sequential file, 1 for a random file

The contents of B refer to the output files.

Only bits 0,

1, and 15 to 23 are significant and have a similar interpretation
to the corresponding bits of A. The necessary information for
setting bits 0 and 1 correctly is returned by BRS's 15, 16 as
bits

'/J,

1 of X.
The copy will be successfully terminated when any of the

following terminators is read from the input file.
1)

Input file sequential
a) An EOT (144 ) character, if and only if the input file

8

b)
c)

is a teletype.
An EOF (137 ) character for other type 3 files.
8
2 consecutive termwords (27657537 8 ) for all other
sequential files.

12-15

2)

Input file random
a)

1 termword if the file is stored on

b)

Otherwise the copy terminates when the end of the

a

sequential device.

index-block chain is reached.
The return after a successful copy is with a skip.
Errors
Errors may be
a)

Calling BRS 92 with inadmissible parameters.

b)

Unusual conditions detected during a data transfer.

Errors of type (a) may be anyone of the following:
Attempt to copy a sequential file to a random file.
Attempt to copy a "random" file on tape to a sequential file.
Attempt to copy a non-symbolic file to teletype.
Attempt to copy directly from magnetic tape to a teletype
or vice-versa.
They are all followed by a no-skip return.
Errors of type (b) are all signalled by a message, which is
sent to the command output medium.

The messages may be any of:

-END OF TAPE

UNTIMELY EOF IN INPUT
UNT:wELY EOR IN INPUT
RANDOM FILE TOO BIG, TRANSFER TERMINATED AT ADDRESS



FAILED TO READ INDEX BLOCK
INPUT ERROR

OUTPUT ERROR

All but the last two are followed by a no-skip return.

In the

case of the last two the transfer continues from the point at
which the transfer error was detected until the entire file is
copied.
BRS 93 - Make a "save" file
Takes in A the address of a core-bounds list
in B the address of a 2-word map
in X a sequential output file number

12-16

This BRS may be used to preserve the contents of specified
ranges of core (in the map given by B) to the output file given
by X; note that this file must be sequential.
The core bounds list addressed by A, is a contiguous li.t
of positive numbers terminated by any negative number. The first
entry of the list is ta.ken as a "starting address" - and is the
address to which a transfer of control will be made when the da.ta
preserved by this BRS is read back into core by the GO TO command.
Subsequent entries in the list are taken in pairs--each pair
defining a range of memory from which information is to be saved.
The two addresses in each pair may be given in either order.
All addresses are taken with the map whose core address is given
in B--if B is zero, it will be assumed that the user's current
program memory is to be saved.
If the information
there is a skip return.
in an ~ediate no-skip
The formats of the

is successfully transferred to the file,
Any failure in the data transfer results
return.
core bounds list and the resultant save

file are:
Format of Core Bounds List
i

Starting Address
m
l

. Format of save File
11 = min (m1 ,n l )
u 1 =max (~,nl)

nl

Starting Address

m2

·
data· from

n2

.

.

core range 11 to u
l
12

~

~
negative number

u2

data from core 12 to u 2
·

·

data

··
from

core ~ to

term word
term word

'1t

12-17
BRS

94 -

Restore a save file to core

Entry A,B

= relabeling
= file no. of

sequential save (type 1) file
The save file, which should have the format described in
X

BRS 93, is transferred to the memory given by the map in A,B.
If the transfer is successful, there is a skip return with the
starting address (see BRS 93) in A and the file number in X.
An unsuccessful data transfer results in a nO-Skip return.
BRS 131/132 - (open tape for input/output) [privileged]
Given in:

A
B

= the
=

desired tape position (0CLB, WCH will
write the character in A into character position CLB+l and
increment CLB. If CLB>CUB the character is not written and
control is transferred to the third word of the table with A and
X undisturbed and the address of the offending WCH in B. This
can be an error trap or an exit to a routine which allocates
more memory, by garbage collection or otherwise, for further WCH's.

14.3 String Compare Operations
SKSE ADDR skips if the string addressed by the pointer in
AB is identical with the string addressed by AnDR.

If the strings

are of different lengths or have different contents, SKSE does
not skip. This instruction is essentially identical to SKE,
except that it acts on strings rather than numbers.

A, B, X

are not disturbed by SKSE.
SKSG ADDR skips if the contents of the string addressed by
AB is greater than the contents of the string addressed by ADDR
and ADDR+l.

Comparison is made character by character, and

terminates with the first unequal characters; the numerical,
internal code representation of characters is used to determine
inequality.

If the strings are equal for the entire length of

the shorter one, the longer one is indicated as the greater.

A,

B and X are not disturbed by SKSG.

14.4 String Input/Output
BRS 33 accepts a string pointer address in A, a file
number in X and a "terminal character" in B. It collects
characters from the file and appends them to the string until
the terminal character is seen; this is not added to the string.
It then returns the updated st.ring pointer in AB; the string

14-4
pointer in core is also updated.

If bit 0 of A is set on entry

the string is taken as null with the second pointer equal to the
first.
BRS 34 accepts a file number in X, a word address in A and
a count in B.

It outputs B consecutive characters starting with

the first character of the specified word. If B=-l on entry
characters are output until I is encountered and the character

$ is interpreted as carriage return, line feed.
ERS 35 accepts a fi~e number in X and a string pointer in
AB. It outputs the string to the fi1e.

14.5 Hash Table Lookup Instructions
The hash table is a structure for minimizing the effort
required to perform certain scan-and-compare operations when the
operands are strings.
A hash table is a contiguous set of 3-word "augmented string

pointers." The addresses of the first and last-pIus-one locations
of the hash table we shall denote by HT, EHT respectively. Each
augmented string pointer occupies three consecutive locations
of the hash table.

Bits 8 to"23 of each of the first two

locations hold the actual string pointer; bits 0 to 7 of these
two words, as well as the entire third word (the so-called string
"value") may hold arbitrary information.
bits 0 to 7 of the string pointer words

Note, however, that
~

be zero if used with

GCI or WeI.

There are three BRSs to perform operations on a hash table:
they are BRS 5, BRS 6, BRS 37. BRS 6 is used to introduce new
strings into the table. BRS 5 and BRS 37 each perform a scan of
the hash table for a string to match a given string.
Before using BRS 5 and BRS 6 to insert string pointers into
an initially empty hash table, the hash table area must be cleared
to zeros.
BRS ; takes a string pointer in A, B, a table address in X.
The table comprises 3 words:
ZRO
ZRO
ZRO

HT
EHT
0

14-5
The first two define the hash table bounds, the third is used
for communication with BRS 6.
BRS 5 searches the hash table for a string to match the
given one.

If successful it returns in B the address of the hash

table string pointer (the string "indextl)--and in A the string
"value"; it skips on return.

If the search is unsuccessf'ul,

BRS 5 returns with A, B unchanged and the addre s s of the next
free table entry in word 3 of the table (this will be -1 if the
table is full). X is not disturbed.
BRS 6 takes a string pointer in A, B and a table address
The table is as for BRS 5.

in X.

This operation inserts the

string pointer into the hash table at the point determined by
the last BRS 5 which failed (i.e., at the location specified by
the third word of the table).
illegal instruction trap.

If this word is -1, there is an

BRS 6 is intended for use only in

inserting into the hash table a string pointer for which BRS 5
failed to find a match and should not be used except after a
failing BRS 5. Furthermore, string pointers should not be
placed in the hash table except with BRS 6 (otherwise the scanning
algorithm used in ERS 5 will not work).

Note that BRS 6 does not

physically move the characters to which (AB) points.
exit, BRS 6 returns in B the address of the first word
of the new hash table entry and in A, the "value" word of the
entry; X is not disturbed. To delete a hash table entry, put
On

-1 (not 0) in the first word.
BRS 37 takes a dual file number in A, a string pointer
address in B and, in X, the address of two words conta.ining
table bounds HT, EHT. A dual file number is a single word
holding an output file number in the first 12 bits and an input
file number in the second. If the output file number is zero,
the user's teletype will be used. The table has the same form
as a hash table, but the string pointers may be put into it in
arbitrary order; it is

~

necessary to use ERS 5 and BRS 6.

The behavior of BRS 37 depends on the command recognition
mode currently set in the exec (see R-22, Section 5.5). If the

14-6
mode is BEGINNER, the hash table is scanned for a string to
match exactly the given one.

If none is round but the given

string matches the initial part of some hash table string,
characters from the input file are

appe~ded

to it until either

an exact match is obtained or a match becomes impossible.

The

exit is described below.
If the mode is NOVICE, the hash table is scanned for a
string to match the given one.

If none is found but the given

string matches the initial part of some hash table string,
characters from the input file are appended until the string is
long enough either to determine a unique hash table string, with
a matching initial part, or for no match to be possible.
the former case, if the hash

tabl~

In

string now contains three or

less as-yet-unmatched characters, more characters are taken from
input until an exact match is obtained or no match is possible;
if the hash table string contains four or more as-yet-unmatched
characters these unmatched characters are sent to the output
file.

If the input file is the teletype, BRS 37 waits until

all the characters have been output, and the input file buf"fer
is cleared before exit.
If the .mode is EXPERT the hash table is scanned for a string
to match the given one.

If none is found but the given string

matches the initial part of some hash table string, characters
from the input file are appended until the string is long enough
either to determine a unique hash table string, with a matching
initial part, ££ for no match to be possible.

In the former case

the rema.ining characters of the hash table string are sent to
the output file.
Exits are as follows:
The no-match condition causes a no-skip exit with a string
pointer in AB to the string so far collected; X is undisturbed.
If a match is found there is a skip exit with the address of the
matching table entry in A and the string value in B, X is undisturbed.
The following subroutine illustrates a use of the hash
table facility.

A string is input from the teletype and appended

to WCH string storage until a carriage return is encountered;

14-7
it is assumed that string storage does not overflow in the process.
The hash table is then searched for the string; if it is not
already there it is inserted.

In any case, an exit is made with

the value of the string in A and the address of the string
pointer in B.
BRS 5, 6.
INPUT

LOOP

On entry

CTL is the address of a table for WCH.

ZRO

INPL

LDA
STA

CTL

TCl

remember beginning of string

TEMP
CHAR

SKE

=l55B

terminator?

BRU
LDA
LDB
BRS

WRITE
TEMP

yes

BRS

CTL

5
6

WCH

INPUT
CTL

BRU

LOOP

SBRR

WRITE

X contains the address of the table for

15-1

15.0 Floating Point Instructions
This section describes the floating point operations which
are available in the system. SYSPOPs are provided to do floating
addition, subtraction, multiplication and division and to convert
under format control between the internal floating point representation and an external representation as a string of digits,
decimal points and E (for exponent). BRS's exist which perform
input-output and conversion automatically without involving the
user with the external string representation. All these operations
preserve the X register, except input routines which return the
terminal character in X. Most destroy AB by leaving a result
there.
15.1 Floating Point Representation
A floating point number is held internally as two 24-bit
machine words. The format is

o 1
MANTISSA

The number is always normalized:

3813_:140
_

_

471
EXPONENT

i.e., the most significant

bit of the mantissa differs from the sign bit.

All floating

point operations expect normalized operands and produce normalized
results.

Both mantissa and exponent are treated as two_complement

numbers. The two words of the floating point number appear in
the AB register or in memory in the order indicated.
A floating point number is represented
string of characters.

externa~

as a

This string has the following form:

[!] [string of digits] [.[string of digits]]
The brackets .indicate optional constituents.

[E[~]string

of digits)
At least one digit

must appear. Imbedded blanks are not allowed. The E indicates
that the preceding number is to be multiplied by the power of
10 specified after the E. In general a floating point number
being input may take any form which matches the template above.
On output the form produced will be determined by the format specified.

15-2
15.2

Floating Fbint Arithmetic

There are four SYSPOPs to perform floating point arithmetic.
Each of these takes one operand from AB and the other from M and
M+l where M is the effective address of the instruction.
result is left in AB in normalized form.

The

If its magnitude is

greater than 5.7896044E+76, the overflow indicator will be
turned on and this value will be returned. The overflow indicator
is not cleared by any of these instructions.

In this respect the

floating point POPs behave exactly like the integer machine
instructions: a sequence of operations can be performed before
the overflow bit is tested. The bit will be on if any operation
caused an overflow. If the r.esult is less than O.8036l6E-77, it
will be set to O. No indication will be given.
The four operations are:
FAD
FSB
FMP
FDV

Floating
Floating
Floating
Floating

add
subtract
multiply
divide

An attempt to divide by 0 will produce an overflow.
Two SYSPOPs are provided for loading and storing double
words. The words involved need not be floating point numbers,
of course.
wad pbinter:

LDP M puts the contents of M and M+1 into AB.

Store pointer:

STP M puts the contents of AB into M and M+l.

Three BRS's provide for unary operations involving floating
point numbers.
Floating negate:
Fix:

BRS 21 returns in AB the negative of the
floating point number supplied in AB.

BRS 50 converts into a double precision fixed point
number. The integer part appears in A.
The fraction part appears, left justified,
in B. If the integer is too large, the
most significant bits will be lost. The
integer part is the next smaller integer.

Float.

I.e., IP(-1.2)=-2.
BRS 51 converts the integer in A to a normalized

floating point number in AB.

15-3
15.3

Input/Output Formats and Conventions

Every 1/0 operation allows the user to specify a format in
the X register.

Format specifications are based on Fortran

conventions, and are specified as follows:
Bit of X

Field Name

Significance

T

Format types:

0-2

1
2

integer.
E format with the number right
justified within the specified
3 F format with the number right
justified within the specified
4 E format with the number left
justified within the specified
5 F format with the number left
justified within the specified

field.
field.
field.
field.

3-8

D

Number of digits following the decimal
point.

9-14

w

Total field width
If the field width is 0, the 1/0 will
be done in free format.

15

0

Overflow action.

16-23

N

1/0 file number. 0 always refers to
the teletype. ISC and SIC ignore
this field.

Examples:

F6.3
E17·9
15

30306000
21121000
1000)000

On input only the Wand N fields are significant.

Note that

exactly W characters w111 be read on input (unless W=O).
blanks and any trailing characters are ignored.

Leading

Free format

input will accept as many characters as it can in constructing a
number which fits the external representation described above.
The input operations always return a floating point result.
They skip unless overflow occurs, in which case they return the
largest possible nwnber and do not skip.
may be provided:

Any number of digits

the first 11 digits after any leading zeros will

be the ones used.
On output the W field should be made large enough to
accommodate Sign,

dec~al

point, E, sign of exponent and exponent

(if the format type requires any of these elements) as well as

the digits of the number it.self.
conditions belOi'T.

Sec the discussion 01 error

Tht: sign is printed only if the number is

negative.
There are two ways to output an integer:

(1)

format, or (2) F format with 0 in the D field.

integer

The former

requires that the number in the A register be in integer form;
the latter expects a floating point number in AB.
Free format output generates between 11 and 16 chara.cters.
If the magnitude of the number is between lEO and lE9, ten digits
are output with the decimal point properly placed.

Otherwise,

exponential format is used; in particular, the format E15.9.

For

example, the following numbers might be generated by the free
format output.

5.379605400
15.4

-145362.59h7

5.789604462E+76

Input/Output Operations

Two SYSPOPs are available to convert between the internal
binary representation of a floating point

n1h~ber

and its

external decimal representation as s. string of characters.

The

string is stored nnd addressed according to the standard system
conventions.
String to internal conversion (SIC):

Characters are read from

the string pointer addressed by the pop under control of the
format in X.

The internal representation of the number is

returned in AB.

The first character after the number is returned

in X if free format was specified.
Internal to string conversion (ISC):

The number in AB is converted

according to the format in X and the resulting external representation is written onto the end of the string addressed by the POP.
The string pointer is updated.
Two BRS's are available to do input/output and conversion
at the same time:
Floating input:

BRS 52.

format word in X.
to that of SIC.

Input takes ple.ce according to the

The operation of this BRS is identical

15-5
Floating output: "BRS 53. Output takes place according to the
format word in X. The operation of this BRS is identical to
that of ISC.

15.5 Output Error Conditions
There are four possible error conditions.

one of these

~Vhen

conditions occurs the following action is taken:
a)

Interrupt 5 is generated

b)

An error code is put into location 200B

c)

The indicated corrective action is taken and execution
continues.
Condition

Code

Action

field is not 1,2,3,4 or 5

1

T

2

Exponent field is too small

3

Integer exceeds 8388607
in magnitude

4

Field for F-conversion
too small
If either of error types 2 or

Assume 2(E format)
Discard characters from the
left or take overflow action.
Use 8388607
Discard characters from the
left or take overflow action.

4 occurs and bit

0

in the format

word is set, then the output field will be filled with *'s.

A-I
BRS TABLE

NAME

MONOPN
MONCLS

---7 {<.svD5Jf

NUMBER

FUNCTION
--

I

Open file

2

Close file

3

( IJ c.- Iy-.

O~fA"1

9-4, 9-8
9-4
t.r IJ

'}~e ~S

MPl'

4

SSCH

5

SSIN
DCLR

6
7

IOH

8

FKST

EXSOFN

9
10
11
12
13
14
15
16
17
18
19

CFILE

20

FNA

Floating negate

MSGS

21
23
24
25

SKROUT

26

ASTT

'Z7

RSTT

28

Skip if rubout waiting (exec)
Attach TTY
Release TTY

C~B

29

Clear output buffer

PPAN
CIB
CET
SKI
OOB
EXGIFN
EXGOFN
UABORT

EXSIFN

LNKS
LNKC

Release memory
SPS search

5-3
14-5

SPS insert

14-5
10-3

Release all space acquired
via BRS 126
Close all files
Open fork
Progrwmmed panic
Clear input buffer
Declare echo table
Skip if input buffer empty
Wait for output buffer empty
Symbolic input file name
Symbolic output file name
Close all file s
Scratch input file
Scratch o~tput file
Close file
Link TTY
Unlink
Set AM and AI bits

9-4
3-1
3-6
7-5
7-2
7-5
7-5
12-6
12-8
9-2
12-12
12-12
9-2
15-2
7-6
7-7
7-4
3-6
7-3
7-3
7-5

A-2
NAME

NUMBER

GETSTR

30
31
32
33

~t11'MSG

34

¢urSTR

35

¢UTNUM
GSI.¢¢K
GETNUM

36 .

FKRD
FKWT
FK'lM

RMDY

RDET
I¢RET
RREAL
RDRL
STRL
SQ~

NR~UT
SR~UT

SETFDC
SRIR
FFIX
FFLT
FFI
FF¢
((I( S
MRSB

B(

MBEX
C~

SSMF
f'..pA 1

RFDC
SGDEF
SGDEL

37

38
39
40
41
42
43
44

45
46
47

FUNCTION
Read fork
Wait for fork
Terminate fork
Collect string
Output message
Output string
Output number
General string lookup
Read number

3-3
3-3
3-3
14-3
14-4
14-4
13-1
14-5
13-1

Read date and time
Read echo table
Return from I/O subroutine·
Read clock
Read relabeling
Set relabeling
Dismiss on quantum overflow

6-1
7-2

49
50
51
52
53

Turn rubout off (exec)
Turn rubout on (exec)
Set fd control word
Read interrupts armed
Fix
Float
Formatted floating input
Formatted floating output

55
56
57
58
59
60
61
62

Make or release resider.t block
Make block executive
Guarantee 16ms computing
Define secondary memory
Read mT
Read file directory entry
Define special group
Delete special group

48

~P)54

11-2

6-1
5-2
5-2

2-3
3-6
3-6
12-11
4-2
15-2
15-2
15-4
15-5

5-4
2-3
10-2

12-11
12-4
12-5

A-3
NUMBER

NAME

FUNCTION

EXDEL

63
64

Delete named file

EXSFDL

65

Delete scratch file

DFDL

66
67
68
69

Delete drum

EBSM
GBSM
/::;c S "" A
SKXEC
EXDMS

*EPPAN
~ t:-s Lvi
S/J:J I~ f"S fr-~

f-'5 "" -,
f:.sl~

SAIR
SIm
MBRO

WHEAL
'f.0~/AAr

.,

70
71
72
73
74
75
76
77
78
79
80
81
82
83

12-10

12-13
file (contents only) 9-4

~ V'l/d ;C~

of ~

Enter block in SMT (exec only)
Get SMT block to PMT
(exec only)
Skip if executive
Exec dismissal (exec only)
Economy panic

'Ai]

't 1) ': fl/)- f
Arm interrupts
Cause interrupt
Make block RO

6-1

7-7
7-7
6-1

84
86

Clear special teletype output

RTEX

88

Read execution time

ECDUMP
ECRECV

4-1
4-1
5-3

Dismiss for specified time
Sys go

CLR8p

ECSAVE
ECPIAC

6-1
2-5
3-4

" " r:r P

Set special teletype output

EXRTIM
ECCOPY

5-3
5-3

'/...J~JP()~)

85

DFR

tj'

OP

SET8p

FS uf

q -

89 ;4?) -;r f~
90
Declare fork for rubout
Time to string
91
Copy
92
Save
93

94
95
96

Place
Dump
Recover

3-5
13-1

12-14
12-15

12-17

A-4
NAME

NUMBER

FUNCTION

97

Find user

13-2

Read subsystem relabeling

13-3

98
I

99

J

KB1¢¢

100
)

~/

102
103

EXCNUN
EXCUNN
FKWA

104

Convert name to user number

13-2

105
106

Convert user number to

13-2

Wait for any fork to terminate

3-3

FKRA

107

Read all fork statuses

3-3

FKTA

loB

Terminate all forks

DMS

109

Dismiss

3-3
5-1

RDU

110

BRSRET
TSOFF

III

Read device and unit
9-5
Return from exec BRS (exec only) 6-2

112

n~e

Turn off teletype station
(exec only)

7-4

9-6

113
MTDI

114

Disco"nnect W-buffer (exec only)

CKDOPN
RURL
SURL

115

Skip if no drum files open

116

Read user relabeling

5-3

117

Set user relabeling

5-3

TGET

118

Reserve tape unit (exec only)

9-6

TREL

119

Release tape unit (exec only)

9-6

AIMTE

120

Assign PMT entry (exec only)

5-3

DmTE

121

Release specified PMT entry

5-3

MPAN

122

S~ulate

RTUN

123
124

Read teletype and user number

13-2

Read 2K block
Write 2K block

10-3
10-3

Assign 2K page

10-3

Release 2K page

10-3

RDRM
WDRM

DGET
DREL
f«.~f)

125
126
1'Zl
128

memory panic {exec only)6-2

A-5
NAME

,RQ-- fl5

RDBA
Pm
PTW
LfV

e: [)

SKUEX

fr Pl cJ /
F,/(--TY
/' I.

Celli
WIR
NTOS

MFLSH

RSCP
SSCP
RDSS
STST

NUMBER

FUNCTION

129
130
131
132
133
134135
136
137
138
139
140
141
142
143
144

Read drum assignment
Position tape to read file
Position tape to write file
(exec only)
jJ1-1 i\P

12-17
12-17

f

Skip if caller executive
fl

'i !1:,1 "RI

.

~~I

P

fl
'l 'J

Wait for input request
Suppress or allow output
Force drum/core correspondence
Read status of caller

7-5
7-7
5-5
6-2

Set status of caller

6-2

Read status

9-1
9-1

Set status

B-1
SYSTEM PROGRAMMED OPERATORS
BIO
TCO

116
175
114

TCI
BRS
CTRL

173
172

SBRR

171

SBRM

170

STP

167
166

LDP

165

Block input-output
Teletype character output
Teletype character input
Branch to system
Input-output control
System branch and return
System subroutine call
Store pointer
Load pointer

GCl
WCH
SKSE

164
163

SKSG

162

Skip on string greater

CIO

161
160

Character input-output

WIO
WCI

FAD
FSB

157
156
155

Get character and increment
Write character
Skip on string equal

Word input-output
Write character and increment

9-3
7-2
7-2
Appendix 1
9- 4 , 9-6

14-1
14-1
14-1
14-3
14-3
14-3
9-2
9-3
14-2

Floating add
Floating subtract
Floating multiply

15-2

Floating divide

15-2

6-2

7-4

15-2
15-2

FMP

154

FDV
EXS

153
152

~ST

151

Execute instruction in system
mode
Output to specified teletype

1ST

150

Input from specified teletype

7-4

SAS

147
146

Store in secondary memory
Load from secondary memory

10-3

145

Drum word output

10-1

144
143

Drum Word input
Drum block output
Drum block input
Internal to string conversion
(floating output)
String to internal conversion
(floating input)

10-1

LAS
DW¢
DWI
DBC

DBI
ISC

142

SIC

140

141

10-3

lO-2
10-2
15-4

15-4

B-2
GCD

STr

weD
STO
BPI'

137
136
135
134
135

Get character and decrement
S~ulate teletype input

7-7

\'lri te character and decrement

14-2

Steal teletype output

7-7

Breakpoint (BRS 10)

14-2



Source Exif Data:
File Type                       : PDF
File Type Extension             : pdf
MIME Type                       : application/pdf
PDF Version                     : 1.3
Linearized                      : No
XMP Toolkit                     : Adobe XMP Core 4.2.1-c043 52.372728, 2009/01/18-15:56:37
Create Date                     : 2012:12:03 20:18:22-08:00
Modify Date                     : 2012:12:03 20:06:41-08:00
Metadata Date                   : 2012:12:03 20:06:41-08:00
Producer                        : Adobe Acrobat 9.52 Paper Capture Plug-in
Format                          : application/pdf
Document ID                     : uuid:7f77d971-b97c-4c06-be5f-d8438b8789af
Instance ID                     : uuid:a37db148-70cd-4b62-be2b-d2cf8f620e02
Page Layout                     : SinglePage
Page Mode                       : UseNone
Page Count                      : 106
EXIF Metadata provided by EXIF.tools

Navigation menu