                              PDP-1 Initial Time-Sharing System



          An  initial time-sharing  system has  been implemented for
the PDP-1 Computer of the M.I.T.  Electrical Engineering Department.
This  memorandum describes  the major features,  user privileges and
limitations of the system, and  includes descriptions of the  proce-
dures to be followed to set up the time-sharing system and to return
to normal computer operation. 

          The initial  system  is  equipped  with  two  time-sharing
consoles  (consoles  5 and  6) from  which users  may run  and debug
programs with an invisible debugger [ID] built into the system.   ID
is a Drum DDT which has been modified for time-shared operation (see
Memo PDP-13).  Spacewar can concurrently be run on console 0,  which
makes  use  of the  sense switches  on the  PDP-1 front  panel.  The
control levers on the front panel - START, STOP, CONTINUE,  EXAMINE,
DEPOSIT, and READ IN -are disabled during time-shared operation. 

          In  the time-sharing system, only  one user's program at a
time may  occupy  core  memory, and  multi-user  operation  must  be
accomplished  by running  programs in  time sequence.   With several
programs operating, each one is placed in core memory and run for  a
short  time  interval  while the  other  programs are  saved  on the
magnetic drum. 

          To supervise the operation  of users' programs within  the
system,  a section of core memory (presently, registers 6200 through
7777) is  reserved  for  the  time-sharing  executive  routine.   An
attempt  to directly  or indirectly  reference a  location above the
memory bound of 6200 causes the user's program to stop running,  and
the  debugger then informs  the user where  that illegal instruction
was executed.  One function of the executive routine is to determine
the  sequence of operation of users'  programs.  As it was necessary
to make as much memory as possible available to users, a round robin
scheme  was adopted_.   each program  is considered  in turn,  and is
brought into memory and run if it has a task to perform.   Operation
of  a  program is  terminated when  a preset  time limit  (about 130
milliseconds) is exceeded.  The program is then returned to the drum
and  the next  user's program placed  in operation.   Operation of a
program is also ended if it  has no further computation to  perform,
i.e.,  it  is waiting  for in-out  operations  to be  completed, has
reached a halt instruction, or  has attempted to execute an  illegal
instruction. 

          Since  no administrative program has  yet been written, ID
is used as the basic administrator for the initial system.  It  must
take  the place of the levers  and indicators which are available to
the user under normal  PDP-1 operation.  ID only  reads in (by  "Y")
programs  punched in standard MACRO binary block format.  For binary
tapes punched in  read-in mode  or other  incompatible loaders,  the
user  may write his own loading program in core to take the place of
a loader otherwise loaded in read-in mode.  
          
                                                                  
.T.i.m.e.-.S.h.a.r.i.n.g. .C.o.n.s.o.l.e


          Each  time-sharing console (except  console 0) is equipped
with a typewriter and  a small control  panel of switches,  buttons,
and two indicator lights. 


1.   Typewriter - used for  type-in and type-out for  ID and for the
user's program. 


2.  CONSOLE ON Switch - when  the switch is turned off, the  program
running  at that console  is stopped, and  a fresh ID  is set up for
operation.  Turning off the switch also releases any reader or punch
assignments  for ID and the user's program at that console.  Turning
the console on again activates the fresh ID. 


3.  Call Button - always returns control to ID.  If ID was  running,
it causes ID to cease its current operation and return to its listen
loop (.t.y.i instruction)_, if the user's program was running, it causes
control to return to ID as if a breakpoint trap had occured. 


4.   Display Lever  - when  depressed, the  program running  at that
console is given an extended running  time in core, and Spacewar  on
console  0 is made inactive.  This facilitates observing information
on the scope. 


5.  STOP PRINT Switch -  depressing this switch disables  typewriter
completion  pulses and  can thus be  used to  temporarily stop type-
outs.  Releasing the STOP PRINT  Switch allows type-out to  continue
without losing any characters_, however, if a key is struck while the
STOP PRINT  Switch is  depressed, then  the entire  contents of  the
typewriter buffer is lost. 


6.   Six Sense Switches - these are used by programs associated with
the console.  The sense switches on the front panel of the PDP-1 are
used by the program running on console 0.


