


          The information in this  document  is  subject  to
          change  without notice and should not be construed
          as a commitment by Digital Equipment  Corporation.
          Digital    Equipment    Corporation   assumes   no
          responsibility for any errors that may  appear  in
          this manual.

          The  software  described  in  this   document   is
          furnished to the purchaser under a license for use
          on a single computer  system  and  can  be  copied
          (with  inclusion  of  DIGITAL's  copyright notice)
          only  for  use  in  such  system,  except  as  may
          otherwise be provided in writing by DIGITAL.

          Digital   Equipment   Corporation    assumes    no
          responsibility  for  the use or reliability of its
          software on equipment  that  is  not  supplied  by
          DIGITAL.

          Copyright   (C)   1973,   by   Digital   Equipment
          Corporation

SRT-8 User's Manual                                             Page 2
Introduction


                     What Is a Real-Time System?



A real-time system is a software framework under which  the  resources
at  hand  (core,  CPU  time,  peripheral  devices) are divided up in a
deterministic  manner  among  several  tasks.   The  term  "task"   is
difficult  to define, as it overlaps with the definitions of "program"
and "subroutine", but basically a task is  a  piece  of  machine  code
which  performs  a specific function, sometimes related to the outside
world and sometimes related only to the needs  of  other  tasks.   The
real-time  system distributes resources to tasks at any time depending
on whether they can make use of them, and whether  a  more  privileged
(higher priority) task wants to pre-empt them.



                            What is SRT-8?



SRT-8 is a real-time system for the family-of-8. It allows  up  to  64
tasks to run concurrently, competing for resources on a fixed-priority
basis.  Included in the SRT-8 system are system  tasks  which  control
standard  Digital  Equipment Corporation I/O gear, a task which allows
interactive system control from the console teletype, and a task which
allows  a  single  copy  of  the  OS/8  monitor  system  to run in the
background.

SRT-8 User's Manual                                             Page 3
Introduction


                     What is a task under SRT-8?



A task under SRT-8 consists of the following parts:

     1.  A Task  Number,  a  number  from  1  to  the  maximum  number
         assembled  into  the  system  (but always less than 64) which
         determines the task's priority (the  lower  the  number,  the
         higher the priority) and also serves as an index into various
         system tables.

     2.  A Task State Table entry, four words long, which is  used  to
         store the task's PC, AC, etc when the task is not running.

     3.  A Task Flags Table entry, one word long, which contains  bits
         which indicate if the task can run, or why it cannot.

     4.  A Task Input Message Queue Header, two words long,  which  is
         the  beginning  of  the  task's  input  message  queue.   All
         inter-task communication in  SRT-8  is  done  via  "messages"
         (blocks of core) sent between tasks.

     5.  The task coding itself, which consists of PDP-8  instructions
         interspersed with calls to the SRT-8 executive for services.

SRT-8 User's Manual                                             Page 4
Concepts


                      How Do Tasks Communicate?



There are two main types  of  task  communication  in  SRT-8 - message
sending  and synchronization.  Since synchronization is more basic, we
will discuss it first.

Task Synchronization and Event Flags

Whenever two processes occur independently, there will be a  need  for
one  to  wait  on  the  other.  The most common example of this is the
PDP-8 Teletype interface.  The Teletype sits  there  waiting  for  the
PDP-8  to produce a character worth printing.  When the PDP-8 has one,
it "wakes up" the Teletype by issuing a TLS instruction.  If the PDP-8
then  has another character to print, it must first "go to sleep" in a
TSF;JMP .-1 loop until the Teletype signals that  it  is  finished  by
raising  the  ready flag.  Then the PDP-8 "wakes up" from its loop and
proceeds to print the next character.

Similarly, tasks in SRT-8 may synchronize with each other by means  of
Event Flags.  An Event Flag is a location which contains the status of
an Event.  An Event is anything which is  important  enough  that  you
would  want to keep track of it with an Event Flag.  (How's that for a
circular definition?). Like the Teletype ready flag, an Event Flag has
the  states  PENDING(>0)  and  FINISHED(0).  So,  a  task could (via a
message) direct another task to perform some action, at which time  it
would  set  a  (mutually agreed upon) Event Flag to the PENDING value.
When the other task was finished it would set the Event  Flag  to  the
FINISHED value (this is known as Posting the Event Flag). If the first
task had been waiting for the Event Flag with a:

TAD Event Flag;  SZA CLA;  JMP .-2

then the Posting of the Event Flag would "wake up" the first task from
its loop.

