Google
 

Trailing-Edge - PDP-10 Archives - BB-FP64A-SB_1986 - 10,7/manual/monitr.mem
Click 10,7/manual/monitr.mem to see without markup as text/plain
There are 3 other files named monitr.mem in the archive. Click here to see a list.
                           TOPS-10 TO TOPS-20




                       SYSTEM PROGRAMMER'S GUIDE




                             October, 1983




                                  NOTE

This publication was originally created for  those  customers  who  were
converting  from a TOPS-10 system to a TOPS-20 system.  The title of the
publication and the organization of material was designed to  meet  that
objective.   Customers  at  1983  Fall  DECUS  who  saw this publication
requested DIGITAL to release it to  all  TOPS-10  customers  because  it
contains  useful  information  for  those  not  converting  to  TOPS-20.
Because of the number of customer requests,  we  are  distributing  this
publication as part of the TOPS-10 customer supported tape.  There is no
commitment on DIGITAL's  part  to  upgrade  this  material  with  future
releases nor to respond to requests for enhancements or corrections.




Operating systems:

          TOPS-10, version 7.01

          TOPS-20, version 5
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 document.

The software described in this document is furnished under a license and
may only be used or copied in accordance with the terms of such license.

No responsibility is assumed for the use or reliability of  software  on
equipment that is not supplied by DIGITAL or its affiliated companies.





Copyright  (C)  1983  by  Digital  Equipment  Corporation.   All  rights
reserved.





the following are trademarks of Digital Equipment Corporation:

          DEC                      DECnet                   IAS
          DECUS                    DECsystem-10             MASSBUS
          Digital Logo             DECSYSTEM-20             PDT
          PDP                      DECwriter                RSTS
          UNIBUS                   DIBOL                    RSX
          VAX                      DecSystem                VMS
                                                            VT
                                PREFACE


AUDIENCE and OBJECTIVES

The purpose of this manual is to provide help and  information  for  the
TOPS-10  systems programmer who must learn and program for TOPS-20.  The
intended audience comprises the following groups of systems programmers:

     a.  Programmers who must convert existing TOPS-10 programs  to  run
         under TOPS-20, either in compatibility mode or native mode.

     b.  Programmers who must write TOPS-10 programs which will later be
         converted to run under TOPS-20.

     c.  Programmers who  must  write  programs  which  run  under  both
         TOPS-10 and TOPS-20.


The manual  also  provides  information  to  help  programmers  who  are
planning to take advantage of TOPS-20 extended addressing.

It is not  the  purpose  of  this  manual  to  give  complete  technical
information  about  the specific functions of either TOPS-10 or TOPS-20.
Instead, this manual provides summary information which the reader  must
supplement with the standard TOPS-10 and TOPS-20 documentation.



HOW TO USE THIS MANUAL

You may use this manual in either of two ways:

     1.  As an  introduction  to  TOPS-20  systems  programmer  for  the
         TOPS-10  programmer,  read  chapters  1 through 9 sequentially.
         Chapters 1 through 4 present general concepts, and  chapters  5
         through  9  discuss differences for specific concepts.  You may
         skip topics in chapters 5 through 9 which do not interest you.

     2.  As a reference guide for TOPS-10 to TOPS-20  conversions,  look
         up  specific  UUOs  and GETTABs in the chapters 9 and 10 of the
         manual.  For each UUO  and  GETTAB,  these  two  chapters  give
         specific  conversion  algorithms  for  conversion  to  TOPS-20.
         Also, look up specific UUO names, function code names and  flag
         names in the index to find information about them.


Although this manual is not intended for aiding in  TOPS-20  to  TOPS-10
conversions,  all  JSYS  names,  function  code  names  and  flag  names
appearing in the manual are indexed, and so you may be able to use  this
manual  in  many cases to find the UUO function corresponding to a given
JSYS functionality.

In all cases, you should have the appropriate TOPS-20 manuals  available
to provide you with complete details about specific TOPS-20 functions.
ASSOCIATED DOCUMENTS

All TOPS-10 and TOPS-20 documents are useful in  conjunction  with  this
manual.  The most useful are the following:


       o  TOPS-10 Monitor Calls (Volume 1), AA-0974D-TB

       o  TOPS-20 Monitor Calls (Volume 2), AA-K039A-TB

       o  TOPS-10/TOPS-20 USAGE File Specification, AA-4181B-TK

       o  TOPS-20 Monitor Calls User's Guide, AA-D859B-TM

       o  TOPS-20 Monitor Calls Reference Manual, AA-4166E-TM











                               CHAPTER 1

                      TOPS-20 PROGRAMMING CONCEPTS



This chapter assumes the following prerequisites:

     1.  That you are somewhat familiar with TOPS-20 command language.

     2.  That you are familiar with MACRO-10 programming, including some
         knowledge of TOPS-10 UUOs.


It presents the major  conceptual  differences  between  programming  in
MACRO-10 and MACRO-20.



1.1  USING THE JSYS

In TOPS-10, there are several opcode mnenomics for monitor calls.  These
opcode  mnemonics  are  CALLI,  CLOSE,  ENTER,  GETSTS, IN, INBUF, INIT,
INPUT, LOOKUP, MTAPE, OPEN, OUT, RELEAS, RENAME, STATO,  STATZ,  TTCALL,
UGETF,  UGEN,  USETI  and USETO.  As a group, these opcode mnemonics are
called UUOs, which stands for "Unimplemented User Opcodes."  Several  of
these opcodes provide groups of UUO functions that you usually use under
a different name.  For example, the APRENB UUO is the same as  CALLI 16.
In  fact,  most of the UUO functions use the CALLI opcode.  In addition,
the TTCALL opcode provides a group of  terminal-related  UUO  functions,
such  as  INCHWL  and  OUTSTR,  and  MTAPE  provides a group of magnetic
tape-related functions, such as MTEOF. and MTREW.