7.   Run Light -  this is lit  when the program  associated with the
console is actually running in  core.  When no programs are  active,
the run lights on all of the consoles may glow dimly. 


8.   Type-in  Light -  this remains  on  when the  executive routine
typewriter buffer is able to  accept typed-in information.  See  the
section concerning the .T.y.p.e.w.r.i.t.e.r under .I.n.p.u.t.-.O.u.t.p.u.t.  
          
                                                                  
.N.e.w. .I.n.s.t.r.u.c.t.i.o.n.s


          The  time-sharing system gives the user the opportunity to
use the following five instructions  in his programs.  They are  all
of  executive  class  (i.e., iot  xx77)  and are  transparent to the
accumulator and IO register. These instructions are included in ID's
initial symbol table.




.s.d.l (iot 3477)      .Skip on .Display .Lever    (5 microseconds)

          If  the  Display  Lever  of the  console  assigned  to the
program in  which  the instruction  is  executed is  depressed,  the
program  counter  is  indexed  one  extra  position,  and  the  next
instruction in the sequence is skipped.  The intent of the skip  can
be  reversed by  making Bit  5, normally  the indirect  address bit,
equal to ONE. 




.s.p.s (iot 3077)      .Skip on .Print .Status    (5 microseconds)

          If the  console  assigned  to the  program  in  which  the
instruction  is executed is in print  status, the program counter is
indexed one extra position, and the next instruction in the sequence
is skipped.  The intent of the skip can be reversed by making Bit 5,
normally the indirect address  bit, equal to ONE.   A console is  in
print  status when  the last  operation performed  by that console's
typewriter was a type-out. 
          The following sequence  of instructions may  be used in  a
program  in order to determine whether  the computer is operating in
time-sharing.  The .s.p.s will not skip when out of time-sharing  since
the .i.o.t decoder for the normal machine does not recognize executive-
type instructions_,  therefore,  .s.p.s  becomes equivalent  to  .n.o.p  in
normal  mode, yet .s.p.s. .i will hang up the computer in an in-out halt.

          cli
          tyo
          sps
          xx        /get here if not operating in time sharing
          xx        /get here if operating in time sharing


          
                                                                  
.a.r.q (iot 2277)      .Assignment .Re.quest

          This instruction traps to  the executive routine where  it
performs one of four possible tasks according to the contents of the
accumulator.  Once a program obtains reader or punch assignment,  no
other  program may obtain  it until it is  released by executing the
appropriate .a.r.q  or by  turning off  the CONSOLE  ON switch  at  the
console associated with the program having the assignment.  Also see
the section concerning .R.e.a.d.e.r. .a.n.d. .P.u.n.c.h under .I.D. 

.C.(.A.C.)     .E.f.f.e.c.t

0         Release reader assignment for the program which executes
          the instruction.  Control is returned to the next
          instruction in sequence. 

1         Obtain reader assignment for the program which executes
          the instruction.  If assignment is obtained, the
          program counter is indexed one extra position, and the
          next instruction in the sequence is skipped_, otherwise,
          control is returned to  the next instruction in  sequence.
          If reader assignment is obtained, the reader buffer
          pointers of the executive routine are reset so that
          tape can be placed at the appropriate position for
          reading. 

2         Release punch assignment for the program which executes
          the instruction.  Control is returned to the next
          instruction in sequence. 

3         Obtain punch assignment for the program which executes
          the instruction.  If assignment is btained, the
          program counter is indexed one extra position, and the
          next instruction in sequence is skipped_, otherwise,
          control  is returned to the  next instruction in sequence.

other     Illegal




.d.s.m (iot 2377)      .Di.s.miss

          This instruction  traps  to the  executive  routine  which
makes  the program which executes  the instruction inactive.  The ID
associated with that user's program is brought back into control and
types a carriage return. 




.b.p.t (iot 2177)      .Break.poin.t

          See the section concerning .B.r.e.a.k.p.o.i.n.t.s under .I.D.  
          
                                                                  
.I.N.P.U.T.-.O.U.T.P.U.T


          In  order to keep  input-output devices moving  as fast as