Unfortunately, the above mentioned loop ties up  a  vitally  important
resource - the  PDP-8  processor.   Therefore,  in SRT-8 (and here the
analogy to  the  Teletype  breaks  down)  Event  Flags  have  a  third
state:  WAITING(<0).  In  the example above, the first task would tell
the SRT-8 executive it  wanted  to  Wait  until  the  Event  Flag  was
FINISHED - the  monitor  would save the task's PC and mark in its Task
Flags Table word that it was waiting on an Event  Flag,  and  set  the
Event Flag to the proper WAITING state (the proper WAITING state being
octal 4000 plus the waiting task's Task Number). When the  Event  Flag
is POSTed (via an SRT-8 executive call) the task which was waiting for
it will automatically be "awakened" by SRT-8.  The  mnemonic  for  the
SRT-8 Executive Request which waits for an event flag is WAITE.

SRT-8 User's Manual                                             Page 5
Concepts


Intertask Messages

Just as Event Flags in SRT-8 are analogous to hardware  device  flags,
messages are analagous to instructions like TLS - i.e. they start up a
task (provided the task  was  waiting  for  a  message)  and  pass  it
information at the same time.  A Message in SRT-8 is a contiguous area
of core storage.  SRT-8 requires the first three words of the  message
(the  Message  Header)  for its use;  the rest may contain any desired
information.  Sending a message does not physically move  the  message
information  to the receiving task, but provides the receiver with the
field and address of the first data word of the message.

If the receiving task is not waiting  for  messages,  the  message  is
placed  on  the  receiving  task's  Input Message Queue.  Messages are
queued in order of decreasing priority (increasing task number) of the
sender  (and  in  the  order issued if equal priority). The second and
third words of the Message Header are used as a  CDF-address  pair  to
link the message to the next queue entry.

The first word of the  Message  Header  is  the  Event  Flag  for  the
message.   When  the  message  is  sent,  the Event Flag is put in the
PENDING state by the SRT-8 Executive;  nothing happens  to  the  Event
Flag  on  receipt  of  the  message  by  the receiving task, but SRT-8
protocol requires that when the receiver is done with the  message  he
Posts the Event Flag.

Note again that the information in a message is not  copied  into  the
receiver's area - this has several implications:

     1.  Data in a message should not be modified by the sender  while
         the Event Flag for the message is PENDING.

     2.  The same message cannot be sent a  second  time  before  it's
         Event  Flag  is FINISHED from the first time.  SRT-8 enforces
         this by checking the Message Event Flag on a  SEND  operation
         and  putting  the  sender into Event Flag Wait if it is still
         PENDING.

     3.  It is legal for the receiving task to store information  into
         the  body  of  the  message - in  this way an "answer" to the
         message  can  be   returned   without   going   through   the
         complications of sending a return message back to the sender.
         For example, when a task sends a message to the  disk  driver
         task  requesting  I/O,  the  error  status  of  the completed
         operation is placed in a specific word in the message by  the
         driver to indicate whether an error occurred.
SRT-8 User's Manual                                             Page 6
Executive Requests


                   SRT-8 Executive Requests (E.R.s)



SRT-8  tasks  communicate  with  the  SRT-8  Executive  via  Executive
Requests(abbreviated  as  ERs).  In  order to make E.R.s simple across
field boundaries, SRT-8 uses locations  20-27  in  every  field  as  a
communication  region  for E.R.s. The Executive is called in any field
via a JMS 20 instruction (hereafter referred to as a  CAL).  The  Data
Field does not have to be any specific value when the CAL is given, as
the code in location 20 sets the DF to the IF, sets the IF  to  0  and
jumps to the SRT-8 Executive.

Because the architecture of  the  PDP-8  does  not  permit  re-entrant
programs,    the    SRT-8    Executive    runs   with   task-switching
inhibited - i.e. interrupts are on, but higher priority tasks may  not
grab  the  CPU until the Executive has finished its Request.  When the
Executive finishes processing on the request, it  checks  whether  any
higher-priority   tasks  became  runnable  while  task  switching  was
inhibited, and if so it runs the highest-priority of these.

Also, because of the non-reentrant  architecture  of  the  PDP-8,  the
SRT-8  Executive  will  not  honor any request to switch tasks arising
from an interrupt if the interrupted task's PC was less than 100. This
is  done  to  protect location 20 in each field (the SRT-8 Executive's
entry point) from being destroyed.  User tasks should BE CAREFUL NEVER
to execute any instructions below 100 in a field.

There are 5  E.R.s  associated  with  the  Messages  and  Event  Flags
described in the last section.  They are:



          SEND      Send Message

          format:   CAL
                    SEND
                    TSKNUM
                    MESSAG

This ER sends the message located at MESSAG in the  current  field  to
the   task   whose  number  is  TSKNUM.   If  the  receiving  task  is
higher-priority than the sender, and was waiting for  a  message,  the
sender  is  temporarily suspended and the receiver runs.  In any case,
the sender is not put into any Wait state once the  message  is  sent.
As stated previously, however, if the event flag in location MESSAG is
PENDING (non-zero) meaning the message is still busy from  a  previous
SEND,  the sender will be put into Event Flag Wait on location MESSAG,
and only when the Event Flag becomes FINISHED (zero) will this SEND be
performed.

SRT-8 User's Manual                                             Page 7
Executive Requests


          WAITE     Wait on Event Flag

          format:   CAL
                    WAITE
                    EFLG

This ER checks the  status  of  location  EFLG - if  it  is  FINISHED,
control returns to the caller.  If it is PENDING, its state is changed
to WAITING and the calling task is put into  Event  Flag  Wait.   When
location  EFLG  is  POSTed  by  another task or interrupt routine, the
calling task becomes runnable again.



          SENDW     Send and wait

          format:   CAL
                    SENDW
                    TSKNUM
                    MESSAG

This ER is exactly equivalent to the sequence:

                    CAL
                    SEND      /Send the message
                    TSKNUM
                    MESSAG
                    CAL
                    WAITE     /Wait for receiver to acknowledge
                    MESSAG

SRT-8 User's Manual                                             Page 8
Executive Requests


          RECEIVE   Receive message

          format:   TAD RESTRICTION     /Only if we want to restrict
                    CAL                 /sending tasks
                    RECEIVE
             MADDR, 0         /Message address stored here
                              /CDF to message field in AC
                              /on return

If the AC is zero when the RECEIVE ER  is  issued,  RECEIVE  works  as
follows:

If there are messages in the calling task's Input Message  Queue,  the
first  (i.e.  highest-priority) message is dequeued and the address of
its first data word is placed in MADDR.  A CDF to  the  field  of  the
message  is  put  in  the  AC.  If there were no messages, the task is
placed in Message Wait until such time as there are any.  There is  no
ER  which  allows  a task to check for messages without being put into
Message Wait if there are none, but  a  task  may  examine  its  Input
Message Queue Header in field 0 to find this out.

If the AC is non-zero when the  RECEIVE  ER  is  issued,  the  calling
task's  Input  Message  Queue is searched for a message whose sender's
Task Number matches the contents of the AC.   If  such  a  message  is
found,  it  is  removed from the queue as specified above;  if none is
found the issuing task is placed in Message Wait.



          POST      Post Event Flag

          format:   TAD EFPTR   /Pointer to Event Flag
                    CAL
                    POST
          EFCDF,    CDF EFFLD   /Field of Event Flag

The Event Flag pointed to by the AC at the CAL, in the field specified
by  EFCDF, is set to the FINISHED (zero) state.  If its previous state
was WAITING, the task which was waiting on it is cleared of its  Event
Flag  Wait.   This ER never puts the calling task in a Wait state, but
if the task waiting for the Event Flag is higher priority the  calling
task is temporarily suspended while that one is run.



SRT-8 User's Manual                                             Page 9
Executive Requests


                               Example



This example illustrates the SRT-8 E.R.s  dealing  with  messages  and
Event  Flags.   Since  we  have not discussed I/O and interrupts under
SRT-8 yet, this example is trivial;  i.e. there are no  advantages  to
keeping  the  functions  of  our  two  tasks  separate,  and the whole
send/receive structure is being used as an elaborate subroutine call.

              TASK A                          TASK B

LOOP, CAL                          LOOP,  CAL
      SEND      /Send B a message   (4)   RECEIV       /get a message
 (1)  B                            MADDR, 0
      MES1                                DCA EFCDF    /Save CDF for POST
      CAL                                 TAD EFCDF
 (2)  SEND      /and another              DCA .+1      /Put CDF inline
      B                                   HLT          /CDF to message field
      MES2                          (5)   TAD I MADDR  /Get 1st data word of message
      CAL                                 CLA          /I said this was
 (3)  WAITE     /Wait for first one                    /A trivial example!
      MES1                                STA CLL RTL  /-3 in AC
      JMP LOOP  /loop                     TAD MADDR    /AC points to message
                                          CAL          /event-flag
MES1, ZBLOCK 3                            POST
      15                           EFCDF, HLT          /CDF to message field here
      37                                  JMP LOOP     /loop
      23
      TEXT      /HIKE!/

MES2, ZBLOCK 3
      -1
       4

The flow of execution in this example depends  on  which  of  the  two
tasks  is higher priority.  Assuming that at some point in time both A
and B both become runnable, if task A is higher priority the  sequence
of execution is:

     1, 2, 3, 4, 5, 1, 2, 4 (2 cannot  be  executed  because  MES2  is
     still PENDING), 5, 2, 3, 4, 5, 1, 2, 4, 5, 2, 3, 4, 5, etc.

If task B is higher priority the sequence is:

     4, 1, 5, 4, 2, 5, 4, 3, 1, 5, 4, 2, 5, 4, 3, etc.

SRT-8 User's Manual                                            Page 10
Executive Requests


          Inter-task control through Task Flags Table entry


A task's Task Flags Table entry is used by SRT-8 to determine  if  the
task  can  run.   A  zero  Task Flags Table entry indicates a runnable
task.  Each bit which is on in a non-zero word indicates a reason  why
the task cannot run.  The currently defined bits and their meaning, if
set, are:

          DNEWT     Does Not Exist Wait - This Task cannot run because
                    it is non-existent.

          MSGWT     Message Wait - this task is waiting for someone to
                    send it a message.

          EFWT      Event Flag Wait - this task is  waiting  for  some
                    Event   Flag   (which  contains  a  WAITING  value
                    corresponding to this Task) to be posted.

          SWPWT     Swap Wait - This Task cannot run because it is not
                    in  core  -  this bit is reserved for future SRT-8
                    releases.

          RUNWT     Run Wait - this task is waiting for a RUN ER to be
                    executed  with  its  number  in the AC, or for the
                    operator to type "REQUEST  task"  to  the  Monitor
                    Console Routine.

          EORMWT    Event or Message Wait - this task is  waiting  for
                    an  Event  Flag  to be set or a message to arrive,
                    whichever comes first.

          ENABWT    Enable Wait - this task is waiting to be  Enabled.
                    Use  of  this  bit  is  restricted  to the Monitor
                    Console Routine for use by the "ENABLE  task"  and
                    "DISABLE task" commands.

          USERWT    User Wait -  this  bit  is  reserved  for  use  by
                    user-written tasks.  SRT-8 will not touch this bit
                    at all.

SRT-8 User's Manual                                            Page 11
Executive Requests


Several ER'S exist which allow a task to explicitly set and clear wait
bits  in  other  task's Task Flags Table entry, and to set bits in its
own.


    BLKARG - Block task for specified reason:

                    Format: TAD TASKNUM         /OR 0 IF MYSELF
                    CAL
                    BLKARG
                    WAITBITS

Where TASKNUM contains the number of  the  task  to  be  blocked,  and
WAITBITS  specifies  one or more bits to be set on in that task's Task
Flags word.  Assuming  WAITBITS  is  non-zero,  this  will  cause  the
specified  task  to  become  non-runnable.   If TASKNUM contains 0 the
issuing task  will  be  blocked  on  the  specified  wait  bits.   The
TASKNUM=0 form of this ER is the only legal way to specify the issuing
task as the task to be blocked;  if TASKNUM is equal  to  the  issuing
task number the action of this ER is undefined.



    UNBARG - Unblock task for specified reason

          Format:   TAD TASKNUM
                    CAL
                    UNBARG
                    WAITBITS

Where TASKNUM contains the number of the task to unblock, and WAITBITS
specifies  one  or  more  bits to be cleared in that task's Task Flags
word.  If the Task Flags  word  becomes  zero  as  a  result  of  this
operation, the specified task becomes runnable;  if the specified task
is of higher priority than the issuing task and becomes runnable,  the
issuing task is temporarily suspended while that task runs.

This ER is a no-op if issued with TASKNUM equal to the issuing  task's
number.

SRT-8 User's Manual                                            Page 12
Executive Requests


    SUSPND - Suspend a task's execution

          Format:   TAD TASKNUM         /0 IF MYSELF
                    CAL
                    SUSPND

This E.R. is identical in action to the following:

                    TAD TASKNUM
                    CAL
                    BLKARG
                    RUNWT



    RUN - Run a task

Format:             TAD TASKNUM
                    CAL
                    RUN

          This E.R. is identical in action to the following:

                    TAD TASKNUM
                    CAL
                    UNBARG
                    RUNWT

The SUSPND and RUN E.R.s exist because  their  function  is  performed
sufficiently  often to warrant a shorthand version.  An example of how
they could be used is:

SRT-8 User's Manual                                            Page 13
Executive Requests


A data collection task would like to print a report  every  1000  data
points without interrupting the data collection/reduction process.

        DATA task                           REPORT task

LOOP,   TAD (1750   /1000 DECIMAL     LOOP, CAL        /AC=0, SUSPEND
        DCA COUNT                           SUSPND     /ME UNTIL NEEDED
DATALP, CAL                                 JMS TITLE  /I'VE BEEN RUN
        WAITE                               .
        DATAEF                              .          /PRINT REPORT
        .           /GET A DATA POINT       .          /WITH TITLE.
        ISZ COUNT   /AND PROCESS IT.        .
        JMP DATALP  /COUNT OFF 1000         .
        TAD (REPORT /POINTS
        CAL         /RUN REPORT TASK        JMP LOOP   /REPORT OVER-
        RUN                                            /GO BACK AND
        JMP LOOP    /KEEP COLLECTING                   /WAIT.
COUNT,  0

Of course, to eliminate interference with the data collection,  REPORT
should be a lower-priority task than DATA.


There is one task control ER which does not cause any wait bits to get
set  or  cleared,  but which derails the execution of a specified task
into a subroutine:

     DERAIL - Derail a task's execution

          Format:   TAD TASKNUM
                    CAL
                    DERAIL
                    ADDR

This ER causes a "JMS ADDR" to be simulated for the task whose  number
is  contained  in TASKNUM.  ADDR is assumed to be in the same field in
which the specified task is executing.  The specified task's PC  (from
its Task State Table entry) is stored in ADDR, and the PC entry in its
Task State Table entry is then set to ADDR+1. Two important things  to
note about the operation of the DERAIL ER:

     a.  The specified task's AC, LINK, and Data Field setting are not
         saved  by  the  DERAIL  ER - therefore they must be saved and
         restored by the derail subroutine.  In this sense,  a  derail
         subroutine is very much like an interrupt at the task level.

     b.  The contents of the specified tasks Task Flags word  are  not
         affected  by  the  DERAIL  ER.  If the specified task was not
         runnable, the derail subroutine would not be  executed  until
         it became runnable.
SRT-8 User's Manual                                            Page 14
Executive Requests


                   Waiting for multiple Event Flags


Sometimes it is desirable to wait on a logical combination (AND or OR)
of  event  flags.   Waiting  on  the logical AND of two event flags is
quite simple;  the sequence:

                    CAL
                    WAITE
                    A         /WAIT FOR EVENT FLAG A
                    CAL
                    WAITE
                    B         /AND THEN WAIT FOR EVENT FLAG B

Waits until both A and B have been posted.

Waiting on the logical OR of several event flags  is  more  difficult,
since  there is a possible race condition beteen the various tests and
the interrupts  (or  task  executions)  which  POST  the  Event  Flags
involved.   The  key  to  waiting  for  an  OR  of several Event Flags
successfully is not to allow  any  interrupts  to  occur  between  the
testing  of the first Event Flag and the placing of the task in a wait
state if none of the flags were POSTed.

To accomplish this requires a special sequence of instructions  and  a
special  SRT-8  call  named WAITM.  WAITM is currently defined to be a
JMS I 25. It must be executed with  interrupts  off,  the  Instruction
Field  set  to  0  and the Data Field set to the current field, and it
must be followed by a word containing the blocking bit(s) to be set in
the Task Flags Table.  The action of WAITM is equivalent to the action
of the SRT-8 ER BLKARG except that  a  fast  path  through  the  SRT-8
Executive  is  taken and interrupts remain off until the blocking bits
are on in the Task Flags Table.
SRT-8 User's Manual                                            Page 15
Executive Requests


For an example of the use of WAITM, assume that a task "TASK" wants to
test two event flags A and B. If A is POSTed we want to go to location
ADONE, and if B is POSTed we want to go to location BDONE.  If neither
is  POSTed  we want to wait until one of them is.  The code to perform
this function is:

TESTAB, IOF              /INTERRUPTS OFF - DELICATE CODE!
        TAD A
        SNA CLA
        JMP ADONE        /ADONE must turn interrupts on!
        TAD (4000+TASK
        DCA A            /set A to WAITING state
        TAD B
        SNA CLA
        JMP BDONE        /BDONE must turn interrupts on!
        TAD (4000+TASK
        DCA B            /set B to WAITING state
        CIF 0
        CDF CUR
        WAITM
        EFWT             /block task on EFWT
        JMP TESTAB       /we're back - one of them is POSTed - which?

SRT-8 User's Manual                                            Page 16
Executive Requests


                         Interrupts in SRT-8



The SRT-8 executive contains code to receive  and  dismiss  interrupts
and  to  perform  interrupt-initiated  task switching, but it does not
provide room for an interrupt skip chain.  Instead, the  "skip  chain"
is literally a chain and is built up dynamically via the following ER:

          SKPINS    Insert code into skip chain

          Format:   CAL
                    SKPINS
                    MODULE

Where MODULE is the address (in the current  field)  of  an  interrupt
processing  module.   An interrupt processing module has the following
format:

                            MODULE, 0 /this word gets a pointer
                            /to the next module
          0                  /module entered here - contains
                            /CDF CIF next module field
          SKDR              /skip on device ready
          (SKP)             /(only if SKDR really means skip on
                            /device not ready)
          JMP I MODULE       /not ready - go to next module in chain
          CDF CIF CUR       /this one is mine - set DF and IF
                            correctly
          .                 /interrupt processing
          .
          .
          CIF 0
          POSTDS            /dismiss the interrupt, maybe POST
                            /an Event Flag

The SRT-8 interrupt skip chain initially consists of one such  module,
for  the  system  clock.   Whenever  a  task executes a SKPINS ER, the
interrupt chain is broken at the very  end  and  the  users  interrupt
module is inserted.  The last interrupt module points to the interrupt
dismiss routine as its "next module", so that SRT-8 will try to  avoid
superfluous  interrupts.  Notice that SKPINS always inserts at the end
of the skip chain.  This implies that the skip in the skip chain  will
be  ordered roughly by priority of the task which inserted them, since
SKPINS E.R.s in a task are  usually  executed  as  once-only  code  at
system startup time.

SRT-8 User's Manual                                            Page 17
Executive Requests


Once an interrupt module receives control  (by  having  its  I/O  skip
succeed) there are several restrictions on its execution:

     a.  The Data Field and Instruction Field are those  of  the  NEXT
         interrupt module - this must be corrected before any indirect
         addressing or jumps are performed.

     b.  An interrupt module may not issue SRT-8 E.R.s

     c.  An interrupt module should  not  compute  excessively,  since
         interrupts  are  off  - typical execution time should be < 50
         uS.  if considerably more time than this is needed, it should
         be done at the task level and not at the interrupt level.

     d.  Interrupt modules should not turn interrupts on, as the state
         of  the  interrupted  task  may  be  destroyed  by  a  second
         interrupt.

     e.  On entry to the interrupt module the AC, Link, and Data Field
         have  already  been  saved,  but  the  MQ has not.  Therefore
         interrupt modules wishing to use the MQ should save it  first
         and restore it before dismissing.

     f.  Interrupt modules should dismiss the interrupt by setting the
         Instruction  Field  to  0  and  issuing a POSTDS instruction.
         POSTDS is currently a JMP I 24. An Event Flag may  be  posted
         when  the interrupt is dismissed by setting the Data Field to
         the field of the Event Flag and placing the location  of  the
         Event  Flag  in  the  AC  prior  to  issuing the POSTDS - for
         example:

         CDF CUR       /DF = THIS FIELD
         TAD (EVFLG    /EVFLG MAY NOT BE AT LOC 0!
         CIF 0
         POSTDS        /DISMISS INTERRUPT AND POST EVFLG

SRT-8 does not currently provide a mechanism for  dynamic  removal  of
entries  from  the  interrupt skip chain.  When a disk - resident task
facility is added, dynamic removal will be implemented as well.
SRT-8 User's Manual                                            Page 18
System Generation


                Assembling and Loading Tasks for SRT-8

SRT-8 tasks are assembled with the OS/8 PAL8 assembler and the use  of
a  parameter file.  SRT-8 parameter files are all edited versions of a
master parameter file which is included in  the  distributed  sources.
All  definitions  in  the  master file which are to be supplied by the
user are left blank in the file;  i.e. a sample line in the file might
be:

PDP8E= /SET TO 1 IF PDP8E, ELSE 0

THERE SHOULD BE A  UNIQUE  PARAMETER  FILE  CREATED  FOR  EVERY  SRT-8
ENVIRONMENT,  WHERE  ENVIRONMENT  IS  A  COMBINATION  OF THE AVAILABLE
HARDWARE AND THE SET OF  TASKS  BEING  RUN.   THE  PARAMETER  FILE  IS
DIVIDED INTO 5 SECTIONS:

 A.  EXEC SPECIFICATIONS - THESE SPECIFICATIONS CONTROL  THE  ASSEMBLY
     OF  THE SRT-8 EXEC AND THEREFORE MUST BE INCLUDED.  THEY INCLUDE:
     WHETHER THE MACHINE IS A PDP-8E,  HOW  MUCH  CORE  IS  AVAILABLE,
     WHETHER  TO  SAVE/RESTORE  THE  MQ, HOW MANY TASKS IN THE SYSTEM,
     ETC.

 B.  TASK DEFINITIONS - THIS SECTION DEFINES SYMBOLIC  NAMES  FOR  THE
     VARIOUS  SYSTEM  TASKS  IN  THE  SYSTEM.  THE NAMES OF ALL SYSTEM
     TASKS WHICH ARE TO BE INCLUDED IN THE SYSTEM  SHOULD  BE  DEFINED
     HERE,  AND  ANY SYSTEM TASK WHICH IS NOT INCLUDED SHOULD HAVE THE
     LINE WHICH DEFINES IT DELETED FROM THIS  SECTION.   THE  USER  IS
     ENCOURAGED  TO  ADD SYMBOLIC DEFINITIONS OF HIS OWN TASKS TO THIS
     SECTION.

 C.  SYSTEM TASK SPECIFICATIONS -  THESE  SPECIFICATIONS  CONTROL  THE
     ASSEMBLIES  OF  VARIOUS  SYSTEM  TASKS.  THEY INCLUDE THE DESIRED
     CLOCK RATE, THE NUMBER OF FIELDS TO ALLOCATE THE OS/8, ETC.   THE
     SET OF PARAMETERS CONTROLLING A TASK ARE ALL GROUPED TOGETHER AND
     ASSEMBLED CONDITIONALLY ONLY IF THE TASK NAME IS DEFINED.

 D.  SYSTEMWIDE DEFINITIONS - THESE INCLUDE  THE  DEFINITIONS  OF  THE
     SYMBOLS  USED IN THIS DOCUMENT TO DESCRIBE THE EXECUTIVE REQUESTS
     AND TASK FLAG BITS, PLUS MANY  OTHER  USEFUL  DEFINITIONS.   THIS
     SECTION SHOULD NOT BE ALTERED BY USERS.
SRT-8 User's Manual                                            Page 19
System Generation


 E.  TASK SETUP - THIS SECTION USES FOUR SYMBOLS DEFINED IN  THE  BODY
     OF THE USER'S TASK TO SETUP THE SRT-8 TABLE ENTRIES NEEDED TO PUT
     THAT TASK IN THE SYSTEM.  THE FOUR SYMBOLS NEEDED ARE:

     TASK      DEFINED TO BE THE TASK NUMBER OF THE TASK

     CUR       DEFINED TO CONTAIN THE  FIELD  OF  THE  TASKS  STARTING
               ADDRESS IN BITS 6-8 (E.G., CUR=10)

     START     DEFINED  TO  BE  THE  TASK'S  STARTING   ADDRESS   (NOT
               NECESSARILY THE LOWEST ADDRESS IN THE TASK)

     INIWT     DEFINES THE INITIAL WAIT BITS IN THE TASK FLAGS TABLE -
               INIWT=0  MEANS  THE  TASK  IS  RUNNABLE WHEN THE SYSTEM
               STARTS UP.

     UP  TO  THREE  TASKS  MAY  BE  DEFINED  IN  ONE  ASSEMBLY  -  THE
     CORRESPONDING  SYMBOLS  FOR  THE OTHER TASKS ARE TASK2 AND TASK3,
     CUR2 AND CUR3, ETC.  THE TASK SETUP SECTION PLACES ITS DATA  INTO
     THE  SRT-8  TABLES BY ORIGINING INTO THEM - NO EXECUTABLE CODE IS
     GENERATED.

TO CREATE A REAL-TIME SYSTEM USING SRT-8, FIRST LAYOUT THE  TASKS  YOU
WILL  NEED ON PAPER.  THEN CREATE A PARAMETER FILE WITH THE PARAMETERS
FOR THAT SYSTEM, AND ALLOCATE CORE STORAGE AMONG  THE  EXECUTIVE,  THE
SYSTEM  TASKS, AND YOUR OWN TASKS.  WRITE YOUR TASKS AND ASSEMBLE EACH
TASK PRECEDED BY THE PARAMETER FILE.  LOAD THE RESULTING BINARIES WITH
OS/8  ABSLDR,  PLACING  THE SRT-8 BINARY FIRST.  AT THIS POINT YOU MAY
START YOUR SYSTEM, OR SAVE IT AS CORE IMAGE FILE TO BE RUN LATER.

AN SRT-8 SYSTEM CREATED AS ABOVE HAS A STARTING ADDRESS OF  00200.  IF
SRT-8  WAS  NOT  SPECIFICALLY  CONFIGURED  FOR  A PDP 8/E IT WILL HALT
INITIALLY SO THAT THE OPERATOR  MAY  CLEAR  ANY  STRAY  DEVICE  FLAGS.
PRESS  START  TO  RESUME  OPERATION  ON A PDP 8, 8/I OR 8/L; PRESS I/O
PRESET FOLLOWED BY CONTINUE ON A PDP-12.

SRT-8 User's Manual                                            Page 20
SYSTEM TASKS


                          SRT-8 SYSTEM TASKS


THE SOURCES OF THE SYSTEM TASKS ARE SUPPLIED WITH  THE  SRT-8  SYSTEM.
THE  TASKS  REFERRED  TO AS "HANDLERS" ARE COMPLETELY MESSAGE-DRIVEN -
I.E. WHEN IDLE THEY ARE IN THE MESSAGE WAIT STATE.  OTHER  TASKS  SEND
THESE  HANDLERS  I/O  request messages, and when the handler completes
the I/O operation it sets the Event Flag associated with  the  request
message and issues another RECEIVE ER.

     1.  Clock Handler

         This task can be assembled to handle  any  of  four  hardware
         clocks  (DK8EA,  DK8EC, DK8EP, KW12). It accepts requests (in
         the form of  SRT-8  messages)  to  perform  actions  after  a
         specified  time  has  elapsed.   The  clock  handler  uses an
         interval queue whose length is fixed at assembly time to keep
         track of its pending requests.

         The format of a clock message is:

         CLKMSG,  ZBLOCK 3        /3 WORDS RESERVED FOR SRT-8
                  COMMAND+TASKNO  /TASKNO=0 MEANS TASKNO=SENDING TASK
                  TIMEHI
                  TIMELO
                  EXTRA1
                  EXTRA2

         The words TIMEHI and TIMELO specify a time interval from  the
         present  time  in  terms of "system ticks". The duration of a
         "system tick" is specified by the user in the SRT-8 parameter
         file  via  the  parameter  SHERTZ.  The hardware tick rate is
         specified by the parameter HERTZ.  HERTZ  must  be  an  exact
         multiple  of  SHETRZ.   For  example,  the  parameters  for a
         line-frequency clock might be:

                  DECIMAL
                  HERTZ=  60
                  SHERTZ= 10

         indicating that only 1/10 second resolution is  necessary  in
         the clock handler.

         The clock handler is referred to by other SRT-8 system  tasks
         via  the  symbol CLOCK.  This symbol should be defined in the
         SRT-8 parameter file to be equal to the clock handler's  Task
         Number.   It should be undefined if no clock handler is to be
         included in the system.

SRT-8 User's Manual                                            Page 21
SYSTEM TASKS


         COMMAND  is  the  type  of  request  and  has  the  following
         meanings:

     0000 - POST the event flag CLKMSG after  the  specified  interval
            elapses.  TASKNO,EXTRA1 and EXTRA2 are ignored.

     1000 - Execute a RUN ER on the task specified by TASKNO after the
            specified  interval  elapses.   POST  CLKMSG  immediately.
            EXTRA1 and EXTRA2 are ignored.

     2000 - DERAIL the task specified  by  TASKNO  into  a  subroutine
            whose  address  is specified in EXTRA1 after the specified
            interval elapses.  POST  CLKMSG  immediately.   EXTRA2  is
            ignored.

     3000 - Execute a RUN ER on the task specified by TASKNO after the
            specified interval elapses, and re-queue this command with
            the parameters EXTRA1 and EXTRA2 in place  of  TIMEHI  and
            TIMELO.  This has the effect of running the specified task
            periodically with a period specified by EXTRA1 and EXTRA2.
            POST CLKMSG immediately.

     4000 - Delete from the clock queue  all  requests  for  the  task
            specified  by  TASKNO.  TIMEHI, TIMELO, EXTRA1, and EXTRA2
            are ignored.  POST CLKMSG.


         The clock handler also maintains the current time-of-day  (in
         system  ticks  until midnight) in locations TODH (high-order)
         and TODL  (low-order)  in  Page  0  of  Field  0.  When  this
         time-of-day  reaches  zero  (i.e. at midnight) it is reset to
         the quantity SHERTZ*86400 (24 hours until  midnight)  and  an
         OS/8-format  date  word in location DATE in Page 0 of Field 0
         is incremented by one day.

         Note that in  order  for  the  quantity  SHERTZ*86400  to  be
         contained in 24 bits, SHERTZ must be less than 192.

SRT-8 User's Manual                                            Page 22
SYSTEM TASKS


                   Examples of clock handler calls:



1)       CAL            /With a 50Hz system tick rate,
         SENDW          /this causes the current task
         CLOCK          /to "go to sleep" for 2 seconds.
         SLEEPM
         .
         .
SLEEPM,  ZBLOCK 3       /SRT-8 message overhead
         0              /Set event flag after interval
         0;144          /Interval is 100 (decimal) system ticks

Note that by changing the 144 to the assembler expression 2^SHERTZ the
above sequence becomes configuration-independent.


2)       CAL            /Run the task REPORT once
         SEND           /every hour, indefinitely,
         CLOCK          /assuming a 50Hz system tick rate
         RUNMSG
         .
         .
RUNMSG,  ZBLOCK 3       /SRT-8 message overhead
         3000+REPORT    /Run REPORT after specified interval and
                        /periodically thereafter.
         0;1            /First run is almost immediately (1/50 second)
         53;7440        /Period between runs is 180000 (decimal)
                        /system ticks = 3600 seconds = 1 hour.

SRT-8 User's Manual                                            Page 23
SYSTEM TASKS


     2.                 Teletype Handler

         The SRT-8 Teletype  handler  handles  a  single  Teletype  in
         either  line  or  character  mode.   Input  in  line  mode is
         terminated by a carriage return or an ALTMODE character,  and
         may  be edited with the RUBOUT and ^U characters.  The RUBOUT
         character deletes the last valid character typed and prints a
         backslash;   the  ^U  character  deletes  the entire line and
         returns the carriage.  Character mode input is not echoed and
         is terminated by overflow of a specified character count.  If
         multiple Teletypes are to be handled, multiple copies of this
         Teletype  handler  must be assembled.  Assembly parameters in
         the body of  the  handler  specify  which  device  codes  the
         handler  should use to access its Teletype and if the handler
         is to be a "console" Teletype handler (the  console  Teletype
         handler  invokes  the  MCR  whenever  a  ^C  is  typed on the
         keyboard;  non-console Teletype  handlers  treat  ^C  as  any
         other  character).  The parmeters edited into the distributed
         version of the Teletype handler assemble  it  to  handle  the
         PDP-8 console Teletype as a "console" device.

         A message to the Teletype handler performs a (possibly  null)
         output operation followed (optionally) by an input operation.
         The format of messages to the Teletype handler is:


          TTYMSG, ZBLOCK 3
                  PACK+CRLF+IND+LINE+ASSIGN+LENGTH
                  INBUF
                  OUTTXT
SRT-8 User's Manual                                            Page 24
SYSTEM TASKS


                  where

          PACK    =0    if output text is in packed ASCII format.
                  =4000 if output text is in unpacked ASCII
                        (one character per word, zero word terminates)
          CRLF    =0    if output message  should  be  followed  by  a
                        carriage return/line feed.
                  =2000 if it should not.
          IND     =0    if OUTTXT is the first word of the output text
                  =1000 if OUTTXT points to  the  first  word  of  the
                        output text
          LINE    =0    if  input  is  in  line  mode  (terminated  by
                        carriage return or ALTMODE)
                  =400  if input  is  in  character  mode  (terminated
                        after  "LENGTH"  input  characters  have  been
                        read)
          ASSIGN  =0    for normal I/O operations.
                  =200  "Assigns" the Teletype  handler  to  the  task
                        specified  by  the  LENGTH  field.   This will
                        cause the  Teletype  handler  to  only  accept
                        messages  from the specified task.  If another
                        task tries to SEND a message to  the  Teletype
                        handler while it is assigned, the message will
                        be placed in the  Teletype  handler's  Message
                        Input  Queue  but  will  not  be  removed  for
                        processing by the Teletype handler  until  the
                        assignment is released.  The task to which the
                        Teletype handler is assigned can  release  the
                        assignment  by  sending a mesage assigning the
                        teletype handler to  task  number  0.  No  I/O
                        operation   is   performed  by  an  assignment
                        message.
          LENGTH        is a  seven  bit  field  which  specifies  the
                        maximum  size  of the input buffer if input is
                        in line mode,  the  number  of  characters  to
                        input  if  input  is  in character mode, and a
                        task number if the  ASSIGN  bit  is  set.   If
                        input  is  in line mode and there are LENGTH-1
                        characters in  the  input  buffer,  characters
                        other  than  carriage  return, ALTMODE, RUBOUT
                        and ^U will not be accepted or echoed.
          INBUF         is a pointer to the input buffer -  if  it  is
                        zero,  no input is taken.  The input buffer is
                        filled with input characters  packed  one  per
                        word  with the parity bit forced on.  If input
                        is in line mode, the  last  character  of  the
                        line is followed by a zero word (if a carriage
                        return terminated the line) or a negative word
                        (if an ALTMODE character terminated the line).
          OUTTXT        is either the first word of  the  output  text
                        string  (if  IND=0)  or a pointer to the first
                        word of the output string (if IND=1000).
SRT-8 User's Manual                                            Page 25
SYSTEM TASKS


                              Examples:

          HIYA,   ZBLOCK  3     /SRT-8 Message overhead
                  0             /Packed text, end with CR/LF
                  0             /No input
                  TEXT /HELLO/  /Text to be output

          Sending the above message to  the  Teletype  handler  prints
          "HELLO" on the Teletype.

          QUEST,  ZBLOCK  3     /SRT-8 Message overhead
                  2060          /Packed text, no CR/LF,
                                /48 character input limit.
                  ANSWER        /Pointer to input buffer
                  TEXT /TYPE THE ANSWER:/

          Sending the above message to  the  Teletype  handler  prints
          "TYPE  THE  ANSWER:"  on  the  Teletype  and  inputs a reply
          without first returning the carriage.  The  answer  obtained
          from  the  above message could be printed on the teletype by
          sending the following message:

          TYPANS, ZBLOCK  3     /The usual overhead
                  5000          /Unpacked text, indirect, with CR/LF
                  0             /No input
                  ANSWER        /Pointer to output text





      3.                  Line Printer Handler

          The SRT-8 line printer handler outputs to an  LE8,  LS8E  or
          LV8  line  printer.   The  format  of  messages  to the line
          printer handler is identical to the format  of  messages  to
          the  Teletype  handler,  but the INBUF word and the LINE bit
          are ignored (the INBUF word must, however, be present).

SRT-8 User's Manual                                            Page 26
SYSTEM TASKS


      4.          Mass storage handlers

          This group of handlers all accept the same  request  message
          format  to  read  or  write  blocks  on various mass storage
          devices.  Handlers have been written for TC08 Dectape,  DF32
          and  RF08  fixed-head  disks,  and  RK8 and RK8E moving-head
          disks.

          The format of messages to mass storage handlers is:

          MSMESG, ZBLOCK 3
                  UNIT
                  RW + PAGES + FIELD
                  BUFADD
                  BLOKNO
                  STATUS

                  where

          UNIT    is the number of the unit on which the operation  is
                  to be performed.
                  DF32 and RF08 disks consist of only one unit.
                  TC08 Dectape has  units  0-7  corresponding  to  its
                  physical units 0-7.
                  RK8 disk has units 0-3 corresponding to its physical
                  units 0-3.
                  RK8/E disk has unit 0-7. Units 0-3 correspond to the
                  outer  (lower  track  number) half of physical units
                  0-3, and units 4-7 correspond to the  inner  (higher
                  track number) half of physical units 0-3.

          RW      is  0  for  a  read  operation,  4000  for  a  write
                  operation.

          PAGES   specifies  the  number  of  (128  word)   pages   to
                  transfer,  times 100(8). I.e, if PAGES=2000 it means
                  transfer 20(8) pages or  2048  words.   If  PAGES=0,
                  40(8) pages or 4096 words will be transferred.

          FIELD   if the PDP-8  field  in  which  the  transfer  takes
                  place,  times  10(8). I.e., if FIELD=30 the transfer
                  will take place in field 3.

          BUFADD  is  the  starting  address  of  the  buffer  to   be
                  transferred.
SRT-8 User's Manual                                            Page 27
SYSTEM TASKS


          BLOKNO  is the block number on the  device  from  which  the
                  transfer  will  begin.   All  devices are assumed to
                  have 256 word blocks.  On  Dectape,  the  first  128
                  words  of  each  of  an  even/odd  pair  of 129 word
                  Dectape records are considered to be a block.

          STATUS  is a word which is set by the handler on  completion
                  of  the  operation.   It  will contain a zero if the
                  operation was successful, otherwise it will  contain
                  a  non-zero  quantity  which  is  the  device status
                  register.  Tasks which use the mass storage handlers
                  should  test  this  word after the I/O operation has
                  been completed (i.e. after the Event Flag  has  been
                  posted)  to  determine if any errors occurred during
                  the transfer.  All SRT-8 mass storage handlers retry
                  operations  three  times  if  errors are encountered
                  before setting the STATUS word non-zero.


          Note that the middle three words of a message to  the  SRT-8
          mass  storage  handlers are identical to the arguments to an
          OS/8 handler which perform the same operation.


                               Example:

                  CAL
                  SENDW
                  DTA         /Send a message to the Dectape handler
                  DTAMSG      /and wait for completion.
                  TAD STATUS  /Check the status of the operation.
                  SZA CLA
                  JMP         ERR /Bad - go to error routine.

          DTAMSG, ZBLOCK      3 /SRT-8 message overhead
                  4           /Dectape unit 4
                  4210        /Write 256 words from field 1,
                  BUFFER      /location BUFFER,
                  55          /into block 55 (records 132 & 133).
          STATUS, 0           /Status of operation stored here.

SRT-8 User's Manual                                            Page 28
SYSTEM TASKS


      5.          OS/8 File Support Task

          The OS/8 File Support Task (hereafter referred to  as  OS8F)
          allows  other  tasks  to lookup, create, and delete files in
          OS/8 directories.  It is included in the same source file as
          the OS/8 Support Task, but may be assembled independently of
          that task (depending on which  tasks  were  defined  in  the
          system parameter file). The format of messages to OS8F is:

          OSFMSG, ZBLOCK 3    /SRT-8 OVERHEAD
                  DEVHND10+UNIT+FUNCT
                  FILPTR
                  STATUS
                  BLOKNO
                  LENGTH

                              where

          DEVHND          Is the task number of the  handler  for  the
                          desired device.
          UNIT            Is the unit number on which the operation is
                          to be performed.
          FILPTR          Is a pointer to a four-word  filename.   The
                          PAL8  pseudo-op  FILENAME  may  be  used  to
                          generate these filenames.
          FUNCT           represents the function to be performed.  It
                          may have the following values:

                  0       Look up the specified file name  and  return
                          its  starting blovk number in BLOKNO and its
                          (positive) length in LENGTH.
                  2000    Enter the specified file name into the first
                          empty  space  on  the  device  whose  length
                          exceeds the value  in  LENGTH.   Return  the
                          starting  block  number  of  the new file in
                          BLOKNO.   If  a  file  of  the   same   name
                          previously  existed  on  the  device  it  is
                          deleted.  The value of LENGTH is unchanged.
                  4000    Delete the specified file name.
SRT-8 User's Manual                                            Page 29
SYSTEM TASKS


          STATUS  Describes the final status of the operation:

                  0       Means operation successful.
                  1       Means file not found on Lookup or Delete.
                  2       Means no room for file on Enter.
                  >2      Means I/O error occurred - value is hardware
                          error status of device.
                  -1      Means invalid directory on device.

          If both OS8F and the OS/8 Support  Task  are  present  in  a
          system,  an  interlock  is  set  up  to prevent simultaneous
          updating of directory blocks by both systems.  Because  OS/8
          tends  to leave directory blocks in core for long periods of
          time, this interlock scheme is very restrictive.   Before  a
          Delete  or  Enter  operation  is performed, OS8F waits until
          OS/8 is in a state in which:
          a)      There is no active temporary file on the OS/8
                  device corresponding to DEVHND and UNIT.
          b)      OS/8 has just loaded the Keyboard Monitor,
                  Command Decoder, or USR into core.

          Lookup operations are not  interlocked  since  they  do  not
          modify the directory.