In MACRO-20, all supervisor calls are provided through the  JSYS  ("Jump
to  System")  opcode  mnemonic.   JSYS  is  similar  to CALLI in that it
provides a group of supervisor functions.  For example, the CLOSF (close
file) supervisor call is equivalent to JSYS 22.



1.2  USE OF PA1050

TOPS-10 UUOs are not recognized by the TOPS-20 operating system.  As  we
will  discuss,  there is a special program called PA1050 which simulates
TOPS-10 UUOs when running under  TOPS-20.   The  first  time  that  your
program  executes  an  instruction  that  looks  like a TOPS-10 UUO, the
TOPS-20 PROGRAMMING CONCEPTS                                    Page 1-2
USE OF PA1050                                                  16 Jan 84


PA1050 program is automatically  loaded  for  you.   For  that  and  all
subsequent  UUO  calls, PA1050 will automatically intercept the call and
simulate the function, if possible.



1.3  PROCESSES AND SUB-PROCESSES

TOPS-10 possesses the concepts of "monitor mode" and "user  mode."  When
you   log  in  to  TOPS-10,  you  are  in  monitor  mode.   The  monitor
automatically types out a "." to indicate that it  is  ready  to  accept
your  monitor  command.   When you execute a program, TOPS-10 loads that
program, and you begin to execute it.  At that point  you  are  in  user
mode, and you stay in user mode until your program terminates.

On TOPS-20, you are never in monitor mode.  You are always  executing  a
program, even just after you log in.

When you log in to TOPS-20, TOPS-20 automatically runs a system  program
called  the  TOPS-20  EXEC.   This  program is designed to appear like a
monitor-level program, but internally it is really no different from any
other program executing on TOPS-20.

When a program runs under TOPS-20, it is called a "process." The TOPS-20
EXEC  process  executes  by typing out an "@" on your terminal and waits
for you to type a command.  When you type a legal command,  the  TOPS-20
EXEC executes it.

If your command requires another program to be loaded and executed, then
something  happens  that  is unlike anything that happens under TOPS-10.
The TOPS-20 EXEC loads your program as a "sub-process." That is, you can
be  logged  in  as  a single job and have two or more separate processes
(programs) under your control at the same time.

If you are familiar with the TOPS-10 program OPSER, then you  may  think
that  sub-processes  are like programs running under OPSER.  That is not
true.  When a program is  running  under  OPSER,  it  is  running  as  a
separate job, not as part of the same job.  OPSER controls the subjob by
means of a PTY or pseudo-terminal.  You can run a subjob on a PTY  under
TOPS-20 as well, but that is not what we mean by a sub-process.

On TOPS-20, it is possible for two or more processes  (programs)  to  be
running simultaneously as part of the same job.  The controlling process
is called the "superior process," and the controlled process  is  called
the "inferior process." It is possible for a process to control a number
of inferior processes, and each inferior process  can  control  its  own
inferior sub-processes.

Process control provides you with a  great  deal  of  flexibility.   For
example,  it  is possible for a program to share all or a portion of its
memory with its  sub-process.   If  a  process  shares  memory  with  an
inferior  process,  you  can  set  up  your  memory  map  so  that it is
impossible for the sub-process to modify the shared memory, or  so  that
either process can modify the shared memory.
TOPS-20 PROGRAMMING CONCEPTS                                    Page 1-3
PROCESSES AND SUB-PROCESSES                                    16 Jan 84


Another  word  for  "process"  is  "fork."  These  two  words  are  used
interchangeably.



1.4  THE SOFTWARE INTERRUPT SYSTEM

There is a software interrupt system on both TOPS-10 and  TOPS-20.   The
system   permits  you  to  write  programs  which  intercept  errors  or
interrupts (such as  illegal  instructions  or  CTRL/C  interrupts)  and
continue executing.

Under  TOPS-20  the  software  interrupt  system  is  crucial   to   the
implementation  of  much system software because of the sub-processes we
have been discussing.  Under TOPS-20, it is possible for  a  process  to
request  interception  of  an  error  occurring  in a sub-process.  This
capability is extremely important in implementation of the TOPS-20 EXEC,
since  it  must use the software interrupt system to handle all kinds of
terminations in a program executing as a sub-process.

For example, the EXEC enables the software interrupt system so  that  it
can handle all illegal instruction executions and CTRL/C interrupts that
occur in your program.  Under TOPS-10, these interrupts would  put  your
job  back  into  monitor  mode.   Under TOPS-20, the EXEC intercepts the
interrupts and returns the job to its direct control.   (Of  course,  if
the  sub-process  itself enables the software interrupt system to handle
these interrupt conditions itself, then the EXEC will not  get  control.
This is similar to interrupt handling under TOPS-10.)

Another use of the TOPS-20 software interrupt system may  be  useful  to
you.   It  is  possible  for  a program to enable the software interrupt
system to cause an interrupt whenever any specified control character is
typed on the terminal.  For example, when the EXEC starts executing, the
software interrupt system is enabled to automatically  intercept  CTRL/T
input from your terminal.  As a result, the one-line status message that
you see comes from the EXEC, not from the TOPS-20 monitor.



1.5  JSYS INTERRUPTS

We will now discuss a difference that is  slightly  more  abstract,  the
concept  that  a  JSYS  can  be  interrupted  while  a UUO cannot.  This
difference will affect you only rarely, and then only in subtle ways.

When we say that a TOPS-10 UUO cannot be interrupted, we mean  that  any
interrupt  which  occurs  while TOPS-10 is executing a UUO is held until
execution of the UUO is completed.  For example, suppose you type CTRL/C
to  interrupt  your  program  while  TOPS-10 is executing a UUO for your
program.  Then the CTRL/C will not be honored until execution of the UUO
has  been  completed.  This delay can be significant if execution of the
UUO takes a long time, such as when a very long I/O operation occurs.
TOPS-20 PROGRAMMING CONCEPTS                                    Page 1-4
JSYS INTERRUPTS                                                16 Jan 84


On the other hand, a TOPS-20 JSYS can be interrupted.  This may  or  may
not  affect the execution of your program.  Let us look at some examples
of the CTRL/C interrupt:

     1.  Suppose you interrupt your program with CTRL/C in the middle of
         a  JSYS  execution, and you return to the TOPS-20 EXEC.  If you
         type the EXEC command CONTINUE, then your program will continue
         execution from the middle of the JSYS.  This result will always
         be the same as under TOPS-10.

     2.  Suppose you interrupt your program with CTRL/C in the middle of
         a JSYS execution, but then type the EXEC command DDT.  You will
         then enter DDT and the context of the JSYS  execution  will  be
         lost.   To continue execution of your program, you will have to
         restart execution of the JSYS.


Even the second of these cases will seldom result in  different  program
execution  under TOPS-10 and TOPS-20.  The reason is that when a TOPS-20
JSYS is  interrupted,  it  executes  "backout  code"  which  essentially
cancels  the effects of the partial execution of the JSYS.  However, the
effects of a partially executed JSYS cannot  always  be  canceled.   For
example,  unpredictable results occur when a multi-page I/O operation is
interrupted.  In this case, some of the pages have been transmitted when
the  interrupt  occurs, and some have not.  In the corresponding TOPS-10
situation, either all or none of the pages have been transmitted.

Now let us look at a different  kind  of  example.   Suppose  that  your
program  has  enabled  the  software  interrupt system, and an interrupt
occurs during execution of a UUO or JSYS.  Under TOPS-10,  the  software
interrupt  is  not  taken  until  UUO  execution  has  completed.  Under
TOPS-20, the software interrupt might be taken in the middle of the JSYS
execution.   Whether this affects execution of your program depends upon
how your interrupt handling subroutine works.

     1.  If your interrupt  handling  subroutine  sets  flags  or  makes
         decisions and then dismisses the interrupt without reference to
         where the program was executing  when  the  interrupt  occurred
         (the interrupt PC), then program execution will not be affected
         at all.

     2.  If your interrupt handling subroutine makes decisions based  on
         the  value of the interrupt PC, then execution may be affected.
         The reason is that under TOPS-10 the interrupt PC is always  in
         the  user  code, while under TOPS-20 the interrupt PC may be in
         the monitor JSYS code.  This means that your  code  that  tests
         the  value  of  the  interrupt PC must be able to recognize and
         handle a JSYS interrupt PC.

     3.  If your interrupt handling subroutine changes the interrupt  PC
         before   dismissing   the  interrupt,  then  execution  may  be
         different.  The reason is that a TOPS-20 interrupt routine  may
         be entered after a JSYS has been only partially executed, but a
         TOPS-10 interrupt routine may never be  entered  after  partial
TOPS-20 PROGRAMMING CONCEPTS                                    Page 1-5
JSYS INTERRUPTS                                                16 Jan 84


         execution of a UUO.












                               CHAPTER 2

                   USING MACRO-20, LINK-20 AND DDT-20



This chapter focuses on the differences in command language  and  source
programs for systems programmers on TOPS-10 and TOPS-20.



2.1  MACRO

The MACRO-10 and MACRO-20 programs work nearly the same way and  produce
the  same  results.   The  problems  that  arise  in converting MACRO-10
programs to MACRO-20 usually have  to  do  with  using  TOPS-20  monitor
symbols  instead  of, or in addition to, TOPS-10 monitor symbols, and in
coding sequences for JSYSs.  This section discusses those issues.



2.1.1  MACRO-20 Programs With UUOs And TOPS-10 Monitor Symbols

MACRO-20 is initialized with the same symbol table  as  MACRO-10.   This
means that the names of the UUOs are automatically defined.

As with MACRO-10, if you wish to use monitor symbols other than the  UUO
names themselves, your source program should include the statement

        SEARCH UUOSYM

Because of these conventions, a program containing UUOs should  assemble
the same, with the same results, under MACRO-10 and MACRO-20.



2.1.2  MACRO-20 Programs With JSYSs And TOPS-20 Monitor Symbols

Like MACRO-10, MACRO-20 is not initialized  with  any  JSYS  or  TOPS-20
monitor  symbol  definitions.   In  order  to  use these symbols in your
program, your source file should contain the following:

        SEARCH MONSYM
USING MACRO-20, LINK-20 AND DDT-20                              Page 2-2
MACRO                                                          16 Jan 84


This statement will  cause  MACRO  (-10  or  -20)  to  access  the  file
MONSYM.UNV.   This  file  contains  all  JSYS and TOPS-20 monitor symbol
definitions.



2.1.3  Programs Containing Both TOPS-10 And TOPS-20 Monitor Symbols

When converting from one system to another, it very often  happens  that
your program contains both TOPS-10 and TOPS-20 monitor symbols, at least
during an interim period.  And if your program is  going  to  run  under
both   operating   systems,  then  it  may  use  both  sets  of  symbols
permanently.

You may insert both of the following the statements:

          SEARCH UUOSYM
          SEARCH MONSYM

into your program so that both sets of symbols will be defined.

A problem arises because a few symbols are defined in  both  files  with
different  definitions.  An example of such a symbol is RESET, which has
the definition CALLI 0 in the TOPS-10 symbol table and JSYS 147  in  the
TOPS-20 symbol table.

If you use two or more SEARCH operations in your MACRO program, then the
first   takes   precedence.    Thus,   if   you  use  SEARCH UUOSYM  and
SEARCH MONSYM in that order, then TOPS-10 symbol definitions  will  take
precedence over TOPS-20 monitor symbols.  In that case, you would not be
able  to  use  the  TOPS-20  monitor  symbols  without   defining   them
explicitly.

There are two methods you may use to solve this problem:

     a.  For RESET to have the TOPS-20 meaning, insert

                 OPDEF  RESET [JSYS 147]

         into your program.

     b.  Use the alternate TOPS-20 symbol, RESET%, which  has  the  same
         definition  as  the  TOPS-20  RESET.   Each TOPS-20 JSYS has an
         alternate form with a "%" appended.




2.1.4  Coding Conventions For JSYSs

The coding conventions for JSYSs are described in  the  introduction  to
the  TOPS-20  Monitor Calls Reference Manual, and are not repeated here,
except to make one observation about the use of accumulators.
USING MACRO-20, LINK-20 AND DDT-20                              Page 2-3
MACRO                                                          16 Jan 84


The convention for the vast majority of UUOs, the CALLIs,  is  that  you
can  use  any accumulator as an argument block pointer.  For example, if
AC5 points to the FILOP. argument block, then the instruction

        FILOP.   AC5,

invokes the monitor call.

The conventions for TOPS-20 monitor calls are different,  however.   One
or more of accumulators 1 through 4 are always used to pass arguments or
argument block addresses.  Thus if you are currently writing a  MACRO-10
program which you plan to later to convert to MACRO-20, you should avoid
the use of accumulators 1 through 4 as much as possible.



2.2  LINK

The following LINK-10 switches are illegal in LINK-20:

          /CORE
          /CPU
          /MAXCOR
          /PLTTYP
          /RUNCOR
          /SSAVE
          /ZERO

Since these switches have no meaning when running under TOPS-20, you may
simply  delete them from your LINK command files when going from LINK-10
to LINK-20.  The only exception is /SSAVE, which you should replace with
/SAVE.

LINK-20 supports the following additional switches:

          /PVBLOCK
          /PVDATA

You should use these switches if you  wish  to  define  a  program  data
vector  (PDV)  in  your  TOPS-20  program.   The PDV is described in the
TOPS-20 Monitor Calls Reference Manual.

All other LINK switches are defined in  both  LINK-10  and  LINK-20  and
produce  the  same  results.   An exception is the rare instance where a
TOPS-10 programmer wishes to embed a version number in  an  output  file
RIB.   For  example, this permits display of a .MAP file version.  There
is no comparable feature for TOPS-20 files.

If your TOPS-20 program does not reference the JOBDAT area, then you may
wish  to  consider using the /NOINITIAL switch.  This switch removes the
JOBDAT symbols from the LINK-20 symbol table.
USING MACRO-20, LINK-20 AND DDT-20                              Page 2-4
DDT                                                            16 Jan 84


2.3  DDT

The $Y command (which takes a command file) of DDT-10 is  not  available
under DDT-20.

Other differences  between  DDT-10  and  DDT-20  have  to  do  with  the
differences  in  memory management rules.  If you open a memory location
in a non-existent page, then DDT-10  considers  the  reference  illegal,
while DDT-20 allocates the page.

You may not call DDT from a user program when running under  TOPS-20  as
you can from TOPS-10.











                               CHAPTER 3

                    THE PA1050 COMPATIBILITY PACKAGE



The PA1050 compatibility package is a program that  runs  under  TOPS-20
and   simulates  many  TOPS-10  monitor  calls  (UUOs)  in  the  TOPS-20
environment.  This permits many TOPS-10 programs to  run  under  TOPS-20
with no change.

This chapter provides general information on PA1050 and how it is  used.
For  details on the support of individual UUOs, please refer to the last
chapter of this manual.



3.1  FUNCTIONAL CAPABILITY OF PA1050

PA1050 is  supported  by  DIGITAL  only  to  a  certain  extent.   If  a
DIGITAL-supported product fails because of a bug in PA1050, then DIGITAL
will repair the problem.  Use of PA1050 with a customer program  is  not
supported by DIGITAL.

PA1050 supports all non-privileged UUOs through  TOPS-10  version  6.01.
UUOs  implemented  in  later  versions  of  TOPS-10 are not supported in
PA1050, except in rare cases where support  is  required  for  DIGITAL's
programs.



3.2  OPERATION OF PA1050

TOPS-20 recognizes a TOPS-10 monitor call by means of an opcode  in  the
range 40B8 to 100B8.  The default action taken by TOPS-20 is to initiate
simulation of the UUO.  This default action can be  prevented  by  using
the TOPS-20 EXEC command

        @SET NO UUO-SIMULATION

Use of this command disables simulation of UUOs.

If UUO simulation has not been disabled, then TOPS-20  invokes  the  UUO
simulation  routine.   If  this  is  the first UUO being executed by the
program, TOPS-20 must figure out where the UUO  simulation  routine  is.
It determines this as follows:
THE PA1050 COMPATIBILITY PACKAGE                                Page 3-2
OPERATION OF PA1050                                            16 Jan 84


     a.  The user may have specified the entry vector (starting address)
         of  his  own UUO simulation routine by means of the GCVEC JSYS.
         If so, then that routine is used.

     b.  Otherwise, TOPS-20 looks for SYS:PA1050.EXE and merges it  into
         your  address space, starting at memory location 700000.  To do
         this, TOPS-20 overwrites any user program instructions or  data
         in locations 700000 through 770000.


For the first UUO executed by your program, TOPS-20 jumps to the  second
word  in  the entry vector for PA1050.  This is an alternate entry point
that notifies PA1050 that this is the first  UUO  simulation  call,  and
PA1050  can  set  up and initialize its internal buffers and data areas.
For subsequence UUOs, TOPS-20  jumps  to  the  primary  entry  point  in
PA1050.

There is one exception.  If the UUO is a GETTAB (CALLI AC,41) and the AC
contains <112,,11> (%CNMNT), TOPS-20 returns 040000 in the AC instead of
invoking PA1050.  If this GETTAB is used before  any  other  UUOs,  your
program  can  determine the monitor type and thereby avoid further UUOs.
In this way you can write a single program that will work in native mode
for both TOPS-10 and TOPS-20.



3.3  NEW VERSION OF PA1050

A new version of PA1050 may be made available to certain sites, but only
with   product   line   approval.    This   version  of  PA1050  is  not
DIGITAL-supported at all.

The new version of  PA1050  has  the  following  enhancements  over  the
supported version:

     a.  It fully supports all options of the FILOP. UUO at the level of
         TOPS-10  version 7.01.  (This differs from the support level of
         the older version, which provides only limited FILOP. support.)

     b.  It runs in a non-zero section, leaving  the  entire  section  0
         available  to the user program.  However, it will only simulate
         UUOs issued from section 0 of the TOPS-10 user program.












                               CHAPTER 4

                           MEMORY MANAGEMENT



This chapter describes differences in the way you  manage  memory  under
TOPS-10 and TOPS-20.



4.1  ILLEGAL MEMORY REFERENCES

Under TOPS-10, your program can reference only the  memory  assigned  to
it.   Your program requests a larger memory assignment using the CORE or
PAGE. UUO.  This memory  assignment  can  be  "physical"  or  "virtual,"
depending  upon  system  and  user  parameters, and it can be limited by
system or user restrictions.

Under TOPS-10, your program  could  get  the  message  "?Illegal  memory
reference" in either of two ways:

     a.  If  your  program  attempts  to  access  an  unassigned  memory
         address.

     b.  If your program attempts to store into a read-only high segment
         page.


Under TOPS-20, an illegal memory reference is  much  more  rare  because
when  your program begins executing, it automatically receives 256K (per
section) of virtual memory.  Therefore, all addresses  are  legal.   The
first  time  that  your program references a previously unassigned page,
TOPS-20 automatically  allocates  that  page  and  assigns  it  to  your
program, so that the access will be legal.

The read-only high segment case is handled in a  different  way.   Under
TOPS-20,  there  is  no distinction between the low segment and the high
segment, and there is no distinction between  read-only  and  read-write
programs.  Instead, whether a memory reference is legal is determined on
a page-by-page basis.  Each page of  a  program  can  have  any  of  the
following access levels:

     a.  It can have read-only  access,  meaning  that  a  store  memory
         reference to that page is illegal.
MEMORY MANAGEMENT                                               Page 4-2
ILLEGAL MEMORY REFERENCES                                      16 Jan 84


     b.  It can  have  write  access,  meaning  that  any  reference  is
         permitted.

     c.  It can have copy-on-write access, meaning that when the program
         first  writes into the page, that program will be given its own
         separate copy of the page.


In  practice,  all  pages  of  all  shared  system  programs  are  given
copy-on-write access protection.  Thus each job starts out with a shared
copy of each page, but as it stores into each data  page,  that  job  is
given a private copy of the data page.  Reentrant code pages continue to
remain shared among all jobs running the program.

When running under PA1050, a TOPS-10  program  can  receive  a  form  of
illegal   memory   reference   error.    PA1050  simulates  the  TOPS-10
environment by using the software interrupt system to intercept all page
faults.  (The term "page fault" is a hardware term used to describe what
happens when a program references an unassigned page.) When a page fault
occurs,  PA1050  displays  an  error  message indicating that an invalid
address reference has occurred.



4.2  THE JOB DATA AREA

JOBDAT, the job data area, comprises addresses 40 through 137 (octal) of
the  low  segment  and the first eight words of the high segment.  Under
TOPS-10, JOBDAT contains a great deal of memory management  information,
such  as the starting address of the program and the location of the DDT
symbol table.

As a general rule, PA1050 attempts to maintain the program's JOBDAT area
exactly as TOPS-10 does.

The list below gives the following information about  each  location  in
the JOBDAT area:

     a.  Its name and use under TOPS-10

     b.  Whether it is set by LINK-20

     c.  Whether it is accessed by TOPS-20, including the  TOPS-20  EXEC
         unless otherwise specified.


In regard to whether it is  set  by  LINK-20,  keep  in  mind  that  any
location  can  be  set by LINK-20 if a MACRO program explicitly stores a
value by means of the ORG or LOC pseudo-operations.
MEMORY MANAGEMENT                                               Page 4-3
THE JOB DATA AREA                                              16 Jan 84


4.2.1  Low Segment Job Data Area

The following is a list of all low-segment job data area locations  that
TOPS-10 programs can use:

     1   .JBUUO -- Used by hardware for processing local UUOs (opcodes 0
         through 37).  Not set by LINK-20 or accessed by TOPS-20.

     2   .JB41 -- Executed to start the user-programmed operator service
         routine.  Set by LINK-20 in the same way as LINK-10.

     3   .JBERR -- System  program  error  count.   Set  by  LINK-20  to
         indicate number of errors in loading.

     4   .JBREL -- Highest physical memory  location  available  to  the
         user program.  Not set by LINK-20 or accessed by TOPS-20.

     5   .JBBLT -- Used by LINK-10.  Not used by LINK-20 or accessed  by
         TOPS-20.

     6   .JBDDT -- The start address of DDT,  if  loaded.   The  TOPS-20
         EXEC references this word to determine if DDT is loaded, and to
         obtain the DDT starting address.  If DDT  is  not  loaded,  the
         TOPS-20  EXEC  merges  DDT into your address space, starting at
         location 770000, and stores the starting address into .JBDDT.

         LINK-20 does not set .JBDDT  unless  you  load  DDT  with  your
         program.

     7   .JBHSO -- (TOPS-20 only) The page number of the  high  segment.
         This  location  is  used  for an internal monitor purpose under
         TOPS-10, and so is useful to user programs only under  TOPS-20.
         Set by LINK-20.  Not accessed by TOPS-20.

    10   .JBHRL -- High segment addresses (first free location,  highest
         legal address).  Set by LINK-20.  Not accessed by TOPS-20.

    11   .JBSYM -- Pointer to program symbol  table.   Set  by  LINK-20.
         Accessed  by  DDT-20 and FILDDT-20.  Not accessed by TOPS-20 or
         TOPS-20 EXEC.

    12   .JBUSY -- Pointer to undefined symbol table.  Set  by  LINK-20.
         Accessed  by  DDT-20 and FILDDT-20.  Not accessed by TOPS-20 or
         TOPS-20 EXEC.

    13   .JBSA -- First free low-segment address and start address.  Set
         by  LINK-20.   TOPS-20  accesses this location when it starts a
         process, if the process has a TOPS-10 style entry  vector  word
         (see description later in this chapter).

    14   .JBFF -- Address of the first free location after  the  program
         high segment.  Set by LINK-20.  Not accessed by TOPS-20.
MEMORY MANAGEMENT                                               Page 4-4
THE JOB DATA AREA                                              16 Jan 84


    15   .JBPFH -- Pointer to page fault handler.  Not set by LINK-20 or
         accessed by TOPS-20.

    16   .JBREN -- REENTER address.  Set by LINK-20 only when SIMDDT  or
         ALGDDT  is  loaded  with  your  program.   (This  is  the  same
         convention as  for  LINK-10.)  This  location  is  accessed  by
         TOPS-20  when  you  type a REENTER command if the process has a
         TOPS-10 style entry vector word (see description later in  this
         chapter).    There  is  an  implementation  difference  between
         TOPS-10 and TOPS-20 when the value in .JBREN contains 0.  under
         TOPS-10,  you will get the error message "?No start adr." Under
         TOPS-20, execution will begin at address 0 (AC 0).

    17   .JBAPR -- Address of APR trap routine.  Not set by  LINK-20  or
         accessed by TOPS-20.

    20   .JBCNI -- State of APR.  Not set  by  LINK-20  or  accessed  by
         TOPS-20.

    21   .JBTPC -- PC after user-enabled trap.  Not set  by  LINK-20  or
         accessed by TOPS-20.

    22   .JBOPC -- Last user-mode program counter.  Not set  by  LINK-20
         or accessed by TOPS-20.

    23   .JBOVL -- Address of header block for root link of  an  overlay
         structure.  Set by LINK-20.  Not accessed by TOPS-20.

    24   .JBCOR -- Core information (left half is highest address in low
         segment,   right  half  is  user-specified  argument  for  last
         executed SAVE or  GET  command).   The  left  half  is  set  by
         LINK-20.  Not accessed by TOPS-20.

    25   .JBINT -- Address of  error-intercepting  block.   Not  set  by
         LINK-20 or accessed by TOPS-20.

    26   .JBOPS -- Reserved for object-time systems.  Not set by LINK-20
         or accessed by TOPS-20.

    27   .JBCST -- Reserved  for  customers.   Not  set  by  LINK-20  or
         accessed by TOPS-20.

    30   .JBVER -- Program version number and flags.   Set  by  LINK-20.
         Accessed  by the TOPS-20 EXEC to obtain the version number when
         the  process  has  a  TOPS-10  style  entry  vector  word  (see
         description later in this chapter).

MEMORY MANAGEMENT                                               Page 4-5
THE JOB DATA AREA                                              16 Jan 84


4.2.2  High Segment Job Data Area

The high segment job data area is also  known  as  the  "Vestigial  Data
Area." It comprises the first eight words of the program high segment.

All locations in the high segment data area are set by LINK-20, but none
are accessed by TOPS-20 or the TOPS-20 EXEC.  All are updated by PA1050.



4.2.3  Deleting JOBDAT External Symbols

If your TOPS-20 program does not reference any JOBDAT symbols, then  you
may  wish  to  delete  the JOBDAT symbols from the LINK-20 symbol table.
You may do this with the /NOINITIAL switch to LINK-20.



4.3  THE ENTRY VECTOR AND THE PROGRAM DATA VECTOR (PDV)

The job data area is not normally used by native TOPS-20 programs.   The
information  stored  in the job data area by TOPS-10 programs is kept in
two control blocks, the Entry Vector and the Program Data  Vector  (PDV)
in  TOPS-20  programs.  This section describes the uses of these control
blocks.



4.3.1  The Entry Vector

The entry vector is a control block of three or more words.   The  first
three words have the following format:

          JRST start-address
          JRST reenter-address
          version number

The "start-address"  is  the  starting  address  of  the  program.   The
"reenter-address"  is  the  address  to  which  control  passes when the
REENTER command is typed to the TOPS-20 EXEC.  The "version  number"  is
the standard TOPS-10/TOPS-20 version number.

All words after the third  are  user-defined  and  should  be  JRSTs  to
alternate entry points in the program.

If you use LINK-20 to link a program containing  one  or  more  modules,
then  precisely one of those modules must contain either a start address
or an entry vector.  You specify a start address in a  MACRO-20  program
by ending the source module with

                                   END                      start-addr
MEMORY MANAGEMENT                                               Page 4-6
THE ENTRY VECTOR AND THE PROGRAM DATA VECTOR (PDV)             16 Jan 84


Alternatively, you may insert an entry vector into  your  MACRO-20  main
program by using this format:

        ...
label:  JRST    start-addr
        JRST    reenter-addr
        EXP     version number
        JRST    ...  ; optional
        ...
        END     <length,,label>

As this format illustrates, you may insert an  entry  vector  into  your
program by simply coding the appropriate JRST and version number fields.
This form of the END pseudo-operation specifies the length of the  entry
vector and its address.



4.3.2  The Entry Vector Word

The expression used as the  last  END  statement  operand  above  is  an
example  of an "entry vector word." An entry vector word is a word which
indicates whether or not an entry vector exists, and where it is.  There
are two forms of an entry vector word.

The first form is a "TOPS-20 style entry vector word." Its format is

          XWD     length,address

The "address" is the address of the entry  vector  in  memory,  and  the
"length" is the number of words in the entry vector.

The second form is a "TOPS-10 style entry vector word." Its format is:

          JRST     address

That is, the left halfword contains  254000  (since  octal  254  is  the
opcode of JRST), which is too large to be a length value.  The "address"
is the starting address of the  program.   Note  however,  as  explained
below, that this address is never used by TOPS-20.

Each TOPS-20 process has an entry vector word whose value is  stored  in
the  PSB (process state block), the TOPS-20 internal control block which
contains information about the process.  (The PSB is unavailable to  the
user  program.)  A  user program can store an entry vector word into the
PSB by means of the SEVEC JSYS.  Either style of entry vector  word  can
be stored.

LINK-20 determines the type of entry vector word to  use  from  the  REL
file  for  your  main  program.   If your main program specifies a start
address, then the corresponding entry  vector  word  is  TOPS-10  style,
while  if  it  specifies  an  entry vector, then the corresponding entry
vectory word is TOPS-20 style.
MEMORY MANAGEMENT                                               Page 4-7
THE ENTRY VECTOR AND THE PROGRAM DATA VECTOR (PDV)             16 Jan 84


When you use LINK-20 to link your program, you may produce either a core
image  or  an  EXE file.  If LINK-20 produces a core image, then it uses
the SEVEC JSYS to store the entry vector  word  into  the  PSB  for  the
process.   If  LINK-20  produces  an  EXE file, then it stores the entry
vector word into the directory page of the EXE file.

In all cases (core image or EXE file, TOPS-10  or  TOPS-20  style  entry
vector  word),  LINK-20 fills in those words of the job data area listed
earlier in this chapter.



4.3.3  When TOPS-20 Uses The Job Data Area

The form of the entry vector word determines whether  TOPS-20  uses  the
job data area.

When TOPS-20 loads an EXE file into memory, either because  of  the  GET
JSYS  or  the RUN TOPS-20 EXEC command, then it updates the entry vector
word in the PSB for the process from information in the  directory  page
of  the  EXE  file.   If  the  EXE file was created by either TOPS-20 or
LINK-20, then the directory file contains  an  entry  vector  word,  and
TOPS-20 simply copies that into the PSB.  If the EXE file was created by
TOPS-10 or LINK-10, then it contains no entry vector word,  and  TOPS-20
creates  and  stores an entry vector word of the form "JRST start-addr",
where "start-addr" is the value in .JBSA, the start address field of the
job data area.

When TOPS-20 or the  TOPS-20  EXEC  needs  the  start  address,  reenter
address, or version number of a process, then it obtains it as follows:

     a.  If the entry vector word in the PSB  has  254000  in  the  left
         half,  indicating  a  TOPS-10  style  entry  vector  word, then
         TOPS-20 or the TOPS-20 EXEC takes the information it needs from
         one of the fields .JBSA, .JBREN or .JBVER in the job data area.

     b.  Otherwise there is a  TOPS-20  style  entry  vector  word,  and
         TOPS-20 or the TOPS-20 EXEC takes the information it needs from
         the entry vector.


Notice that although it is possible for a program's starting address  to
be  stored  in  more than one place, the above rules determine precisely
which of them is used by TOPS-20.



4.3.4  The Program Data Vector

The Program Data Vector (PDV) for a program is needed  only  in  TOPS-20
programs  running  in  non-zero sections.  See the TOPS-20 Monitor Calls
Reference Manual for further information.











                               CHAPTER 5

                              INPUT/OUTPUT



This chapter summarizes the  differences  between  TOPS-10  and  TOPS-20
input/output programming.



5.1  FILE SPECIFICATIONS

For comparison purposes, here are the formats of  the  the  TOPS-10  and
TOPS-20 file specifications:

TOPS-10:  dev:[p,pn,sfd,...]name.ext<pro>

TOPS-20:  dev:<dir.subdir...>name.typ.gen;P(protection);T;A(account)

For a complete description of the meanings  of  these  fields,  see  the
TOPS-10  Commands  Manual  and  the TOPS-20 Commands Manual.  (There are
additional TOPS-20  fields  for  TAPE  and  DECNET  files).   The  major
similarities and differences are as follows:

     a.  The "dev" specifies a device name.  Unless a particular command
         description  specifies  otherwise,  the  default  is  DSK:  for
         either system.

     b.  The TOPS-10  project-programmer  number,  "[p,pn,sfd,...]",  is
         replaced by the TOPS-20 directory name, "<dir.subdir...>".

     c.  The TOPS-10 "name.ext" fields specify the file  name  and  file
         name  extension.   In  TOPS-20 file specifications, a different
         terminology is used, although the syntax  (separating  the  two
         fields  with  a  ".")  is  the same.  The corresponding TOPS-20
         fields are written as "name.typ", standing for  file  name  and
         file  type.   As  in the case of TOPS-10, you may omit these in
         the  TOPS-20  file  specification  for  non-directory  devices.
         Under  TOPS-10,  the  name  may  be  six  characters,  and  the
         extension may be three characters.  Under TOPS-20,  each  field
         may be 39 characters.

     d.  The "<pro>" field of the TOPS-10 file specification is the file
         protection code.  The TOPS-20 file protection code specified in
         the P(protection) field performs the same function,  but  under
INPUT/OUTPUT                                                    Page 5-2
FILE SPECIFICATIONS                                            16 Jan 84


         different  rules.  The differences are summarized later in this
         chapter.

     e.  The ".gen" field of the TOPS-20  specification  identifies  the
         generation  number or version number of the file.  As explained
         in the TOPS-20  User's  Guide,  you  can  have  more  than  one
         generation of the same file.

     f.  The remaining fields of  the  TOPS-20  file  specification  are
         optional  attributes, which allow you to specify (respectively)
         the fact that the file is a temporary  file,  and  the  account
         code for the file.


Under TOPS-10, a user program must parse a  file  specification.   Under
TOPS-20, parsing is performed automatically by the GTJFN JSYS, described
below.



5.2  TOPS-20 PROJECT-PROGRAMMER NUMBERS

For  compatibility,  TOPS-20  provides  a  project-programmer  for  each
directory  on  the  system.   This  permits  TOPS-10  programs with file
specification  parsers  to  run   under   TOPS-20   with   little   code
modification, or none if PA1050 is used.

You can use the TOPS-20 EXEC command TRANSLATE to provide translation in
either  direction.  This command accepts as a parameter either a TOPS-20
directory  name  or  a  project-programmer  number  and   provides   the
translation from one format to the other.  For example:

          @TRANSLATE (DIRECTORY) PS:<XENAKIS>
          PS:<XENAKIS> (IS) PS:[4,665]

or

          @TRANSLATE (DIRECTORY) PS:[4,665]
          PS:[4,665] (IS) PS:<XENAKIS>

There are two JSYSs you may use in a MACRO-20 program to  provide  these
translations.   The PPNST JSYS translates a project-programmer number to
a directory (or sub-directory) name, and the  STPPN  JSYS  performs  the
reverse translation.

All TOPS-20 project-programmer numbers are of the form [4,n], where  "n"
is the internal TOPS-20 directory number.
INPUT/OUTPUT                                                    Page 5-3
FILE ACCESS CODES                                              16 Jan 84


5.3  FILE ACCESS CODES

The TOPS-20 file protection codes provide a great deal more  flexibility
than the TOPS-10 codes.  Some differences are as follows:

     a.  TOPS-20 file access bits are selective.  For example,  you  can
         permit a user to read (or even write) a file without being able
         to get a directory listing of the file.  (This permits  you  to
         "hide"  a  file  so  that  only  certain programs can access it
         without knowing its name.) By contrast, TOPS-10 file protection
         codes  are subsets of each other.  You cannot add one privilege
         and remove another.

     b.  Directory access bits are also selective.

     c.  TOPS-10 projects are determined by the first half (the  project
         number)  of  the PPN.  TOPS-20 user groups may be set up in any
         way, with no dependency on the account code.


See the TOPS-20 User's Guide  for  complete  information  on  the  "user
group"  and  "directory  group"  concepts,  which  replace  the  TOPS-10
"project numbers."  For  full  information  on  TOPS-20  disk  file  and
directory access bits, see the TOPS-20 Monitor Calls Reference Manual.



5.4  THE JOB FILE NUMBER (JFN)

On TOPS-10, each open file is associated with a channel number from 0 to
17 (octal).  When using FILOP., there may be up to 80 channels.

Under TOPS-20, each file you access is associated with a  number  called
the  "job  file  number" or JFN.  There is no architectural limit (other
than the 18-bit JFN size) to the number of files your job can access  at
one  time,  although  you may be limited by availability of other system
resources.

There  are  two  reserved  JFN  values.   The   first   is   octal   100
(symbolically,  .PRIIN),  which  is  the JFN of your primary input file.
This is almost always input from your terminal keyboard.  The  other  is
octal  101  (symbolically,  .PRIOU),  which  is  the JFN of your primary
output file, usually your terminal display.



5.5  JSYS SEQUENCE FOR ACCESSING A FILE

The sequence of UUOs used to read or write a TOPS-10 file  is  typically
the following:

     a.  OPEN
INPUT/OUTPUT                                                    Page 5-4
JSYS SEQUENCE FOR ACCESSING A FILE                             16 Jan 84


     b.  LOOKUP and/or ENTER

     c.  IN(PUT) and/or OUT(PUT)

     d.  CLOSE

     e.  RELEAS


Let us examine the corresponding sequence using JSYSs.



5.5.1  Processing The File Specification (GTJFN)

In most cases, a program which  accesses  a  file  starts  with  a  file
specification.   For example, the file specification may have been typed
by the person using the program.  Under TOPS-10,  your  program  has  to
contain  code  which  parses the file specification, so that you can use
the OPEN UUO to open the device and then, typically, use LOOKUP or ENTER
to access the file with the specified file name and extension.

When writing a file access program under TOPS-20, you must start with  a
file  specification.   The  GTJFN  monitor call automatically parses the
file specification for you, and returns a JFN for the file.   From  that
point  on,  your program may make any further monitor requests it wishes
for that file, simply by specifying the JFN for the file.

Notice that the GTJFN monitor call does not actually open the file,  and
so  it  is not really the counterpart of either the OPEN or LOOKUP/ENTER
UUOs.  Instead, it simply provides a number to be  associated  with  the
given file specification.



5.5.2  Command Parsing

If you are writing a command parser, there are more convenient  ways  to
access files.  Here are some of the options:

     1.  You  may  specify  that  the  GTJFN  is  to   take   the   file
         specification  from  the user's terminal.  This means that your
         program  won't  have  to  do  any  file  specification   string
         processing  at all, but will only have to work with the numeric
         JFN.

     2.  If you wish to accept wildcard specifications, then you may use
         the  GNJFN  monitor  call  to access each file requested by the
         user in turn.

     3.  You may use the COMND JSYS to perform all your command  parsing
         and obtain all your JFNs automatically.

INPUT/OUTPUT                                                    Page 5-5
JSYS SEQUENCE FOR ACCESSING A FILE                             16 Jan 84


For further information, refer to the descriptions of the  GTJFN,  GNJFN
and COMND JSYSs in the TOPS-20 Monitor Calls Reference Manual.



5.5.3  Opening And Closing The File (OPENF And CLOSF)

Once the JFN has been obtained, you may execute the OPENF  monitor  call
to  open  the file.  This monitor call provides all the functionality of
the OPEN, LOOKUP, and ENTER UUOs.  Within the OPENF call you specify the
type of access (read access, write access, and so forth) that you wish.

Your program may then access the file for input and output in the manner
described below.  After you have finished with the file, you execute the
CLOSF monitor call to close it.



5.5.4  String Input/output (SIN And SOUT)

There are several JSYSs which perform input and output functions, and we
will examine several of them here and in the following subsections.  All
require that the file be opened with GTJFN and OPENF.

For most applications, the best and most  efficient  input/output  JSYSs
are  SIN and SOUT.  These provide input and output operations for entire
strings of bytes or words.

When your program executes the OPENF monitor call,  it  must  specify  a
byte  size  between  1  and 36.  This byte size is used with the SIN and
SOUT monitor calls.  You provide SIN and SOUT with a  byte  pointer  and
either  the  number  of  bytes  or  the value of a terminating byte, and
TOPS-20 transmits those bytes to or from the file.

Intuitively, it may  seem  that  any  string-oriented  monitor  call  is
probably  fairly  inefficient.   However,  SIN and SOUT are very heavily
optimized,  and  so  they  are  the  most  efficient  choices  for  most
applications.



5.5.5  Dump Mode Input/output With DUMPI And DUMPO

When you use OPENF to open a file, you may choose a file data mode.   If
you  choose  dump  mode,  then  your program may use the DUMPI and DUMPO
monitor calls to perform input and output operations.

Of all the I/O methods, DUMPI and DUMPO provide the  functionality  most
similar  to  dump  mode on TOPS-10.  When your program executes DUMPI or
DUMPO, it passes the address of an IOWD list in the same format as  that
passed  with  the dump mode IN and OUT UUOs.  For that reason, DUMPI and
DUMPO are often the most convenient to use when converting programs from
using UUOs to using JSYSs.
INPUT/OUTPUT                                                    Page 5-6
JSYS SEQUENCE FOR ACCESSING A FILE                             16 Jan 84


On TOPS-10, dump mode I/O is very efficient since the IOWD argument list
is  very  close  to  the  argument list that TOPS-10 needs to perform an
input/output operation.   On  TOPS-20,  however,  DUMPI  and  DUMPO  are
provided  only  for  TOPS-10  compatibility, and they are less efficient
than SIN and SOUT for disk input/output operations.



5.5.6  Mapping A File's Pages With PMAP

There is an additional input/output method on  TOPS-20  that  is  unlike
anything  available  under  TOPS-10.  When it can be used, it is usually
the most efficient TOPS-20 disk input/output method.

The TOPS-20  file  system  stores  files  on  disk  in  512-word  pages.
(TOPS-10  uses 128-word blocks.) This page size is identical to the page
size of your executing program.  You may use the PMAP  JSYS  to  specify
that  a  page  of  your executing program is to be "mapped to" a page of
your file.

To understand how this works, consider this example.  Suppose  that  you
wish  to  access  data  in word positions 6000-6777 (octal) in your disk
file.  Of course, you could use SIN or DUMPI to request TOPS-20 to  read
that  data  into  your  program's  memory, but there is a more efficient
method with PMAP.  You may choose a page of your program's  memory,  say
page  125  (octal),  and  your  program  can execute a PMAP monitor call
specifying that page 6 of the file is to be mapped to page 125  of  your
program.  The result will be that page 125 of your program will actually
be page 6 of the disk file.  If your program fetches the word at  memory
location  125643, then it will actually be fetching the word at position
6643 in the file.  If your  program  stores  into  the  word  at  memory
location  125005,  then you will modify the word in position 6005 in the
file.

The example in the last paragraph made an assumption that the  file  had
been  opened  for both input and output access.  As you can see from the
example, PMAP is extremely  convenient  to  use  when  your  program  is
updating  a  file.   (BEWARE:   When using PMAP to create new pages in a
file, you must the CHFDB JSYS to update the  file  byte  size  and  byte
count,  as  explained in the TOPS-20 Monitor Calls Reference Manual.  If
you don't do this, the data in the file may not be accessible  to  other
programs.)

Suppose, however, that the file is not opened for  write  access.   Then
there  are  two  other  choices:   input  access  only and copy-on-write
access.  In the case of input access,  storing  into  the  PMAPped  page
would  be illegal.  In the case of copy-on-write access, if your program
did store into the page, then  the  disk  file  would  not  be  changed.
Instead,  TOPS-20  would  automatically make a separate copy of the page
for your program, effectivly  "un-PMAPping"  the  file  page  from  your
program's  page.   From that point on, your program could read and write
data from the memory page without having any effect on the disk file.
INPUT/OUTPUT                                                    Page 5-7
THE FILE DESCRIPTOR BLOCK                                      16 Jan 84


5.6  THE FILE DESCRIPTOR BLOCK

TOPS-20 has a file descriptor block (FDB) for each disk file.   The  FDB
contains  general  information  about  the file and, as such, performs a
function similar to TOPS-10's LOOKUP/ENTER block (the RIB).  You may use
the GTFDB JSYS to read the FDB, and the CHFDB JSYS to change it.

The following  is  a  list  of  commonly  used  fields  of  the  TOPS-10
LOOKUP/ENTER   block  that  might  be  useful  to  the  TOPS-20  systems
programmer and where the same information can be obtained for a  TOPS-20
file, if possible:

.RBPPN    gives the project-programmer number of the directory.  This is
          not provided in the FDB.

.RBNAM    Gives the SIXBIT file name.  The  FDB  field  .FBNAM  gives  a
          pointer to the file name block for the file.

.RBEXT    Gives the SIXBIT file name extension.  The  FDB  field  .FBEXT
          contains a pointer to the file type block.

          The word .RBEXT also contains a portion of the  creation  date
          for  the file.  The creation date and time is given in the FDB
          in the word .FBCRV.

          The word .RBEXT also contains a portion  of  the  last  access
          date for the file.  In the FDB, .FBREF gives the date and time
          of the last non-write access to the  file,  .FBWRT  gives  the
          date  and  time  of last user write, and .FBCRE gives the date
          and time of last write to the file by any program.

          You can  use  the  SFTAD  and  RFTAD  JSYSs  to  set  or  read
          information about a file's times and dates.

.RBPRV    Protection code for file.  The FDB field .FBPRT gives the file
          access bits.

          The word .RBPRV also contains the data mode in which the  file
          was  created.   This  information  is provided in the FDB word
          .FBBYV in the bit field  FB%MOD.   Note  that  this  FDB  word
          contains  other  information  as well, including the file byte
          size in bit field FB%BSZ.

          For information about creation date and time, see  description
          above under .RBEXT.

.RBSIZ    Gives the written file length in words.  The FDB field  .FBSIZ
          gives  the  size  of  the  file in bytes.  You may compute the
          number of words from the file byte  size  given  in  FDB  word
          .FBBYV, bit field FB%BSZ.

.RBVER    Gives the octal version number of the file, if it  is  an  EXE
          file.  This is not provided by the FDB.
INPUT/OUTPUT                                                    Page 5-8
THE FILE DESCRIPTOR BLOCK                                      16 Jan 84


.RBSPL    The file name to be used to label output  to  spooled  device.
          This is not provided by the FDB.

.RBEST    Estimated length of file.  This is not provided by the FDB.

.RBALC    Number of contiguous 128-word blocks.  This is not provided by
          the FDB.



5.7  NON-BLOCKING INPUT/OUTPUT

All TOPS-20 disk input/output operations are "blocking,"  in  the  sense
that your program stops executing until the I/O JSYS has completed.

If you wish to perform non-blocking input/output operations,  then  some
extra programming is necessary.  The following steps may be used:

     a.  The program executes the CFORK JSYS  to  create  a  sub-process
         with the same memory map (CR%MAP option).  The starting address
         of the sub-process is specified to be the input/output code.

     b.  The sub-process executes  the  input/output  operation  and  is
         blocked waiting for it to complete.

     c.  The original program (that is, the superior process)  continues
         executing.

     d.  When the input/output operation  is  complete,  the  subprocess
         becomes  unblocked.   It  can  then  set  a  flag  in memory to
         indicate that the I/O operation is complete,  and  execute  the
         HALTF JSYS to halt subprocess execution.

     e.  Since the subprocess has the same memory map  as  the  superior
         process,  the  flag  set  by  the subprocess is also set in the
         superior process's memory.  The superior process need only test
         this flag from time to time to determine that the I/O operation
         has been completed.


In place of the last two steps, the software interrupt facility  can  be
used.   The  superior process can enable the software interrupt facility
to cause an interrupt when the inferior process halts.











                               CHAPTER 6

                      TRAP AND INTERRUPT HANDLING



This chapter describes  how  to  handle  traps  interrupts  in  MACRO-20
programs.



6.1  GENERAL CONSIDERATIONS

There are three related methods of  handling  traps  and  interrupts  in
MACRO-10 programs:

     a.  Use the APRENB UUO.

     b.  Set up a .JBINT interrupt block

     c.  Use the software interrupt system  (.PIINI,  .PISYS  and  DEBRK
         UUOs).


In MACRO-20 programs, almost all of these interrupts must be handled  by
the  software  interrupt  system.   The  exception  is  that  arithmetic
interrupts can be handled  with  the  SWTRP%  JSYS,  with  substantially
improved performance over the software interrupt system.



6.2  JSYSs FOR CONTROLLING THE SOFTWARE INTERRUPT SYSTEM

The following are the most important JSYSs  which  control  the  TOPS-20
software interrupt system:

     a.  SIR -- Set up the interrupt  table  addresses.   You  generally
         start with this JSYS.

     b.  EIR -- Enable the interrupt system.  This JSYS permits  you  to
         specify  the  particular  conditions  for  which  you wish your
         program to get interrupted.

     c.  DIR -- Disable the interrupt system.
TRAP AND INTERRUPT HANDLING                                     Page 6-2
JSYSs FOR CONTROLLING THE SOFTWARE INTERRUPT SYSTEM            16 Jan 84


     d.  CIS -- Clear the interrupt system.

     e.  AIC -- Activate interrupt channels.

     f.  DEBRK -- Dismiss current interrupt.

     g.  ATI -- Assign terminal code to a channel.   This  JSYS  permits
         you  to  define  interrupts  for  any  terminal  input  control
         characters, including CTRL/C interrupts.


Complete details on these and other JSYSs for  controling  the  software
interrupt  system  will  be found in the TOPS-20 Monitor Calls Reference
Manual.



6.3  HANDLING INTERRUPTS THROUGH A SUB-PROCESS

Some types  of  operation  programmed  through  interrupts  in  MACRO-10
programs  must  be handled different in TOPS-20 programs.  The principal
examples of this are related to non-blocking I/O  operations.   You  may
write  TOPS-10  input/output  operations  which  permit  your program to
continue executing while the I/O operation is in progress;  you can  use
the  software  interrupt  system  to  requests TOPS-10 to interrupt your
program when the I/O operation is complete.

All TOPS-20 I/O operations are of the "blocking" kind.  This means  that
your   program's  execution  is  automatically  blocked  until  the  I/O
operation is complete.  However, you may change your program  to  obtain
the same effect by the following technique:

     a.  Have your program  start  a  sub-process  to  perform  the  I/O
         operations.  The program and the sub-process continue executing
         together.

     b.  The sub-process executes the I/O JSYS,  and  its  execution  is
         blocked.  The main program continues to execute.

     c.  When  the  I/O  operation  has   completed,   the   sub-process
         interrupts  the  main  program.   This signals the main program
         that the I/O operation is complete.

     d.  The sub-process halts, using the HALTF JSYS.


This is a very general technique which can be used in a wide variety  of
situations.   Any  JSYS which normally blocks execution of a program can
be turned into a non-blocking JSYS in this way.
TRAP AND INTERRUPT HANDLING                                     Page 6-3
THE APRENB UUO                                                 16 Jan 84


6.4  THE APRENB UUO

The following are the functions programmed by the APRENB  UUO,  and  the
corresponding methods for programming them in TOPS-20:

     a.  AP.POV -- Pushdown list overflow

         JSYS:  Enable the .ICPOV  interrupt  channel  in  the  software
         interrupt system.

     b.  AP.ILM -- Memory protection violation.

         JSYS:  Enable the .ICIRD and .ICIWR (illegal  memory  read  and
         write) channels in the software interrupt system.

     c.  AP.NXM -- Nonexistent memory.

         JSYS:  This type of interrupt normally can't occur in a TOPS-20
         program.    However,   you   may   intercept  nonexistent  page
         references by enabling  the  .ICNXP  channel  in  the  software
         interrupt system.

     d.  AP.PAR -- Memory parity error.

         JSYS:  This is a hardware error.  There is no way to  intercept
         it in MACRO-20 programs.

     e.  AP.CLK -- Clock tick has occurred.

         JSYS:   There  is  no  corresponding  JSYS  functionality   for
         intercepting  each  clock  tick, since TOPS-20 does not support
         realtime capabilities.

     f.  AP.FOV and AP.AOV -- Floating  point  and  arithmetic  overflow
         errors.

         JSYS:  There are two possible methods:

        (i)  With the software interrupt system, by enabling the  .ICAOV
             and .ICFOV interrupt channels.

       (ii)  With the SWTRP% JSYS.





6.5  THE .JBINT INTERRUPT BLOCK

The following are the  functions  programmed  by  means  of  the  .JBINT
intercept  block,  and the corresponding methods for programming them in
TOPS-20:
TRAP AND INTERRUPT HANDLING                                     Page 6-4
THE .JBINT INTERRUPT BLOCK                                     16 Jan 84


     a.  ER.EIJ -- Error in job.

         JSYS:  This general error condition cannot be  handled  by  the
         TOPS-20  software  interrupt  system  except the general method
         described earlier in this chapter.  In using that  method,  you
         allow  your  program to run as a sub-process, and then have the
         superior process gain control whenever any error occurs in  the
         sub-process.

     b.  ER.TLX -- Time limit exceeded.

         JSYS:   There  is  no  corresponding  JSYS  functionality   for
         intercepting  this  error, except by the general method using a
         sub-process described earlier in this chapter.

     c.  ER.QEX -- quota exhausted.

         JSYS:   There  is  no  corresponding  JSYS  functionality   for
         intercepting  this  error, except by the general method using a
         sub-process described earlier in this chapter.   However,  most
         input/output  JSYSs  give  an error return which indicates when
         your quota has been exceeded.

     d.  ER.FUL -- File structure full.

         JSYS:   There  is  no  corresponding  JSYS  functionality   for
         intercepting  this  error, except by the general method using a
         sub-process described earlier in this chapter.

     e.  ER.OFL -- Disk unit offline.

         JSYS:   There  is  no  corresponding  JSYS  functionality   for
         intercepting  this  error, except by the general method using a
         sub-process described earlier in this chapter.

     f.  ER.ICC -- CTRL/C typed.

         JSYS:  You may assign a TOPS-20 programmed  interrupt  for  any
         control character, including CTRL/C, using the ATI JSYS.

     g.  ER.IDV -- Problem on device.

         JSYS:  This condition may be intercepted by enabling the .ICDAE
         (I/O error) channel of the TOPS-20 software interrupt system.




6.6  THE SOFTWARE INTERRUPT SYSTEM

The following paragraphs list the conditions intercepted by the  TOPS-10
software  interrupt  system,  and  the  methods  for performing the same
functions in MACRO-20 programs.
TRAP AND INTERRUPT HANDLING                                     Page 6-5
THE SOFTWARE INTERRUPT SYSTEM                                  16 Jan 84


The following are the I/O conditions:

     a.  PS.RID -- Input done.

         JSYS:   There  is  no  corresponding  JSYS  functionality   for
         intercepting  this  error, except by the general method using a
         sub-process described earlier in this chapter.

     b.  PS.ROD -- Output done.

         JSYS:   There  is  no  corresponding  JSYS  functionality   for
         intercepting  this  error, except by the general method using a
         sub-process described earlier in this chapter.

     c.  PS.REF -- End of file.

         JSYS:  This condition may be intercepted by enabling the .ICEOF
         channel of the TOPS-20 interrupt system.

     d.  PS.RIE -- Input error.

         JSYS:  This condition may be intercepted by enabling the .ICDAE
         (I/O error) channel of the TOPS-20 software interrupt system.

     e.  PS.ROE -- Output error.

         JSYS:  This condition may be intercepted by enabling the .ICDAE
         (I/O error) channel of the TOPS-20 software interrupt system.

     f.  PS.RDO, PS.RDF, and PS.RQE -- Device offline, device  full  and
         quota exceeded

         JSYS:  These conditions may  be  intercepted  by  enabling  the
         .ICDAE  (I/O  error)  channel of the TOPS-20 software interrupt
         system.

     g.  PS.RWT -- I/O wait

         JSYS:   There  is  no  corresponding  JSYS  functionality   for
         intercepting  this  error, except by the general method using a
         sub-process described earlier in this chapter.

     h.  PS.ROL -- Device on-line

         JSYS:  As a general rule, there is no way for a TOPS-20 process
         to  intercept  device on-line conditions.  In certain cases, it
         may be possible to have a sub-process  wait  for  a  device  to
         become  available  and  then signal the superior process, using
         the general method described earlier in this chapter.

     i.  PS.RRC -- RIB has changed.
TRAP AND INTERRUPT HANDLING                                     Page 6-6
THE SOFTWARE INTERRUPT SYSTEM                                  16 Jan 84


         JSYS:  There is no equivalent TOPS-20 functionality.


The following are the non-I/O condtions:

     a.  .PCTLE -- Time limit has been exceeded.

         JSYS:   There  is  no  corresponding  JSYS  functionality   for
         intercepting  this  error, except by the general method using a
         sub-process described earlier in this chapter.

     b.  .PCSTP -- CTRL/C interrupt

         JSYS:  You may assign a TOPS-20 programmed  interrupt  for  any
         character, including CTRL/C, using the ATI JSYS.

     c.  .PCUUO -- A monitor call is about to be processed.

         JSYS:  The TFORK JSYS permits a process to intercept  all  JSYS
         calls  for  an  inferior  process.   You  may also use TFORK to
         intercept TOPS-20 UUO calls in a TOPS-20 program.

     d.  .PCIUU -- An illegal UUO has been executed.

         JSYS:  The analogous condition may be intercepted  by  enabling
         the   .ICILI  (illegal  instruction)  channel  of  the  TOPS-20
         software interrupt system.

     e.  .PCIMR -- An illegal memory location has been referenced.

         JSYS:  As explained in this manual in the  chapter  on  "MEMORY
         MANAGEMENT,"   TOPS-20   programs   get  fewer  illegal  memory
         references than TOPS-10 programs.  You may  enable  the  .ICIRD
         (illegal memory read), .ICIWR (illegal memory write) and .ICNXP
         (reference to nonexistent page) software interrupt channels.

     f.  .PCACK -- Address check has occurred on a device.

         JSYS:  This can be intercepted by enabling the .ICDAE (data I/O
         error)  software  interrupt  channel.   In addition, this error
         condition is indicated by error  returns  in  the  input/output
         JSYSs.

     g.  .PCARI -- An arithmetic exception has occurred.

         JSYS:  There are two possible methods:

        (i)  With the software interrupt system, by enabling the  .ICAOV
             and .ICFOV interrupt channels.

       (ii)  With the SWTRP% JSYS.

TRAP AND INTERRUPT HANDLING                                     Page 6-7
THE SOFTWARE INTERRUPT SYSTEM                                  16 Jan 84


     h.  .PCPDL -- Pushdown list overflow.

         JSYS:  You may intercept this condition by enabling the  .ICPOV
         TOPS-20 software interrupt channel.

     i.  .PCNXM -- A non-existent memory location has been referenced.

         JSYS:  You may intercept references to  non-existent  pages  by
         enabling the .ICNXP software interrupt channel.

     j.  .PCAPC -- A line frequency clock tick has occurred.

         JSYS:   There  is  no  corresponding  JSYS  functionality   for
         intercepting  each clock tick, because TOPS-20 does not support
         realtime capabilities.

     k.  .PCUEJ -- A fatal error has occurred in your job.

         JSYS:  This very general error condition cannot be  handled  by
         the  TOPS-20  software  interrupt system except by means of the
         general method described earlier in  this  chapter.   In  using
         that  method,  you  allow your program to run as a sub-process,
         and then have the superior process gain  control  whenever  any
         error occurs in the sub-process.

         Note that you may intercept illegal  instructions  by  enabling
         the .ICILI software interrupt channel.

     l.  .PCXEJ -- An external condition has caused a fatal job error.

         JSYS:  This very general error condition cannot be  handled  by
         the  TOPS-20  software  interrupt system except by means of the
         general method described earlier in  this  chapter.   In  using
         that  method,  you  allow your program to run as a sub-process,
         and then have the superior process gain  control  whenever  any
         error occurs in the sub-process.

     m.  .PCKSY -- A KSYS warning has occurred.

         JSYS:  There is no equivalent JSYS functionality.

     n.  .PCDSC -- The dataset status has changed.

         JSYS:   You  may  intercept  this  condition  by  assigning   a
         user-defined  software  interrupt  channel  by means of the ATI
         JSYS with the .TICRF argument code.

     o.  .PCDAT -- Either an ATTACH or a DETACH monitor  call  has  been
         executed.

         JSYS:  There is no equivalent JSYS functionality.
TRAP AND INTERRUPT HANDLING                                     Page 6-8
THE SOFTWARE INTERRUPT SYSTEM                                  16 Jan 84


     p.  .PCWAK -- A WAKE monitor call has occurred.

         JSYS:  There is  no  directly  equivalent  JSYS  functionality.
         However,   you   may   program  the  same  effect  by  using  a
         sub-process, following the general process described earlier in
         this  chapter.   You start up a sub-process and have it dismiss
         itself with the THIBR  JSYS.   Then,  when  another  wakes  the
         sub-process  with  a TWAKE JSYS, the sub-process can signal the
         superior process.

     q.  .PCABK -- An address-break condition has occurred.

         JSYS:  A process cannot intercept an address break occurring in
         itself, but it can enable the .ICNXP software interrupt channel
         to intercept address breaks occurring  in  sub-processes.   The
         entire  programming  method is described in the TOPS-20 Monitor
         Calls Manual, in the description of the ADBRK JSYS.

     r.  .PCIPC -- Your program has received an IPCF packet in its input
         queue.

         JSYS:  the .MUPIC function of the MUTIL JSYS  can  be  used  to
         enable  for  interrupts  when  an  IPCF  packet is in the input
         queue.

     s.  .PCQUE -- An ENQ/DEQ resource is available for ownership.

         JSYS:  You may intercept this condition by means of the  .ENQIS
         function of the ENQ JSYS.

     t.  .PCNET -- The network topology has changed.

         JSYS:  There is no equivalent JSYS functionality.

     u.  .PCJBI -- Another job has interrupted your job by means of  the
         PIJBI UUO.

         JSYS:  There is no equivalent JSYS functionality.




6.7  OTHER INTERRUPT CONDITIONS

The following are additional conditions  which  may  be  intercepted  by
means of the TOPS-20 software interrupt system:

     a.  Pseudo-terminal interrupts  can  be  enabled  with  the  .MOAPI
         function of the MTOPR JSYS.

     b.  Terminal interrupts can be enabled with the .MOTPS function  of
         the MTOPR JSYS.
TRAP AND INTERRUPT HANDLING                                     Page 6-9
OTHER INTERRUPT CONDITIONS                                     16 Jan 84


     c.  Magnetic  tape  interrupts  can  be  enabled  with  the  .MOPST
         function of the MTOPR JSYS.












                               CHAPTER 7

                         OTHER MONITOR FEATURES



This chapter summarizes the differences in going from TOPS-10 to TOPS-20
for the following features:

     1.  IPCF (inter-process communications facility)

     2.  Accounting




7.1  IPCF

IPCF (inter-process communications facility) works the  same  way  under
TOPS-10 and TOPS-20.  The similarities and differences are summarized in
the following paragraphs:

     a.  The format of an IPCF packet is the same, and  offsets  can  be
         referenced by means of the same symbols (.IPCFL, .IPCFS, etc.).
         However, the flag definitions  have  different  symbols  (e.g.,
         IP.CFB  under  TOPS-10  versus  IP%CFB under TOPS-20), and some
         flags may have different meanings.

     b.  THE IPCFS. UUO corresponds to the MSEND JSYS to send  a  packet
         to  another  process.   The IPCFR. UUO corresponds to the MRECV
         JSYS to receive a packet.

     c.  The IPCFQ. UUO queries a queue for  an  available  packet.   An
         equivalent function can be performed by setting the IP%CFB flag
         in the argument to the MRECV JSYS.

     d.  The TOPS-10 QUEUE. UUO is used  to  send  messages  to  QUASAR,
         ORION  and  ACTDAE.  Under TOPS-20, all such IPCF send requests
         are performed by the MSEND JSYS.

     e.  Rules for assigning packet quotas are the same in both systems.

     f.  Symbolic names for processes may have different formats, as  in
         the following examples:

OTHER MONITOR FEATURES                                          Page 7-2
IPCF                                                           16 Jan 84


         1.  [SYSTEM]INFO on TOPS-10 versus <SYSTEM>INFO on TOPS-20.

         2.  [10,10]FOO on TOPS-10 versus <JONES>FOO on TOPS-20.


         To reduce the effect  of  this  incompatibility,  use  symbolic
         names which do not depend upon PPNs.

     g.  Certain requests to  [SYSTEM]INFO  are  not  implemented  under
         TOPS-20.     Specifically,    the   following   functions   are
         implemented:

         1.  .IPCIW -- Return PID associated with specified name.

         2.  .IPCIG -- Return name associated with specified PID.

         3.  .IPCII -- Assign specified name to PID  of  process  making
             request.


         All other functions are not implemented.

     h.  The TOPS-10 [SYSTEM]IPCC functions are performed  by  means  of
         the  MUTIL JSYS.  The functions are similar, but some functions
         may have operating system-dependent differences.




7.2  ACCOUNTING

This section summarizes the differences in accounting.



7.2.1  FACT Files

FACT files are not supported under TOPS-20.   If  your  installation  is
planning  a move from TOPS-10 to TOPS-20 in the future, you should start
now to rewrite you accounting programs to use  USAGE  files,  which  are
implemented on both TOPS-10 and TOPS-20 in a compatible manner.



7.2.2  USAGE Files

The USAGE file accounting system has been implemented  in  a  compatible
manner on both TOPS-10 and TOPS-20.  Information on USAGE files for both
TOPS-10  and  TOPS-20  will  be  found  in   the   manual   AA-4181B-TK,
AD-4181B-T1, TOPS-10/TOPS-20 USAGE File Specification.

There are three major differences between TOPS-10 and TOPS-20 USAGE file
record formats.
OTHER MONITOR FEATURES                                          Page 7-3
ACCOUNTING                                                     16 Jan 84


The first difference is in the Identification  Record.   Under  TOPS-10,
this   record  contains  a  12-digit  project/programmer  number  and  a
12-character user name.  The TOPS-20 record contains a 39-character user
name.

The second difference is that there is one more record  in  the  TOPS-10
session  entry than there is for TOPS-20.  The additional TOPS-10 record
is  called  "Session  Record  #2,"  and  it   contains   the   following
information:

     a.  Number of disk reads and writes

     b.  Real and virtual kilo-core seconds

     c.  EBOX and MBOX megacounts

     d.  Monitor calls

     e.  Monitor commands

     f.  Scheduling class

     g.  TTY input and output characters

     h.  Wake count

     i.  Run queue quotient


These items are not computed by the TOPS-20 scheduler, and so  they  are
not provided in the TOPS-20 USAGE files.

The third major difference is that TOPS-20 maintains USAGE file  entries
for file retrieval, archival, migration and collection.



7.2.3  Adding Installation-dependent USAGE File Entries

A TOPS-10 program may request an additional USAGE record  by  using  the
QUEUE. UUO to notify the accounting daemon (ACTDAE) to add the record.

A TOPS-20 program may perform the same  action  simply  by  executing  a
USAGE JSYS.  The format of the USAGE file record is identical.



7.2.4  Account Validation

Under TOPS-10, account validation occurs  at  login  time  or  when  the
SESSION  monitor  command  is  given.   The  accounting  daemon (ACTDAE)
verifies that a given account is valid for  a  given  project-programmer
number.  Valid accounts are listed in the accounting file by PPN.
OTHER MONITOR FEATURES                                          Page 7-4
ACCOUNTING                                                     16 Jan 84


Under  TOPS-20,  account  validation  occurs  when  the  SACCT  JSYS  is
executed, either when the job logs in, or when the EXEC executes the SET
ACCOUNT command.  Valid user groups are listed in the accounting file by
account.











                               CHAPTER 8

                    PLANNING FOR EXTENDED ADDRESSING



If you are now planning on converting a program from TOPS-10 to TOPS-20,
or  if  you  are  writing a program to run under both operating systems,
then you are probably planning to run the program for a long  time  into
the future.  This means that you may at some time wish to take advantage
of the extended addressing capabilities of TOPS-20.

The purpose of this chapter is to help you write your  programs  now  so
that  you'll  be  able  to  run them with extended addressing later.  It
discusses the precautions you should take now so that the conversion  to
extended addressing will be easy later.

It is not the objective of this chapter do give a complete discussion of
how  extended  addressing  works.   These  details  can  be found in the
Hardware Reference Manual and in the  TOPS-20  Monitor  Calls  Reference
Manual.



8.1  EXTENDED ADDRESSING CONCEPTS

Let's begin with a discussion of the basic concepts.



8.1.1  Availability Of Extended Addressing

Extended addressing is available only on 2040,  2050  and  2060  systems
using  the KL10 Model B CPU.  It is not available on the earlier Model A
CPU, nor is it available in the KS10 CPU used on 2020 systems.



8.1.2  The Extended Address Format

Programs written without extended addressing capabilities use an  18-bit
address  space,  providing  your  program  with  a  total of 256K words.
Extended addressing, as the name implies, extends the 18-bit address  to
a 30-bit address, providing up to 1,073,741,824 words.
PLANNING FOR EXTENDED ADDRESSING                                Page 8-2
EXTENDED ADDRESSING CONCEPTS                                   16 Jan 84


Each 30-bit address should be thought of  as  in  two  parts,  a  12-bit
section   number  and  an  18-bit  word  number  (within  the  section).
Therefore, there 4096 sections, numbered  0  to  octal  7777,  and  each
section contains 256K words.



8.1.3  Use Of Section 0

Hardware implementation of extended  addressing  requires  that  certain
machine  execute  differently.   This  change  means,  of  course,  that
existing programs could not run  without  modification  in  an  extended
addressing environment.

In order to provide a compatible environment for non-extended  programs,
a  sharp  division  has  been  made between section 0 and the other 4095
sections (the  "non-zero  sections").   This  division  results  in  the
following conventions:

     a.  A program running in section 0 runs exactly as it  would  on  a
         non-extended  machine.   This  means that all existing programs
         can run as before, even on an extended machine.

     b.  A program running in  a  non-zero  section  uses  the  modified
         machine  instructions  and addressing algorithms.  This usually
         means that it could no longer execute in section 0.




8.1.4  Use Of Section 1

Another way in which this sharp division emerges has  to  do  with  data
references across section boundaries.  The hardware implementation makes
it impossible for a program running in section  0  to  reference  memory
locations in non-zero sections, and very difficult for a program running
in a non-zero section to reference memory  locations  in  section  zero.
This  makes it difficult to convert a program "gradually," by converting
a portion of it at time to use extended addressing.

For this reason, TOPS-20 provides a method for remapping memory so  that
section 0 and section 1 share the same memory.  That is, TOPS-20 sets up
its memory page tables so that a user program fetch-from or store-into a
word  of  section 0 is hardware equivalent to a fetch-from or store-into
the corresponding word of section  1.   There  is  a  special  technique
provided  so  that a program can switch back and forth between section 0
and section 1, so that  even  an  unmodified  non-extended  program  can
temporarily  "visit"  section  1  and  reference  data in other extended
sections.
PLANNING FOR EXTENDED ADDRESSING                                Page 8-3
EXTENDED ADDRESSING CONCEPTS                                   16 Jan 84


8.1.5  Partitioning Program Into Sections

Even when running in a non-zero  section,  it  is  generally  easier  to
reference   data   in   your   own  section  than  in  another  section.
Specifically, if an instruction is executing in a non-zero section,

     a.  The instruction can reference memory  in  its  own  section  in
         almost   exactly   the  same  way  that  an  instruction  in  a
         non-extended program references memory.

     b.  The instruction can reference memory in another section only if
         it does so by means of indexing or indirect addressing.


This means that additional code is often necessary to reference data  in
another section.



8.2  DESIGNING A COMPATIBLE PROGRAM

If you are writing a non-extended program which may later  be  converted
to  use  extended  addressing,  then  proper  design  now  will make the
conversion much easier later.



8.2.1  Partitioning Data Into Sections

The first main design job is to decide  how  data  will  be  distributed
among  the  different sections.  More specifically, when writing a piece
of code, it will be necessary for you to know which data values will  be
in the same section as the code and which will be in different sections.

You will need to formulate some sort of rule for making  this  decision.
For  example,  assuming that all the code for a program will reside in a
single section, you may decide upon the following rules:

     I.  All data aggregates or structures occupying less than 100 words
         of storage will be allocated in the same section as the code.

    II.  All data aggregates or structures which are variable in size or
         which are larger than 100 words of storage will be allocated in
         a different section.


In deciding tradeoffs of this sort, keep in mind  that  more  code  will
generally  be  needed  to access data in the second class than to access
data in the  first  class.   Therefore,  for  example,  a  20-word  data
structure  which is accessed dozens of times in the code should possibly
be allocated in the same section as the code.
PLANNING FOR EXTENDED ADDRESSING                                Page 8-4
DESIGNING A COMPATIBLE PROGRAM                                 16 Jan 84


8.2.2  Design Of Control Blocks

Where control blocks simply contain data, the control  blocks  can  have
the  same  format  as  they would in a non-extended program.  But if the
storage  blocks  contain  addresses  of  other  data  areas,  then  some
precautions must be taken.

     a.  Allocate an entire word of storage for each  address.   Do  not
         use  the left halfword of an address for anything else.  Later,
         when you convert to extended addressing, the left halfword will
         contain the section number.

     b.  Leave two words for each byte pointer, although in some  cases,
         as described below, the two words won't be needed.

     c.  If possible, avoid using the same word of a  control  block  as
         either  a  data  value or an address.  It will simplify certain
         types of algorithms to know that a non-zero value in a  certain
         field of a control block can never be anything but an address.




8.2.3  Identifying Monitor Calls

As you lay out your program design in terms of modules, you should  plan
to  isolate  all  monitor calls in small subroutines.  These subroutines
may have to be rewritten when your program is  converted  to  run  in  a
non-zero  section.   The  reason  is  that  some JSYSs must be specified
differently in non-zero sections.  See the TOPS-20 Monitor Calls  User's
Guide for further information.



8.3  SPECIFIC COMPATIBLE CODING TECHNIQUES

Once program  design  has  been  completed  and  actual  coding  begins,
specific methods should be used so that later rewriting will made easier
or unnecessary.



8.3.1  Local vs. Global Memory References

In the following  paragraphs,  we  will  be  discussing  how  you  write
instructions  now so that they will work properly later when the program
is to run in a non-zero section.

In our discussions, we will distinguish  between  "local"  and  "global"
memory accesses.  An instruction is said to make a "local" memory access
if it is referencing only memory locations in the same  section  as  the
instruction  itself.  If the instruction accesses a memory location in a
different section, it is said to be making a "global" memory reference.
PLANNING FOR EXTENDED ADDRESSING                                Page 8-5
SPECIFIC COMPATIBLE CODING TECHNIQUES                          16 Jan 84


As you are reading these discussions, keep in mind that there is no such
distinction for the non-extended programs you are running now, since all
instructions and data run in section 0.  Rather, the terms  "local"  and
"global"  apply  to  memory  references  which  will  be  made when your
programs are converted to extended addressing later.  This means that as
you are writing your code, you must constantly keep in mind what kind of
data you are accessing.  If you are accessing data which will  later  be
in  a  different  section  than the accessing instruction, then you must
take certain precautions.  If you are sure that the data being  accessed
will  be in the same section as the executing instruction, then you must
still take some precautions, but those precautions are less onerous.



8.3.2  Local Memory Access

If you are writing code which  will  only  access  memory  in  the  same
section as the one in which the code will execute, it will generally not
be  necessary  to  take  any  special  precautions.   For  example,  the
instruction

        MOVE   AC1,2000

will load AC1 with the contents of word 2000  in  whatever  section  the
MOVE instruction executes.

Also compatible are situations where the address is an accumulator.  For
example, the instruction

        MOVE   AC1,AC2

loads AC1 with the contents of AC2.

On the other hand, if you wish  an  instruction  to  reference  data  in
another section, then it must use indexed or indirect addressing.



8.3.3  Using Indexed Addressing

An index register contains an address which modifies the address of  the
instruction  using  it.   An  indexed  instruction in a non-zero section
treats a positive number in the left half of  an  index  register  as  a
section  number.   A  negative  left halfword is ignored, and the memory
address is considered to be local.

Let's take a look at some examples.


         Example 1.  Referencing fields of a large control block.

         Suppose that you are writing instructions to  reference  fields
         in a large control block at a fixed location in memory.  If the
         control block begins at location 300000  in  your  non-extended
PLANNING FOR EXTENDED ADDRESSING                                Page 8-6
SPECIFIC COMPATIBLE CODING TECHNIQUES                          16 Jan 84


         program, then your program might contain instructions like:

               MOVE   AC1,300125

         or

               ADDM   AC2,300140

         These instructions will continue to work when your program runs
         in an extended section, provided that the control block remains
         in the same section as the code.

         However, if the control block is to be in a  different  section
         than  the  code  that  references it, then your references will
         have to be indexed.  This  means  that  you  should  index  the
         references  to it now in your non-extended program, so that the
         same code will work later.

         For example, the instructions shown above could be  changed  as
         follows:

             MOVE   AC3,[EXP control-block-address]
             MOVE   AC1,125(3)
             ...
             ADDM   AC2,140(3)


         When running in  section  zero,  all  these  instructions  will
         reference the control block in section 0, but when running in a
         non-zero section, these instructions will reference the control
         block in the section number in the left half of AC3.

         Example 2.  Indexing with an AOBJN pointer.

         You may continue to use an AOBJN pointer as an index  register,
         provided  that  you  only reference data in the same section as
         the executing code.  Since the left half of an AOBJN pointer is
         always  negative,  the  CPU  will not interpret it as a section
         number, and  the  effective  address  computation  will  always
         result in an address in the same section as the executing code.

         Suppose you wish to search a 100-word array  called  TABLE  for
         the value in AC5.  The following code would work:

                   MOVSI  AC1,-100
             LUP:  CAMN   AC5,TABLE(AC1)
                   JRST   FOUND
                   AOBJN  AC5,LUP


         In a non-zero section, the same code works provided that  TABLE
         is in the same section as the code.

PLANNING FOR EXTENDED ADDRESSING                                Page 8-7
SPECIFIC COMPATIBLE CODING TECHNIQUES                          16 Jan 84


Notice that an important consequence of these rules is that  you  should
never  put  a  positive  number into the left half of an index register.
This means that most AOBJP loops will have to be recoded.



8.3.4  Using Indirect Addressing

A non-extended indirect address word contains an 18-bit address as  well
as  an  optional  indirect bit and index register field.  This format is
recognized when the program is running in a non-zero  section,  provided
that  bit 0 of the indirect address word contains a 1-bit.  If the first
bit is a 0-bit, then the word is considered to be in an extended format,
containing  a  30-bit  address  and  repositioned indirect bit and index
register fields.

In many cases, the easiest way to deal with this rule is simply  to  set
the leftmost bit of indirect words of non-extended programs, for example
when the word is part of an argument list.   For  this  purpose,  it  is
useful to define

          OPDEF    ifiw[1b0]

and use IFIW to define indirect words.  When the program is moved  to  a
nonzero  section, the indirect reference will still work as before, even
in the case where the indirect word contains  an  indexed  offset.   The
index  register in the extended program can contain an extended address,
so the same indirect word can reference data in other sections.

If the indirect word contains only the address  of  the  data,  with  no
indirection  or indexing, then leave the leftmost bit off.  The extended
version of the word will, of course,  have  to  contain  a  full  30-bit
address.

Finally, if the word must contain both a  full  address  and  either  an
indirect  bit  or an index register, then the section of code setting up
the indirect word may have  to  be  reprogrammed  when  the  program  is
extended.

         Example 3.  Indirect Address Word with Indexing

         Let's modify example 2 to do the same thing, but  so  that  the
         array  TABLE  will be in a different section than the code when
         the program is extended.

PLANNING FOR EXTENDED ADDRESSING                                Page 8-8
SPECIFIC COMPATIBLE CODING TECHNIQUES                          16 Jan 84


                   MOVEI  AC1,0
             LUP:  CAMN   AC5,@[TABLE(AC1)]
                   JRST   FOUND
                   CAIGE  AC5,100-1
                   AOJA   AC5,LUP


         This program segment would almost work in  a  nonzero  section,
         but  the  [TABLE(AC1)]  would  have  to  be  changed  to use an
         extended pointer.  (In assembler language, this could be  coded
         as  [EFIW TABLE,AC5].)  Thus,  this  segment  would  have to be
         recoded, if only slightly.




8.3.5  Stacks

The stack instructions (PUSH, POP, PUSHJ, POPJ and ADJSP)  use  a  stack
pointer  in  a register.  If you are certain that your stack will always
be in the same section as the code that uses it, then  you  may  keep  a
negative  stack count in the stack pointer.  As in the case of the index
register, the CPU will always assume that the stack is  in  the  current
section.   You  should  never  use the left half of the stack pointer to
store a positive value.

If the stack might sometimes be in a different section  from  the  code,
then  your converted program will have to use an extended stack pointer,
which contains the section number in the left  half.   When  running  in
section  zero,  the  left  halfword  of  your  stack  pointer  should be
initialized to zero, and never tested in any way.  If you use  the  left
half  as  a  stack count, then you must write additional instructions to
test for stack overflow.

Use the ADJSP instruction to adjust a stack pointer.  Avoid use  of  ADD
or SUB for this purpose.



8.3.6  The MOVEI And XMOVEI Instructions

The MOVEI instruction has several purposes, some of which will not  work
in a nonzero section.  This means that great care must be used.

The MOVEI instruction loads the right halfword of the  operand  register
with  the effective address computed from the second operand.  It zeroes
out the left halfword.  This is true in both zero and nonzero sections.

Consider the instruction

        MOVEI   AC,addr
PLANNING FOR EXTENDED ADDRESSING                                Page 8-9
SPECIFIC COMPATIBLE CODING TECHNIQUES                          16 Jan 84


If "addr" represents a data value to be  loaded  into  the  accumulator,
then the instruction should remain as is.  If the instruction is to load
the AC with the actual address of a data area, then it should be changed
in one of the following ways:

     a.  If the data area will be in the same section as the  code  when
         the program is converted to run in a nonzero section, then use:

                 XMOVEI  AC,addr

         The XMOVEI instruction (which has the  same  opcode  as  SETMI)
         works the same as MOVEI in section 0.  In a nonzero section, it
         loads the left halfword of AC with the section  number  of  the
         instruction.

     b.  If the data area will be in a different section, use

                 MOVE   AC,[EXP addr]


In either case, the AC will contain the correct section  number  in  the
left halfword.

Now consider this instruction:

        MOVEI  AC1,1(AC1)

This is a standard technique to add 1 to an address in  an  accumulator,
but it will not work for an extended address.  Replace it with:

        ADDI   AC1,1

This will work correctly for both nonextended and extended addresses.

Finally, the instruction:

        MOVEI  AC1,1(AC2)

must be replaced with:

        MOVE  AC1,AC2
        ADDI  AC1,1

if you wish to have compatible code.



8.3.7  Using XHLLI To Test For A Nonzero Section

The XHLLI instruction has the same opcode as HLLI, and in section  0  it
loads  the  left  half  of the register operand with zero.  In a nonzero
section, XHLLI loads the left half of  the  operand  register  with  the
section  number.   Therefore,  it  is  useful  for constructing extended
addresses.
PLANNING FOR EXTENDED ADDRESSING                               Page 8-10
SPECIFIC COMPATIBLE CODING TECHNIQUES                          16 Jan 84


If you wish to write a section of code that you know  won't  work  in  a
nonzero section, you may want to add a test to see if it is executing in
section zero.  The following test will work:

         XHLLI  AC,
         TLNE   AC,-1
         JRST   ERROR


The XHLLI instruction loads the left half of AC with the current section
number,  and  the  two instructions which follow test for zero and go to
ERROR if the section number is not zero.











                               CHAPTER 9

                 OBTAINING MONITOR INFORMATION (GETTAB)



TOPS-10 programs obtain monitor  information  from  a  number  of  UUOs,
principally  GETTAB.   The  last  chapter  of  this manual describes the
corresponding TOPS-20 procedure for each UUO (including,  at  a  general
level, GETTAB).  This chapter focuses on GETTAB.

Many of the GETTAB tables permit you to obtain information  about  other
jobs  in  the  system.   Much  of  this information is not available for
TOPS-20 jobs, usually because the process orientation of  TOPS-20  makes
that information meaningless.

As a general rule, information about other jobs can be obtained only  by
means  of  the  GETJI and GETAB JSYSs.  If you can't get the information
from one of those JSYSs, then it is not available  to  a  non-privileged
program.   A  privileged  program can, of course, use the SNOOP% JSYS to
patch the monitor to obtain any information desired.

The remainder  of  this  chapter  describes  the  method  for  obtaining
information corresponding to each of the GETTAB UUO tables.



9.1  .GTSTS (GETTAB TABLE 0)

Job status word, indexed by job or segment number.

Bits:

     a.  JB.UJA -- Job number is assigned

         JSYS:  The GETJI JSYS gives an error return if the  job  number
         argument is invalid.

     b.  JB.ULI -- Job is logged in.

         JSYS:  The word at offset .JILNO in the job  information  table
         contains  the  job's  logged-in  directory  number, and will be
         non-zero if the job is logged in.  This word  may  be  obtained
         with the GETJI JSYS.
OBTAINING MONITOR INFORMATION (GETTAB)                          Page 9-2
.GTSTS (GETTAB TABLE 0)                                        16 Jan 84


     c.  JB.UML -- Terminal is at monitor level.

         JSYS:  The word at offset .JIT20 in the job  information  table
         indicates  whether  the job is at EXEC level.  This word may be
         obtained with the GETJI JSYS.

     d.  JB.UOA -- Terminal output is available.

         JSYS:  This information may be obtained for any job by means of
         the following procedure:

         a.  Obtain the job's terminal number from the  job  information
             table at offset .JITNO.  This word may be obtained with the
             GETJI JSYS.

         b.  Use the SOBE JSYS  to  skip  if  the  specified  terminal's
             output buffer is empty.


     e.  JB.UDI -- Job is waiting at monitor level.

         JSYS:  Under TOPS-20, this state is functionally equivalent  to
         JB.UML, described above.

     f.  JB.UJC -- JACCT set for job.

         JSYS:  TOPS-20 has no equivalent to JACCT.

     g.  JB.URN -- Job is running.

         JSYS:   Because  TOPS-20  is   process-oriented   rather   than
         job-oriented,  the  concept of a job running is not relevant to
         TOPS-20.  However, you can determine if a terminal is in  input
         wait  by  means  of the .MOPIH function of the MTOPR JSYS.  The
         controlling terminal number of a job will be  found  at  offset
         .JITNO in the job information table.  This word can be obtained
         with the GETJI JSYS.

     h.  JB.UFC -- TTY is in full character set mode.

         JSYS:  The TT%WAK field  returned  by  the  RFMOD  JSYS  for  a
         terminal  indicates  the  wakeup  characters.   The controlling
         terminal number for a job can be found as for JB.URN above.

     i.  JB.UNE -- TTY has no echo

         JSYS:  The TT%ECO bit of the value returned by the  RFMOD  JSYS
         for  a terminal indicates whether the terminal is echoing.  The
         controlling terminal number for a  job  can  be  found  as  for
         JB.URN above.

     j.  JB.UTO -- Job is in "TO" state
OBTAINING MONITOR INFORMATION (GETTAB)                          Page 9-3
.GTSTS (GETTAB TABLE 0)                                        16 Jan 84


         JSYS:  This information is not available under TOPS-20.

     k.  JB.UCC -- Change since last JOBSTS

         JSYS:  No equivalent JSYS functionality.

     l.  JB.UJN (9 bits) -- Job number

         JSYS:  The word at offset .JIJNO of the job  information  table
         contains  the  job  number.  This word may be obtained with the
         GETJI JSYS.




9.2  .GTADR (GETTAB TABLE 1)

Job relocation and protection, indexed by job or segment number.

JSYS:  There is no corresponding JSYS function.



9.3  .GTPPN (GETTAB TABLE 2)

Project-programmer number, indexed by job or segment number.

JSYS:  The job's logged-in directory number is the word at offset .JILNO
in  the job information table.  This word may be obtained with the GETJI
JSYS.



9.4  .GTPRG (GETTAB TABLE 3)

User program name, indexed by job or segment number.

JSYS:  Depending upon what is needed, there are several possibilities:

     a.  The JOBNAM table of the GETAB JSYS  gives  the  system  program
         name for each job.

     b.  The JOBPNM table of the GETAB JSYS gives the user program  name
         for each job.

     c.  The GETNM JSYS gives the program name for the current job.

OBTAINING MONITOR INFORMATION (GETTAB)                          Page 9-4
.GTTIM (GETTAB TABLE 4)                                        16 Jan 84


9.5  .GTTIM (GETTAB TABLE 4)

User runtime in jiffies, indexed by job number.

JSYS:  There are two possibilities:

     a.  The JOBRT table of the GETAB JSYS gives the  runtime  for  each
         job.

     b.  The RUNTM JSYS gives the runtime for either the entire  current
         job or for a specific process in the job.


The TICKPS table of the GETAB JSYS returns the number of  jiffies  in  a
second.



9.6  .GTKCT (GETTAB TABLE 5)

Job kilo-core ticks, indexed by job number

JSYS:  There is no equivalent JSYS functionality  since  kilocore  ticks
are not computed by TOPS-20.



9.7  .GTPRV (GETTAB TABLE 6)

Job privilege bits, indexed by job number.

Bits:
     a.  JP.IPC -- IPCF
     b.  JP.DPR -- Highest disk priority for job
     c.  JP.MET -- METER.
     d.  JP.POK -- POKE.
     e.  JP.CCC -- Change CPU specification
     f.  JP.HPQ -- Highest high-priority queue
     g.  JP.NSP -- Device unspooling
     h.  JP.ENQ -- ENQ/DEQ
     i.  JP.RTT -- RTTRP (real time trap)
     j.  JP.SPA -- PEEK/SPY -- any core
     k.  JP.SPM -- PEEK/SPY -- monitor core


JSYS:  Information of this type is not available for an arbitrary job in
the  system.  However, you can use RPCAP to return the capabilities of a
particular process that is under control of your job.
OBTAINING MONITOR INFORMATION (GETTAB)                          Page 9-5
.GTSWP (GETTAB TABLE 7)                                        16 Jan 84


9.8  .GTSWP (GETTAB TABLE 7)

Swapping parameters, indexed by job number

JSYS:  There is no equivalent JSYS information on  a  job-by-job  basis.
However,  the  SYSTAB  and  NSWPGS  tables  of  the  GETAB  JSYS provide
system-wide swapping information.



9.9  .GTTTY (GETTAB TABLE 10)

Job's controlling terminal, indexed by job number

JSYS:  The JOBTTY table of the GETAB JSYS gives the same information.



9.10  .GTCNF (GETTAB TABLE 11)

System configuration table, indexed by item number.

Items:

     a.  %CNFG0-CNFG4 -- ASCIZ system name

         JSYS:  The SYSVER table of  the  GETAB  JSYS  gives  the  ASCIZ
         system name.

     b.  %CNDT0-CNDT1 -- ASCIZ system creation date

         JSYS:  The SYSVER table of the GETAB JSYS gives an ASCIZ string
         containing  the system name and creation date.  The BLDTD table
         of the GETAB JSYS gives the system generation date and time.

     c.  %CNTAP -- SIXBIT name of system device

         JSYS:  There is no corresponding TOPS-20  system  device.   For
         most  purposes,  PS:  serves as the system device.  If desired,
         you may use the LNMST JSYS to translate PS:   to  its  original
         definition string.

     d.  %CNTIM -- Time of day in jiffies

         JSYS:  The ODCNV JSYS can return the time of day  milliseconds.
         The  number  of  jiffies  in  a second can be obtained from the
         TICKPS table of the GETAB JSYS.

     e.  %CNDAT -- Date in 15-bit binary format

         JSYS:  ODCNV can return the date in universal time/date format.
         The  GTAD  JSYS  returns  the current date and time in internal
         system format.
OBTAINING MONITOR INFORMATION (GETTAB)                          Page 9-6
.GTCNF (GETTAB TABLE 11)                                       16 Jan 84


     f.  %CNSIZ -- System memory size in words

         JSYS:  The NCPGS table of the GETAB JSYS gives  the  number  of
         pages of real (physical) user core.

     g.  %CNOPR -- SIXBIT name for operator TTY

         JSYS:  The name for the operator TTY is "CTY:", but  note  that
         the  operator  need  not  actually  be  at  that  terminal.  To
         communicate with the operator, a program should use the  PLEASE
         program.

     h.  %CNDEV -- Start of DDB chain

         JSYS:  This is not relevant to TOPS-20.

     i.  %CNSJN -- LH:  Maximum number of high segments.   RH:   Maximum
         number of jobs.

         JSYS:  SYSGT with the table name SNAMES returns the  number  of
         names  of  system  programs.  This is roughly equivalent to the
         TOPS-10 high segment concept.

         SYSGT with the table name JOBNAM returns the maximum number  of
         jobs that the system is configured for.

     j.  %CNTWR -- Two-register hardware and software flag

         JSYS:  No equivalent JSYS information.

     k.  %CNSTS -- Feature test switches

         JSYS:  In many cases there is no equivalent  JSYS  information,
         although  in  some  cases  the  TMON  JSYS  returns  equivalent
         information.

     l.  %CNSER -- APR serial number

         JSYS:  The APRID table of the GETAB JSYS  gives  the  processor
         serial number.

     m.  %CNNSM -- Number of nanoseconds per memory cycle

         JSYS:  This information is not available under TOPS-20.

     n.  %CNPTY -- LH:  Number of first PTY.  RH:   Number  of  PTYs  in
         system.

         JSYS:  The PTYPAR table  of  the  GETAB  JSYS  gives  the  same
         information, but with the halves reversed.

     o.  %CNFRE -- Pointer to bit map of core blocks.
OBTAINING MONITOR INFORMATION (GETTAB)                          Page 9-7
.GTCNF (GETTAB TABLE 11)                                       16 Jan 84


         JSYS:  This is not relevant to TOPS-20.

     p.  %CNLOC -- Address of low-segment core blocks

         JSYS:  This is not relevant to TOPS-20.

     q.  %CNOPL -- Pointer to Line Data Block (LDB) of operator TTY

         JSYS:  This is not relevant to TOPS-20.

     r.  %CNTTF -- Pointer to TTY free chunks

         JSYS:  This is not relevant to TOPS-20.

     s.  %CNLNS -- Pointer to current command TTY

         JSYS:  This information is not available under TOPS-20.

     t.  %CNLNP -- LH:  -(# of  TTY+PTY+CTY  lines).   RH:   Address  of
         LINTAB.

         JSYS:  The PTYPAR table of GETAB  can  give  you  the  terminal
         number  of the first pseudo-terminal (this equals the number of
         terminal lines) and the number of pseudo-terminals.

     u.  %CNVER -- Monitor version number

         JSYS:  The SYSVER table of GETAB returns an ASCIZ string giving
         the monitor name, version and date.

     v.  %CNDSC -- Dataset control table information

         JSYS:  This information is not available under TOPS-20.

     w.  %CNSGT -- Pointer to last dormant segment that was  deleted  to
         free a segment number

         JSYS:  This information is not relevant to TOPS-20.

     x.  %CNPOK -- Last location changed by a POKE. monitor call

         JSYS:  This information is not relevant to TOPS-20.

     y.  %CNPUC -- LH:  Job that made last POKE. RH:   Number  of  POKEs
         made.

         JSYS:  This information is not relevant to TOPS-20.

     z.  %CNWHY -- SIXBIT "reason for last reload"

         JSYS:  This information is not available under TOPS-20.
OBTAINING MONITOR INFORMATION (GETTAB)                          Page 9-8
.GTCNF (GETTAB TABLE 11)                                       16 Jan 84


    aa.  %CNTIC -- Number of clock ticks (jiffies) per second

         JSYS:  The TICKPS table of GETAB returns the same information.

    ab.  %CNPDB -- Pointer to Process Data Block (PDB) pointer tables

         JSYS:  This information is not relevant to TOPS-20.

    ac.  %CNRTC -- Resolution of runtime clock (units/sec)

         JSYS:  This information is not available under TOPS-20.

    ad.  %CNCHN -- Pointer to channel data block

         JSYS:  This information is not relevant to TOPS-20.

    ae.  %CNLMX -- Maximum number of logged-in jobs allowed

         JSYS:  The SYSGT JSYS with table  JOBNAM  returns  the  maximum
         number of jobs that the monitor is built for.

    af.  %CNBMX -- Maximum number of batch jobs allowed

         JSYS:  This information is not available under TOPS-20.

    ag.  %CNBMN -- Minimum number of jobs reserved to batch

         JSYS:  This information is not available under TOPS-20.

    ah.  %CNDTM -- Date/time in universal date/time format

         JSYS:  The GTAD JSYS returns the date  and  time  in  the  same
         format.

    ai.  %CNLNM -- Number of jobs logged in

         JSYS:  The SYSGT JSYS with the JOBNAM table returns the  number
         of  jobs the monitor is built for.  Write a loop with the GETJI
         JSYS for each possible job number, and count the number of jobs
         that are logged in.

    aj.  %CNBNM --Number of batch jobs logged in

         JSYS:  The SYSGT JSYS with the JOBNAM table returns the  number
         of  jobs the monitor is built for.  Write a loop with the GETJI
         JSYS for each possible job number, and test the .JIBCH field of
         the  job information block to count the number of jobs that are
         batch jobs.

    ak.  %CNYER, %CNMON, %CNDAY, %CNHOR, %CNMIN, %CNSEC -- Current year,
         month, day, hour, minute, second.
OBTAINING MONITOR INFORMATION (GETTAB)                          Page 9-9
.GTCNF (GETTAB TABLE 11)                                       16 Jan 84


         JSYS:  The ODCNV JSYS returns this information.

    al.  %CNGMB -- Offset from Greenwich Mean Time

         JSYS:  The ODCNV JSYS returns the offset  for  the  local  time
         zone  in  AC4, field IC%TMZ.  Also, the .SFTMZ function of TMON
         returns the local time zone.

    am.  %CNDBG -- Debug status
        (i)  ST%DBG -- System debugging in progress
       (ii)  ST%RDC -- Reload system on DEBUG stopcode
      (iii)  ST%RJE -- Reload system on JOB stopcode
       (iv)  ST%NAR -- No automatic reloading
        (v)  ST%CP1 -- Stop system if any CPU gets a CPU stopcode


         JSYS:  The DBUGSW table of  the  GETAB  JSYS  gives  equivalent
         information.

    an.  %CNFRU -- Number of free core blocks in use by monitor

         JSYS:  This information is not relevant to TOPS-20.

    ao.  %CNTCM -- Address of last TTY chunk

         JSYS:  This information is not relevant to TOPS-20.

    ap.  %CNCVN -- Customer version number

         JSYS:  The SYSVER  table  of  GETAB  returns  an  ASCIZ  string
         containing the monitor version number.

    aq.  %CNDVN -- DIGITAL version number

         JSYS:  The SYSVER  table  of  GETAB  returns  an  ASCIZ  string
         containing the monitor version number.

    ar.  %CNDFC -- Number of data channels on the system

         JSYS:  This information is not available under TOPS-20.

    as.  %CNRTD -- Number of realtime devices

         JSYS:  This information is not relevant to TOPS-20 because real
         time devices are not supported.

    at.  %CNHPQ -- Number of high priority queues

         JSYS:  This information is not relevant to TOPS-20 because high
         priority  queues  are  not  supported.  However, the SKED% JSYS
         returns information on the scheduler.
OBTAINING MONITOR INFORMATION (GETTAB)                         Page 9-10
.GTCNF (GETTAB TABLE 11)                                       16 Jan 84


    au.  %CNLDB -- TTY device data block  word  pointing  to  line  data
         block

         JSYS:  This information is not relevant to TOPS-20.

    av.  %CNMVO -- Maximum vector offset for PISYS.

         JSYS:  This information is not relevant to TOPS-20.

    aw.  %CNMIP -- Maximum priority for PISYS.

         JSYS:  This information is not relevant to TOPS-20.

    ax.  %CNMER --  LH:   Offset  of  MTA  error  reporting  word.   RH:
         Address of first MTA DDB.

         JSYS:  This information is not relevant to TOPS-20.

    ay.  %CNET1 -- User address of EXEC AC T1 (for DAEMON)

         JSYS:  This information is not relevant to TOPS-20.

    az.  %CNLSD, %CNLLD, %CNLDD -- lengths of device data blocks

         JSYS:  This information is not relevant to TOPS-20.

    ba.  %CNEXM -- Address in JOBDAT of last examine  ("E")  or  deposit
         ("D") command

         JSYS:  This information is not relevant to TOPS-20.

    bb.  %CNST2 -- Software configuration flags

         Bits:

        (i)  ST%MDA -- Mountable device allocation (MDA) being done

             JSYS:  The .SFMTA function of the TMON JSYS returns a value
             indicating whether magtape allocation is enabled.

       (ii)  ST%LSC -- Low segment of monitor is cached

             JSYS:  This information is not relevant to TOPS-20.

      (iii)  ST%SCV -- Account validation

             JSYS:  The .SFAVR function of the  TMON  JSYS  returns  the
             same information.

       (iv)  ST%NER -- 6.03 error reporting

             JSYS:  This information is not relevant to TOPS-20.
OBTAINING MONITOR INFORMATION (GETTAB)                         Page 9-11
.GTCNF (GETTAB TABLE 11)                                       16 Jan 84


        (v)  ST%NCS -- Scheduler is not a class system scheduler

             JSYS:  The SKED% JSYS allows  you  to  test  various  class
             scheduler parameters.

       (vi)  ST%ITA -- Interval timer available

             JSYS:   Under  TOPS-20,  an  interval   timer   is   always
             available.

      (vii)  ST%NDN -- Network device name flag

             JSYS:  This information is not relevant to TOPS-20.

     (viii)  ST%XPI -- PI time excluded from runtime

             JSYS:  This information is not relevant to TOPS-20.

       (ix)  ST%ERT -- EBOX/MBOX runtime (KL10 only)

             JSYS:  The METER% JSYS returns this information.

        (x)  ST%EXE -- .EXE files written by SAVE and SSAVE

             JSYS:  This information is not relevant to TOPS-20.

       (xi)  ST%NJN -- System uses 9-bit job numbers

             JSYS:  This information is not relevant to TOPS-20.

      (xii)  ST%EER -- Extended error reporting

             JSYS:  This information is not relevant to TOPS-20.

     (xiii)  ST%TAP -- TAPSER included in the monitor

             JSYS:  This information is not relevant to TOPS-20.

      (xiv)  ST%MBE -- Massbus error reporting

             JSYS:  This information is not relevant to TOPS-20.

       (xv)  ST%GAL -- GALAXY supported

             JSYS:  GALAXY is always supported.

      (xvi)  ST%ENQ -- ENQ./DEQ.  monitor calls included

             JSYS:  ENQ/DEQ is always supported.

     (xvii)  ST%SHC -- Scheduler is a class type scheduler
OBTAINING MONITOR INFORMATION (GETTAB)                         Page 9-12
.GTCNF (GETTAB TABLE 11)                                       16 Jan 84


             JSYS:  The SKED% JSYS permits you  to  test  various  class
             scheduler parameters.

    (xviii)  ST%NSE -- Nonsuperseding ENTER call

             JSYS:  This information is not relevant to TOPS-20.

      (xix)  ST%MSG -- MPX channels supported

             JSYS:  This information is not relevant to TOPS-20.

       (xx)  ST%PSI -- Software interrupt supported

             JSYS:  Software interrupts are always supported in TOPS-20.

      (xxi)  ST%IPC -- IPCF supported

             JSYS:  IPCF is always supported in TOPS-20.

     (xxii)  ST%VMS -- VMSER included in monitor

             JSYS:  This information is not relevant to TOPS-20, because
             TOPS-20 is always a paging monitor.

    (xxiii)  ST%MER -- Magtape error reporting

             JSYS:  This information is not relevant to TOPS-20.

     (xxiv)  ST%SSP -- Swapping done in page units

             JSYS:  This information is not relevant to TOPS-20, because
             page size is constant in TOPS-20.


    bc.  %CNPIM -- Minimum condition in PISYS.

         JSYS:  This information is not relevant to TOPS-20.

    bd.  %CNPIL -- Length of internal PITs

         JSYS:  This information is not relevant to TOPS-20.

    be.  %CNPIA -- Address of JBTPIA

         JSYS:  This information is not relevant to TOPS-20.

    bf.  %CNMNT -- Monitor type

         JSYS:  The SYSVER  table  of  GETAB  returns  an  ASCIZ  string
         containing the monitor name, date and version number.

    bg.  %CNOCR, %CNOCP -- Card reader/punch DDB information
OBTAINING MONITOR INFORMATION (GETTAB)                         Page 9-13
.GTCNF (GETTAB TABLE 11)                                       16 Jan 84


         JSYS:  This information is not relevant to TOPS-20.

    bh.  %CNPGS -- Unit of core allocation in words

         JSYS:  This information is not relevant to TOPS-20.

    bi.  %CNMMX -- Maximum allowable CORMAX

         JSYS:  This information is not relevant to  TOPS-20.   However,
         the  NCPGS  table  of GETAB returns the number of pages of user
         core available.

    bj.  %CNNSC -- Number of scheduler classes

         JSYS:  To obtain this information,  execute  a  loop  with  the
         .SKSBC  function  code  to  the  SKED%  JSYS,  and  count valid
         scheduler classes.

    bk.  %CNUTF -- Exponential user time factor

         JSYS:  Performance-related information may be obtained from the
         SYSTAB table of GETAB JSYS.

    bl.  %CNHSO -- Address of start of monitor high segment

         JSYS:  This information is not relevant to TOPS-20.

    bm.  %CNHSL -- Length of monitor high segment

         JSYS:  This information is not relevant to TOPS-20.

    bn.  %CNNWC -- Number of words in core -- highest address of on-line
         memory

         JSYS:  The NCPGS table of the GETAB JSYS gives  the  number  of
         pages of real (physical) user core.

    bo.  %CNNXM -- AOBJN pointer to NXMTAB used to scan for zeroes

         JSYS:  This information is not relevant to TOPS-20.

    bp.  %CNNDB -- Address of first network node data block

         JSYS:  This information is not relevant to TOPS-20.

    bq.  %CNTKB -- Offset in MTA KDB of address of DCB

         JSYS:  This information is not relevant to TOPS-20.

    br.  %CNHDL -- Potentially hung device list

         JSYS:  This information is not relevant to TOPS-20.
OBTAINING MONITOR INFORMATION (GETTAB)                         Page 9-14
.GTCNF (GETTAB TABLE 11)                                       16 Jan 84


    bs.  %CNBTX -- Address of reload .CCL text for BOOTS

         JSYS:  This information is not relevant to TOPS-20.

    bt.  %CNTDB -- Offset in MTA UDB of address of DDBs

         JSYS:  This information is not relevant to TOPS-20.

    bu.  %CNMTK -- Address of first MTA KDB in system

         JSYS:  This information is not relevant to TOPS-20.

    bv.  %CNCPU -- Number of CPUs monitor was built for

         JSYS:  A TOPS-20 monitor is always built for a single CPU.

    bw.  %CNDJB -- Byte pointer to jobno in DDB

         JSYS:  This information is not relevant to TOPS-20.

    bx.  %CNSUP -- System uptime

         JSYS:  The same information is returned  (in  milliseconds)  by
         the TIME JSYS.

    by.  %CNBCP -- Bootstrap CPU number

         JSYS:  This information is not  relevant  to  TOPS-20,  because
         TOPS-20 does not support multiple CPUs.

    bz.  %CNBCL -- Bootstrap CTY line number

         JSYS:  This information is not relevant to TOPS-20.

    ca.  %CNNCR -- Number of CPUs allowed to run

         JSYS:  This information is not  relevant  to  TOPS-20,  because
         TOPS-20 does not support multiple CPUs.

    cb.  %CNMBS,  %CNMBF,  %CNMBX,  %CNMBD  --  monitor  bootstrap  file
         specification information

         JSYS:  This information is not relevant to TOPS-20.

    cc.  %CNBPM -- Maximum number of SNOOP. breakpoints allowed

         JSYS:  There is no  limit  to  the  number  of  breakpoints  on
         TOPS-20.

    cd.  %CNMXF -- First free virtual address above the monitor