possible, the  executive routine  buffers characters  for the  type-
writer,  punch, and reader.  Almost all .i.o.t instructions trap to the
executive routine where they are interpreted and serviced.   Control
is  quickly returned  to the  user's program  except when  an output
instruction would cause an overflow of an executive routine  buffer.
In  this case, the  program is dismissed  and remains inactive until
the buffer becomes empty. 


.T.y.p.e.w.r.i.t.e.r

          There is one typewriter buffer  of 16 characters for  each
console.   Typing into a program can be  done as long as the Type-in
Light of the console remains on.   It is turned off when the  buffer
has  been filled by typing-in, and  further striking of keys will be
ignored. 
          In time-sharing, the .t.y.i  instruction alone can replace  a
listen loop.  Executing a .t.y.i causes a character from the typewriter
buffer to  be  transfered to  the  IO  register.  If  there  are  no
characters  in the buffer, the program  is made inactive until a key
has been struck.  Program Flag 1 is .n.o.t set when a typewriter key is
struck, so programs which perform other operations while waiting for
type-in must use a check status loop for detecting the striking of a
key.   An alternate method makes use of the .s.p.s instruction_.  if the
last operation of the  typewriter was a  type-out, then the  console
should  be in print  status until a  key is struck.   This method is
useful only for detecting the first key struck. 
          Also see the section on the STOP PRINT switch under  .T.i.m.e.-
.S.h.a.r.i.n.g. .C.o.n.s.o.l.e. 



.D.i.s.p.l.a.y. .a.n.d. .L.i.g.h.t. .P.e.n

          To  avoid unnecessary administrative  tasks in the initial
system, the display and light pen have been assigned to both  users'
programs  as well  as to  Spacewar on console  0.  If  more than one
active program uses the scope, it will display for whichever program
is in core. 
          When  a console's Display Lever  is depressed, the program
running at that console is given  an extended running time in  core,
and Spacewar on console 0 is made inactive. This facilitates observ-
ing information on the scope.
          Display instructions do not trap to the executive routine,
but are interpreted by the  hardware.  The instruction .d.p.y  (730007)
displays a point and waits 50 microseconds before resuming operation
of the program.  There is no waiting when a display instruction does
not have an indirect bit (i.e., .d.p.y.-.i or .d.p.y.-.4.0.0.0), but the hardware
will delay execution of  the next display  command, so that  display
instructions  cannot be given too rapidly in  time-sharing.  See the
section on .I.n.-.O.u.t. .H.a.l.t.
          Program Flag 3 is set by the light pen as  in normal PDP-1
operation.
          
                                                                  
.P.u.n.c.h

          The  punch  must be  assigned to  a  user's program  or ID
before that program can execute punch instructions.  See the section
concerning .a.r.q under .N.e.w. .I.n.s.t.r.u.c.t.i.o.n.s. 
          Since  characters  punched are  buffered by  the executive
routine, bits  5  and  6  have no  special  significance  for  punch
instructions. 
          The punch buffer holds approximately 50 characters. 


.R.e.a.d.e.r

          The  reader must  be assigned  to a  user's program  or ID
before that program can execute read instructions.  See the  section
concerning .a.r.q under .N.e.w. .I.n.s.t.r.u.c.t.i.o.n.s. 
          As  in normal PDP-1 operation,  if bits 5 and  6 of a read
instruction are both ZERO (.i.o.t. .1 or .i.o.t. .2), an .r.r.b instruction  must
be  executed in  order to transfer  information to  the IO register.
Executing an .r.r.b instruction is illegal  when  not preceded by .i.o.t. .1
or .i.o.t. .2. 
          There are three reader buffers in the initial time-sharing
executive routine.   It is  often necessary  to fill  up nearly  all
three  buffers with characters  from the reader  after a program has
ceased executing read instructions.  It  is advisable to leave  long
trailers  (approximately two fanfolds) at the  ends of all tapes, so
that the reader  buffer pointers will  be correctly initialized  for
the next user of the reader.  Executing an .a.r.q for reader release or
assignment initializes  the executive  routine reader  pointers,  so
that gobbling of tape is stopped. 


.D.r.u.m

          Both  consoles have  access to  their own  drum fields "1"