SRT-8 User's Manual                                            Page 30
SYSTEM TASKS


      6.          Power Fail Task


          The Power Fail Task provides  the  mechanism  by  which  the
          system    recovers    from    power    failure.     If   the
          power-fail/auto-restart option is present and if the  system
          parameter  PWRFAL  was  equated to a non-zero value, the SPL
          (Skip on Power Low) instruction is included in the interrupt
          skip  chain.  If a power low condition occurs, the processor
          state is saved and the  processor  is  halted.   When  power
          comes  back,  the  processor  state is restored and an Event
          Flag is POSTed which wakes up  the  Power  Fail  Task.   The
          Power  Fail  Task  restores  the clock, console Teletype and
          OS/8 Teletype if they  are  present  and  also  performs  an
          action  for each task in the system based on the contents of
          an internal table.  Each task has a one word entry  in  this
          table, which contains:

          0       If nothing should be done  for  this  task  (default
                  value)
          -1      If the EFWT (Event Flag Wait) bit should be  cleared
                  in  the  Task  Flags Table entry for this task (i.e.
                  this task should be taken out of Event Flag Wait)
          ADDR    If the task should be DERAILed to location  ADDR  in
                  addition to having its EFWT bit cleared.

          Each task in the system may alter its  entry  in  the  Power
          Fail  Task's  table  by  sending a message to the Power Fail
          Task.  The format of the message is:

          PWRMSG, ZBLOCK 3 /SRT-8 OVERHEAD
                  WORD

          where WORD is the new contents  of  the  Power  Fail  Task's
          table entry for the sending task.