through "4".   These  fields  can  be used  by  the  user's  program
(locations  0 through 7777) or by  ID (locations 0 through 6200) for
saving and unsaving the user's  program.  Drum transfers may not  be
executed  where  registers  in  core  above  6200  are  part  of the
transfer. 


.C.h.e.c.k. .S.t.a.t.u.s

          The .c.k.s instruction operates in time-sharing as it does in
normal PDP-1 operation.  It does not trap. 


.I.n.-.O.u.t. .H.a.l.t

          The  .i.o.h instruction waits for  display completion after a
.d.p.y.-.4.0.0.0 has been executed_, otherwise, it is equivalent to a .n.o.p  in
time-sharing,  since either  the hardware  or the  executive routine
maintains efficient timing of in-out devices. 


.S.e.q.u.e.n.c.e. .B.r.e.a.k.,. .E.x.t.e.r.n.a.l. .E.q.u.i.p.m.e.n.t


          These subjects will be discussed in subsequent  memoranda.
          
                                                                  
.I.D. .(.I.n.v.i.s.i.b.l.e. .D.e.b.u.g.g.e.r.)


          An invisible debugger is available for use at each console
by turning on the CONSOLE ON switch.  ID is a DDDT (see Memo PDP-13)
modified  for  time-sharing  use_, the  major  changes  are mentioned
below.  ID at each console has a permanent program field  assignment
for  drum field "5" at  that console.  The user  may save and unsave
his program on his fields "1" through "4". Fields "6" and "7", which
contain Expensive Typewriter 9b and Time-Sharing Macro respectively,
can be unsaved by ID at each console.


.S.p.a.c.e.w.a.r

          ID is used to activate and deactivate Spacewar on  console
0.   This  is  done  by typing  either  "1F"  or  "0F" respectively.
Spacewar may also be deactivated by depressing the display lever  at
one of the consoles where a program is running. 


.E.x.e.c.u.t.e. .(.".X.".)

          The expression preceding "X" is executed as an instruction
in protected  memory  of  the user's  program  field.   ID  carriage
returns  before  going to  the  user's program,  and  upon regaining
control, ID types  one carriage return  if the executed  instruction
did  not skip  and two  carriage returns if  it did  skip.  Since ID
gives this identification on skip instructions, it is easy to  issue
".a.r.q.X"  (with  the  appropriate  quantity  in  the  accumulator) and
determine whether an assignment was obtained. 


.R.e.a.d.e.r. .a.n.d. .P.u.n.c.h

          The reader and punch may  be individually assigned to  one
of  four programs -  user's program at  console 5, ID  at console 5,
user's program at console 6, ID at console 6.  Each ID executes  its
own  .a.r.q instruction for  obtaining reader assignment  when the user
types "Y", "T", or  "V", and it releases  reader assignment when  it
carriage returns upon finding the jump block at the end of  the tape
it is reading.  When ID obtains  assignment of the reader, it  types
"ok",  which is followed by a tab when the ".j.m.p. .7.7.5.1" of the read-in
routine is read.  If ID fails to obtain assignment, it types  "busy"
and returns to its listen loop (.t.y.i instruction). 
          If  ID finds a checksum error when reading binary tape, it
types out "cksm" followed  by a tab.   If the user  wants to try  to
read  the same  block again,  he may  reset the  tape in  the reader
between data  blocks  and  strike "c"  (for  continue).   Since  the
executive  routine reader buffers hold characters from approximately
two fanfolds of tape, the data block which caused the error will be
a few fanfolds back on the tape.  After a checksum stop, if any key
other than "c" is struck on  the typewriter, ID  releases its reader
assignment,  issues a  carriage return,  and enters  its listen loop
(.t.y.i instruction). 
          Obtaining punch assignment  is performed by  ID only  when
the  user types "L", and assignment  is released when the user types
an address followed by "J" for the punching of a jump block.  If  ID
obtains  punch assignment, it carriage returns after the "L", but if
it fails to obtain punch assignment, it types "busy". 
          
                                                                  
          Hitting the  call button  releases both  reader and  punch
assignments for ID at that console. 
          When  a user's program  is to use the  reader or punch, it