SRT-8 User's Manual                                            Page 31
SYSTEM TASKS


      7.          OS/8 Support Task

          This task supports  the  execution  of  the  OS/8  operating
          system as a task under SRT-8. OS/8 is run in the top two (or
          more) memory fields under control of the KT8/E or TSS-8 time
          sharing   hardware   option.    The  OS/8  Support  task  is
          configured  at  system   startup   time   to   establish   a
          correspondence between OS/8 devices and SRT-8 handler tasks.
          Teletype input and output  from  OS/8  is  ring-buffered  by
          several  characters to minimize input loss due to usurpation
          of the CPU by higher-priority tasks.  Because of  the  large
          number  of  trapped  CDF instructions in OS/8 and its CUSPS,
          response time is slower than a stand-alone OS/8  system  but
          still quite reasonable.

          Several parameters in the system parameter file control  the
          assembly of the OS/8 support task.  They are:

          OSFLDS  Should be defined to be the number of fields  to  be
                  dedicated to OS/8. OSFLDS=2 specifies 8K for OS/8.

          OSKBDV  Should be set equal to the keyboard IOT code of  the
                  OS/8  Teletype  (OS/8  requires  its  own  dedicated
                  Teletype).
                  Example:  OSKBDV=03 will use  the  console  Teletype
                  keyboard for OS/8.

          OSTTDV  Should be set equal to the teleprinter IOT  code  of
                  the OS/8 Teletype.
                  Example:    OSTTDV=04   would   use   the    console
                  teleprinter for OS/8.

          OSNULL  specifies how many null  characters  must  follow  a
                  line-feed  character  on  the  OS/8  teletype.  This
                  allows high-speed VT05 terminals to be used as  OS/8
                  Teletypes.  For standard Teletypes and parallel LA30
                  terminals this parameter should be set to zero.

          OSSYSD  should be equated to the task  number  of  the  OS/8
                  system device handler.
                  Example:  OSSYSD=DTA would specify DTA0 as the  OS/8
                  system device.