must obtain appropriate assignment by executing its own .a.r.q instruc-
tion.   The few instructions necessary may be in the user's program,
or the user may type a small  patch ino his program with ID, or  he
may  make use of the execute ("X")  feature of ID.  (See the section
on ID's execute ("X") feature above.)


.B.r.e.a.k.p.o.i.n.t.s

          The instruction which ID inserts in the user's program  as
the  breakpoint instruction is .b.p.t.  When encountered, this instruc-
tion traps to the executive routine  where it is interpreted by  ID.
This  instruction  is inserted  in  a user's  program  by ID  at all
assigned breakpoints when the user transfers control to his  program
(by "G", "P", or "X").  If a .b.p.t causes a trap at a location where a
breakpoint was  not  assigned  to  the  user  through  ID,  then  ID
interprets the instruction as illegal. 
          Depressing  the  call button  when  the user's  program is
running returns control to ID as  if a breakpoint trap had  occured,
and the user may proceed back to his program (by "P"). 
          When  a breakpoint trap  occurs, the address  at which the
trap occured is typed and is followed by a ")" and a tab.  Then, the
contents  of that register  are typed out,  and the current location
pointer is set to that address. 
          There are now only  two restrictions on breakpoint  place-
ment_.   do not attempt to break at a program-modified instruction or
at an instruction in the middle  of a chain of indirect  addressing.


.I.l.l.e.g.a.l. .I.n.s.t.r.u.c.t.i.o.n.s

          When  a user's program executes an illegal instruction, ID
is brought  back  into  control  and  the  address  of  the  illegal
instruction  is typed  and followed  by ">>"  and a  tab.  Then, the
contents of  that  register  are typed,  and  the  current  location
pointer is set to that address.  After the user's program encounters
an illegal instruction,  the user  may correct it  and then  proceed
("P") back to his corrected instruction. 
          Below  is  a  listing  of  the  various  types  of illegal
instructions_. 

1.  .h.l.t instruction

2.  instruction with an illegal operation code

3.  instruction which  directly or indirectly  addresses a  location
above the memory bound of 6200

4.   a  reader  or punch  instruction  when no  assignment  has been
obtained for the program

5.  .a.r.q instruction with accumulator not equal to 0,1,2, or 3

6.  .d.c.c drum instruction using a field other than "1" through "4" or
locations in core above the memory bound of 6200

7.   .b.p.t  instruction  at  a location  where  a  breakpoint  was not
assigned to the user through ID 
          
                                                                  
.P.r.o.c.e.d.u.r.e. .t.o. .S.e.t.-.u.p. .t.h.e. .T.i.m.e.-.S.h.a.r.i.n.g. .S.y.s.t.e.m

1.  Stop the computer by hitting "STOP"

2.  Unplug the on-line typewriter from the front of the computer and
plug it into the plug on the cable for time-sharing console 5, which
is  somewhere on the floor near the  front of the computer.  .B.E .S.U.R.E
to line-up the connecting plugs so that the polarity is correct. 

3.  Turn  on  the "Time-Sharing  Mode"  switch on  the  time-sharing
indicator panel. 

4.   Read-in the "Get TS" tape  on the console.  Wait three seconds.

5.  Turn on "Control Lock" on the time-sharing indicator panel. 

6.  (a) If the computer remains running, the time-sharing system  is
ready for use.  
    (b)If the computer stops,  turn off "Control Lock" and START the
computer running at location 7777.  Go to step 5 and try again. 




.P.r.o.c.e.d.u.r.e. .t.o. .R.e.t.u.r.n. .t.o. .N.o.r.m.a.l. .M.o.d.e

1.  Turn  off  "Control Lock".   Turn  off the  "Time-Sharing  Mode"
switch. 

2.  Stop the computer by hitting "STOP". 

3.   Unplug the typewriter from the console 5 cable and return it to
the plug on the  front of the computer,  making .S.U.R.E the  connecting
plugs have correct polarity. 

4.   The  computer  is back  in  normal  mode and  ready  for normal
operation. 




Note_.  Locations  0  through 7777  of  fields "1"  through  "4"  and
locations  0 through  6200 of  field "5"  for both  consoles are not
affected by setting up or turning off the time-sharing system. 





                                        Michael S.  Wolfberg 
          
                                                                                                                                             