SRT-8 User's Manual                                            Page 32
SYSTEM TASKS


          The OS/8 system which runs under the OS/8 Support  Task  may
          run  all  OS/8  CUSPs  except BUILD and FRTS, the Fortran IV
          run-time  system.   All  references  to  the  keyboard   and
          teleprinter  are diverted to the specified OS/8 keyboard and
          teleprinter.  References in OS/8 to the  LE8,  LS8E  or  LV8
          line printers are diverted to the SRT-8 line printer handler
          if the system parameter LPT is defined;  otherwise they  are
          executed  directly  by  the Support Task.  References to the
          following  OS/8  device  names  will  be  diverted  to   the
          corresponding SRT-8 handler if one is defined:

          DTA0-DTA7
          RKA0-RKA3
          RKB0-RKB3

          In addition, the OS/8 handlers SYS and DSK are  diverted  to
          the  handler  specified  by  the  parameter  OSSYSD.   Other
          references to I/O under the supported OS/8 system may  cause
          the OS/8 support task to hang in a loop.
SRT-8 User's Manual                                            Page 33
SYSTEM TASKS


                       Monitor Console Routine


The Monitor Console Routine (MCR) provides functions  which  the  user
can  request  from  the console Teletype in order to control, inspect,
and (to some extent) debug his system.

     The MCR indicates that it is ready to accept  input  by  printing
the  prompting character ">" on the Teletype.  An MCR command consists
of  a  command  word  (of  which  only  the  first  2  characters  are
significant)  followed  by  arguments,  and  terminated  with either a
carriage return or an altmode.   Commands  may  be  a  maximum  of  40
characters  long.   If the command is terminated by a carriage return,
the MCR will return to the Teletype for another  command  when  it  is
finished  processing  this  one;  if an altmode terminates the command
line the MCR will  put  itself  in  a  wait  state  when  it  finishes
processing  the  command - it can be brought out of this wait state by
typing ^C (Control/C) on the  console  Teletype.   When  the  MCR  has
prompted  with  its ">" and is waiting for input, no other SRT-8 tasks
can use the Teletype;  therefore if the Teletype is used for something
other  than an exclusive MCR terminal (for instance for error logging)
the operator should type ^C, type his MCR command,  and  terminate  it
with  an  altmode  character.   This  way  the MCR will not tie up the
Teletype.
SRT-8 User's Manual                                            Page 34
SYSTEM TASKS


Certain syntactic constructions are used as arguments to  several  MCR
commands;  these are defined below to avoid needless repetition:

        ,           A single comma or  a  single  space  may  be  used
                    interchangeably   to  separate  arguments  to  MCR
                    commands.

       Task-ID      A Task-ID is either a number or a name.  If it  is
                    a  number  it  represents  the internal SRT-8 Task
                    Number, which is also  the  task  priority,  of  a
                    task.   If it is a name, the first 4 characters of
                    the name are looked up  in  the  MCR'S  Task  Name
                    table to produce a Task Number.

       Time-of-day  A Time-of-day is  of  the  form  hh:mm,  where  hh
                    represents  hours  past midnight and mm represents
                    minutes past hh:00.

       Address      An Address is an octal number from 1 to  5  digits
                    in length which represents a PDP-8 memory address.
                    If the address is less than 5 digits long the high
                    order digits are assumed to be 0.

       Word         A word is an octal number from 1 to 4 digits long.


     Starting on the next page is a list of the MCR commands.  In  the
header line of the description, the significant portion of the command
word is  capitalized.   Optional  arguments  are  enclosed  in  square
brackets  ([])  and  choices  will  be  embedded  in  parentheses  and
separated by exclamation points (!). Following the header line will be
a  description  of the action which the command causes and possibly an
example.

     Commands which are starred are not present if the symbol CLOCK is
not  defined  in the SRT-8 parameter file (indicating that there is no
clock in the system).

SRT-8 User's Manual                                            Page 35
SYSTEM TASKS


1.   REquest Task-ID [,( @Time-of-day ! Interval ) [,Interval] ]

       Where "Interval" is of the form:
              nH        Meaning n hours.
              nM        Meaning n minutes.
              nS        Meaning n seconds.
              nT        Meaning n system ticks.

       Requests  a  task  to  run  immediately  (if  only  Task-ID  is
       specified),  at a given Time-of-day, or after a given Interval.
       Requesting a task clears the RUNWT bit in the Task Flags  Table
       entry  for  that  task.  If the third argument is specified the
       task is rerun periodically with the Interval given in the third
       argument  as  the  period.  If the parameter CLOCK in the SRT-8
       parameter file is not defined, the second and third argumnts of
       this  command  are  ignored  and  the  given task is always run
       immediately.

                        Examples:

              >REQUEST X
       Will run task X immediately.

              >RE FOO,@2:00
       Will run task FOO at 2:00 A.M.(if it is after 2AM, FOO will  be
       run tomorrow at 2AM).

              >RE 5,10M,5M
       Will run task number 5 10 minutes from now and every 5  minutes
       thereafter.

              >REQ HIPR,1T,6T
       On a machine with a 60 Hz clock, this command will run the task
       HIPR  immediately (well, almost immediately - .016 seconds from
       now) and 10 times per second thereafter.

       Note:  If, at the time the REQUEST command is executed,  (which
       may  be  several hours after it is typed in) the task specified
       by Task-ID does not have the RUNWT bit set in  its  Task  Flags
       Table  entry, then the REQUEST command is a no-op.  Similiarly,
       if the task had other bits set besides RUNWT it will not be run
       upon  exection of the REQUEST command, but will be run when the
       other blocking bits are cleared.


2.   STop Task-ID

       Suspends execution of the task specified by Task-ID by  turning
       the  RUNWT  bit on in the Task Flags Table entry for that task.
       A task which has been stopped may be resumed  via  the  REQUEST
       MCR command(in this instance it is easier to think of it as the
       RESUME MCR command).
SRT-8 User's Manual                                            Page 36
SYSTEM TASKS


3.   NAme Task-ID,Newname

       The character string "Newname" becomes the new name of the task
       specified  by  Task-ID.   The old name of that task (if any) is
       lost.  "Newname" may  be  any  length  but  only  the  first  4
       characters are stored.  "Newname" should not be the name of any
       other task or an error message will result.

                        Examples:

              >NAME 7 REPORT
       Task number 7 is given the name REPO.

              >NAME REPORT,FOO
       Task number 7, which is known as REPO, is now known as FOO.

       Note:  The MCR name table is initialized at  assembly  time  to
       contain the names of any DEC-SUPPLIED tasks which are listed in
       the parameter file - e.g. if the symbol CLOCK is defined in the
       parameter  file  as  CLOCK=2,  task  number 2 will get the name
       CLCK.  The MCR name table  may  be  modified  by  the  user  to
       include  his  own  task  names  permanently by editing the file
       MCR.PA after the label NMTBL.


4. * DAte [mm/dd/yyyy [,Time-of-day] ]

       The date mm/dd/yyyy, if specified,  becomes  the  system  date.
       Only the last digit of the year is significant - all others are
       ignored  and  "197"  assumed.   The  SRT-8   system   date   is
       automaticaly   bumped   at   midnight  to  the  next  day,  but
       transitions between months are not handled correctly.   If  the
       second  argument  is  specified  the  system Time-of-day is set
       equal to it.  If no arguments are specified, the current system
       date is printed on the console Teletype in the form MM/DD/197Y.


5. * TIme [Time-of-day]

       If  a  Time-of-day  is  specified,  it   becomes   the   system
       time-of-day.   If  no  argument is specified the current system
       Time-of-day is printed out on the console Teletype in the  form
       HH:MM.


6.   DIsable Task-ID

       Disables future execution of the specified task by setting  the
       ENABWT bit on in the Task Flags Table entry for that task.
SRT-8 User's Manual                                            Page 37
SYSTEM TASKS


7.   ENable Task-ID

       Clears the ENABWT bit in the Task Flags  Table  entry  for  the
       specified task, thus enabling it to run.  If the ENABWT bit was
       not set, the command is a no-op.


8. * CAncel Task-ID

       Cancels any clock queue entries involving the task specified by
       Task-ID.   This  includes  any  entries  made  by the MCR (from
       previous  timed  REQUEST  commands),  entries   involving   the
       specified  task  made  by other tasks (e.g. a timed DERAIL) and
       entries made by the specified task  involving  itself  (e.g.  a
       timed  POST). Note that in the case of the timed POST the event
       flag will not be posted  and  the  task  may  hang  up  forever
       waiting for it.


9.   SYstat [Task-ID]

       If no argument is specified, the SYSTAT command prints a system
       status  report.   Each line of the report describes an existant
       task in the system.  The data printed for  each  task  are  its
       Task  Number/priority,  its  name  (if  it  has  one), and what
       blocking bits are on in  its  Task  Flags  Table  entry.   Each
       blocking  bit  is  printed  as a one-letter code, preceded by a
       space.  The possible one letter codes and their meanings are:

              E         Waiting for event flag
              M         Waiting for a message
              O         Waiting for an event flag or a message
              R         Waiting to be REQUESTed or RUN
              S         Waiting to be swapped in (not in Phase 1)
              D         Disabled
              U         USERWT bit set

       In addition, an asterisk is printed at the end of the  line  if
       the task has any messages waiting in its input queue.

       A more detailed status report on a single task may be  obtained
       by  specifying  the  Task-ID of that task as an argument to the
       SYSTAT  command.   The  detailed  report   contains   all   the
       information  in  the  general  report,  followed  by five octal
       words:

              WORD 1    The location of the TASK State Table
                        entry containing words 2-5. This word is
                        followed by a colon.
              WORD 2    Task Link in sign bit, IF in bits 6-8,
                        DF in bits 9-11.
              WORD 3    Task PC
              WORD 4    Task AC
              WORD 5    Task MQ
SRT-8 User's Manual                                            Page 38
SYSTEM TASKS


                        Examples:

       A general SYSTAT command might  produce  the  following  sample
       output line:

       13  CARD   E *

       meaning task number 13, named "CARD", is in event flag wait and
       has input messages pending.  The command:

              >SYSTAT CARD

       might produce the single line:

       13  CARD   E *  1320: 0022  1741  0000  2525

       indicating that CARD is stopped at location 21741 with  its  AC
       and Link zero and 2525 in its MQ.

       The SYSTAT command may be left  out  of  the  MCR  assembly  by
       setting  the system parameter MCRSYS equal to zero in the SRT-8
       parameter file, saving one page of code.
SRT-8 User's Manual                                            Page 39
SYSTEM TASKS


10.  OPen Address [,Count]

       If "Count" is not specified it is  assumed  to  be  1.  "Count"
       locations  starting  at  Address  are displayed in octal on the
       console Teletype in the form:

       lllll/ cccc

       The range of locations displayed may cross a field boundary.


11.  EXamine Address, [Count]

       The EXAMINE command is identical to the OPEN command.


12.  DEposit Address,Word [,Word] [,Word]....

       The second through Nth arguments are  deposited  into  core  at
       consecutive  locations  starting at Address.  As in OPEN, field
       boundaries may be crossed.

       Example:  >DEPOSIT 26132 7700,7200,50

       Deposits 7700 into location 26132, 7200  into  location  26133,
       and 0050 into location 26134.


13.  POst Address POSTs the Event Flag at the specified address.  This
       command  is  useful  when debugging a system for simulating the
       effects of non-existant tasks or devices.


14.  EXIT

       The EXIT command causes the MCR to  terminate  SRT-8  execution
       (after  pausing  apporoximately  1  second  for  pending I/O to
       complete) and return to the OS/8  monitor  at  location  07600.
       This  command  must  be  spelled  out  completely or it will be
       regarded as an EXAMINE command.



     The MCR checks each command line for errors and, if it finds one,
issues one of the following messages and reprompts on the Teletype for
a corrected command:

     BAD CHAR       Character was not expected where it occurred
     BAD NUMBER     Number out of legal range or missing
     BAD DELIM      No space or comma where one was expected
     BAD NAME       Task name not in name table or duplicate
SRT-8 User's Manual                                            Page 40
SYSTEM TASKS


                    SRT-8 Distributed Source Files


     The SRT-8 source files included on the distribution tape are:

  FILE      TASK(S)           COMMENTS
PARAM.PA    -                 System parameter file with  all  equates
                              blank.   Should  never  be  altered, but
                              should  be  edited  to  create  specific
                              parameter files.
SRT8.PA     - (null task)     SRT-8 Executive.
MCR.PA      MCR               Monitor Console Routine
OS8SUP.PA   OS8               OS/8 Support Task
            OS8F              OS/8 File Support Task
PWRF.PA     PWRF              Power Fail Task
CLOCK.PA    CLOCK             Clock handler
TTY.PA      TTY               Teletype driver Task
LPT.PA      LPT               Line printer driver Task
DTA.PA      DTA               TC08 Dectape driver Task
RK8.PA      RK8               RK8 disk driver Task
RK8E.PA     RK8               RK8E disk driver TASK
RF08.PA     RF08/DF32         RF08/DF32 fixed-head disk driver Task
CSA.PA      CSA               Cassette driver Task
CSAF.PA     CSAF              Cassette File Support Task
UDC.PA      UDC               Universal Digital Controller handler

SRT-8 User's Manual                                            Page 41
SYSTEM TASKS


                        SRT-8 Component Sizes


The following table gives the appropriate size (or projected size)  of
each component of the SRT-8 system as of January 11, 1974:

     NTASKS = Number of tasks in system
     CLKQLN = Number of entries in clock queue
     MCRSYS = 1 if MCR SYSTAT function desired, else 0

     Any fractions from divides should be dropped.

                       Number of pages
Software Component     required (1 page = 128       Comments
                       words

----------------------------------------------------------------------

SRT-8 Executive        5 + NTASKS/18          Must  be  in   locations
                                              00200-01200.    Requires
                                              about    16    page    0
                                              locations     and     an
                                              auto-index register.

Clock handler          3 + CLKQLN/22          must be in field 0. Uses
                                              an auto-index register.

Console Teletype       2
handler

Non-Console            2
Teletype handler

Line Printer handler   1

TC08 DECtape handler   2

RK8E Disk handler      2

DF32/RF08 handler      1

RK8 Disk handler       1

SRT-8 User's Manual                                            Page 42
SYSTEM TASKS


                       Number of pages
Software Component     required (1 page = 128       Comments
                       words

----------------------------------------------------------------------

UDC handler            7-9 depending on       Uses    16    page     0
                                              locations.
                       table space desired.

Cassette handler       3

Cassette label         3                      Requires cassette
support handler                               handler.

OS/8 file              6                      Requires a mass storage
support handler                               handler.  Must run in
                                              Field 0.

OS/8 Support task      6                      Must run in  field  0  -
                                              requires   8K  for  OS/8
                                              plus   a    mass-storage
                                              handler.  Uses 12 page 0
                                              locations.

Monitor Console        5 + 3 (if clock fns    Requires "console"
Routine task           desired) + MCRSYS      teletype handler and
                       + (NTASKS+40)/64.      16 page 0 locations.

