home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / cpm / pascal-p / ppmanual.pzn / PPMANUAL.PRN
Encoding:
Text File  |  1987-02-03  |  151.0 KB  |  3,744 lines

  1.             
  2.       
  3.       
  4.       
  5.       
  6.             
  7.       
  8.       
  9.       
  10.       
  11.       
  12.       
  13.       
  14.       
  15.       
  16.       
  17.       
  18.       
  19.       
  20.       
  21.       
  22.       
  23.       
  24.       
  25.       
  26.       
  27.       
  28.       
  29.       
  30.       
  31.       
  32.                             ________ ___ ___ ______                            Pascal-P and PCD System 
  33.       
  34.                                _________________                               Referance  Manual 
  35.       
  36.                                  Version 3.1.9 
  37.       
  38.                            Last modified  (87/01/26) 
  39.             
  40.       
  41.       
  42.       Introduction                  Ch. 1-1         Pascal-P Manual v3.1.9 
  43.       
  44.       
  45.         
  46.       
  47.       
  48.       
  49.       
  50.                                    Chapter 1 
  51.       
  52.                                  Introduction 
  53.       
  54.       
  55.       
  56.       This system has been designed for  maximum  "friendliness",  and  to
  57.       avoid  unexpected responses and "surprises".  The interior design is
  58.       highly structured, and easily customizable.  Close adherance to  the
  59.       ISO  standard  (with  slight extension other than available standard
  60.       procedures, all compiler detectable) is  enforced.   The  system  is
  61.       portable to other machines.  
  62.       
  63.       Pascal-P is a modification of the P4 Pascal  compiler  developed  by
  64.       Amman, Nori, and Jacobi at the Institut fur Informatik at the at the 
  65.       Eidg.  Technische Hochschule in Zuerich.  It was adapted for use  on
  66.       the  HP3000  by  Grant  Munsey,  Jeff  Eastman,  and  Bob  Fraley of
  67.       Hewlett-Packard Labs, 3500 Deer Creek Rd, Palo Alto, Calif.   94304.
  68.       It  has  been  further  adapted  for  use with a generalized machine
  69.       independent P-code interpreter, and for 8080 native code generation, 
  70.       by C.B.  Falconer, 680 Hartford Tpk., Hamden, Conn.  06517, USA.  
  71.       
  72.       The  revised  compiler,  interpreter,  standard  procedures,  system
  73.       interfaces,  and  the  present  8080  and P-code code generators (in
  74.       Pascal) are due to C.B.  Falconer, as are any errors therein.  
  75.       
  76.       At  present the system executes on the HP3000 or on CPM systems with
  77.       a minimum of 48k memory (Compilation of the  compiler  requires  63k
  78.       under CPM).  Using the identical compiler it generates code for: 
  79.       
  80.                HP3000 
  81.                P-code interpreter (machine independent) 
  82.                8080 native code 
  83.                                    from  the same source files, controlled
  84.       by various compile time commands.  
  85.       
  86.    |  The  P-code  codefiles  are  executable  under  CPM,  or (unchanged)
  87.    |  without any disc system when interpreters are linked to  appropriate
  88.    |  device  drivers.   Similarly  native code files can be linked to the
  89.    |  same drivers, when maximum speed is required.  Such combinations are 
  90.    |  suitable  for  dedicated systems, and are especially attractive when
  91.    |  accuracy is critical, because of  the  extensive  compile  time  and
  92.    |  run-time error checking available.  In addition such programs can be 
  93.    |  ported  to  wildly  differing  machines  and  CPUs.   Contact   C.B.
  94.    |  Falconer for further information and licensing.  
  95.       
  96.       Such system  features  as  separate  compilation,  i/o  redirection,
  97.       program   segmentation,   virtual  code-memory,  debug  and  tracing
  98.             
  99.       
  100.       
  101.       Introduction                  Ch. 1-2         Pascal-P Manual v3.1.9 
  102.       
  103.       
  104.       capabilities are incorporated.  No distortion of the  Pascal  source
  105.       is required.  Program profiles require the addition of about 6 lines 
  106.       in the source text.  
  107.       
  108.       
  109.                                 Standard Pascal 
  110.       
  111.                 This manual is NOT an exposition of the standard 
  112.                 Pascal   language.   The  recommended  reference
  113.                 manual is  "Programming  in  Pascal",  by  Peter
  114.                 Grogono.   Further useful references are "Pascal
  115.                 User Manual and Report", by  Jensen  and  Wirth,
  116.                 and  the  ANSI and ISO standards (which are hard
  117.                 reading).  
  118.       
  119.                 This  system  implements  ISO  and ANSI standard
  120.                 Pascal, except for GOTO out of  procedures,  and
  121.                 passing procedures/functions as parameters.  
  122.       
  123.       A fairly extensive set of utilities are available,  all  written  in
  124.    |  Pascal, including various non-portable CPM system programs.  
  125.    |  
  126.    |     . UCSTOCPM which transfers UCSD Pascal text files to the CPM 
  127.    |       system.  
  128.    |  
  129.    |     . DISKCOPY which makes complete copies of floppy disks).  
  130.    |  
  131.    |     . TRANSFER which copies files to and  from  MS/PCDOS  format
  132.    |       disks.  
  133.    |  
  134.    |     . ANSWER, BYE, ENDCALL which implement a  remote  controlled
  135.    |       RCPM  system,  and which can automatically limit execution
  136.    |       to a user defined program.  
  137.    |  
  138.    |  
  139.    |     . programs from PUG (Pascal Users Group) such as..  
  140.    |  
  141.    |     . COMPARE which compares text files and resynchronizes after 
  142.    |       differences.  
  143.    |  
  144.    |     . REFRENCE  which  shows  Pascal   program   structure   and
  145.    |       procedure referances.  
  146.    |  
  147.    |     . ID2ID which replaces identifier names from a list.  
  148.    |  
  149.    |  
  150.    |     . portable programs such as..  
  151.    |  
  152.    |     . RNF, the text formatter which prepared this manual.  
  153.    |  
  154.    |        
  155.       
  156.       
  157.       Introduction                  Ch. 1-3         Pascal-P Manual v3.1.9 
  158.       
  159.       
  160.    |     . BINHEX which converts binary files  to  Intel  hex  format
  161.    |       records.  
  162.    |  
  163.    |     . PAGER which paginates, labels and dates listings.  
  164.    |  
  165.    |     . FILEDUMP which lists binary files in hex notation.  
  166.    |  
  167.    |     . PLOTPROF which plots profiles of program execution.  
  168.    |  
  169.    |     . XREF which prepares a cross-referance of Pascal programs.  
  170.    |  
  171.    |     . PCDISASM which dis-assembles "pcd" codefiles.  
  172.    |  
  173.    |     . WSTOTEXT  which  converts  WordStar  document  files  into
  174.    |       standard formats.  
  175.    |  
  176.    |     . LDIR which list library directories, including datestamps 
  177.    |  
  178.    |     . LSETDATE which sets datestamps in LU format libraries.  
  179.    |  
  180.    |     . XREFC which cross-references C programs.  
  181.    |  
  182.    |     . XREFASM  which  cross-references  assembly  programs,  and
  183.    |       adapts   to   various   machines  with  an  external  file
  184.    |       (available for 8080, Z80, 8086) 
  185.    |  
  186.    |  
  187.    |     . system programs such as..  
  188.    |  
  189.    |     . ASSMPCD, the .PCD code generator 
  190.    |  
  191.    |     . ASSMAP, the native code generator 
  192.    |  
  193.    |     . TUNE, which dynamically configures code/data  space  usage
  194.    |       in .PCD programs.  
  195.    |  
  196.    |     . LINKER, a machine independant linker, incidentally used to 
  197.    |       link  .RBM  (relocatable  binary  modules)  into .PCD code
  198.    |       files.  
  199.    |  
  200.       
  201.       This  manual  was  written  on  a  wide  variety of text editors and
  202.       finally printed by RNF, a  text  formatter  analogous  to  the  Unix
  203.       Runoff,  and  written  in  Pascal.   (The  original author of RNF is
  204.       unknown).  
  205.       
  206.       P-code  codefiles  can  be  as large as 127 (31 under CPM) segments,
  207.       each containing a maximum of 127  procedures  in  a  maximum  of  32
  208.       Kbytes   of  code.   Thus  the  absolute  maximum  program  file  is
  209.       approximately 4 megabytes (992  kbytes  under  CPM).   This  permits
  210.       large   application   systems   to   be  created  and  automatically
  211.       manipulated  by  the  run-time  memory   management   system.    For
  212.    |  comparison the compiler occupies less than 42 Kbytes in 28 segments, 
  213.    |        
  214.       
  215.       
  216.       Introduction                  Ch. 1-4         Pascal-P Manual v3.1.9 
  217.       
  218.       
  219.    |  and can execute in approximately 6K of  codespace.   Virtually  full
  220.    |  compilation  speed  is  attained  in  approximately 20K of codespace
  221.       under CPM.  
  222.       
  223.       Codefiles are automatically searched over two disks, and one library 
  224.       file under CPM.  Since  P-code  utilities  tend  to  be  small,  the
  225.       library  system  provides  significant  improvement  in  disk  space
  226.       utilization by eliminating allocation fragmentation.  This can  have
  227.       dramatic  effects when the disk allocation unit is large, e.g.  hard
  228.       disks with a 4 kilobyte allocation unit.  The use  of  library  code
  229.       files   under   CPM  has  the  additional  advantage  of  permitting
  230.       date-stamping.  Upgraded programs may be  tested  without  affecting
  231.       the original, since the search order prefers a file.  
  232.       
  233.       PCD codefiles may optionally be segmented and execute in  a  virtual
  234.       memory  space.   The  run-time system automatically performs segment
  235.       loading and unloading on demand, and chooses segments for discard on 
  236.       a  least-recently-used  algorithm.   Program  files  can specify the
  237.       amount of real memory to be allocated for code loading.  All code is 
  238.       read  directly  from  diskfiles,  and is always re-entrant and pure.
  239.       Thus no additional disk space  need  be  allocated  to  the  virtual
  240.       memory system.  
  241.             
  242.       
  243.       
  244.       Getting Started               Ch. 2-1         Pascal-P Manual v3.1.9 
  245.       
  246.       
  247.         
  248.       
  249.       
  250.       
  251.       
  252.                                    Chapter 2 
  253.       
  254.                                 Getting Started 
  255.       
  256.       
  257.       
  258.       
  259.       
  260.                                   CPM version 
  261.       
  262.                 This  chapter is directed towards CPM 2.2 users.
  263.                 Other systems must  make  slight  modifications,
  264.                 especially MS/PCDOS users.  
  265.       
  266.       
  267.       
  268.       2.1  Files needed.  
  269.       
  270.       To compile and execute Pascal programs you should have available: 
  271.       
  272.       
  273.            1.  RUNPCD.COM   (and   possibly   RUNPCDI.COM).    These   are
  274.                distributed  as  INTERP.COM  and  INTERPI.COM,  and  may be
  275.                renamed as is, or customized for access to system timers.  
  276.       
  277.            2.  PASCALP.PCD, the compiler 
  278.       
  279.            3.  either ASSMPCD.COM or ASSMPCD.PCD.   The  .PCD  version  is
  280.                much more compact, but significantly slower in execution.  
  281.       
  282.            4.  (optional) EF (no extension).  The error messages file  for
  283.                compilation.  
  284.       
  285.            5.  (optional)  PCDHELP.PCD,  which  is  executed   by   RUNPCD
  286.                whenever  no  code  file  is specified.  This gives on-line
  287.                information.  
  288.       
  289.            6.  Your favorite text editor.  
  290.       
  291.       
  292.       For .COM file generation under CPM you will also need: 
  293.       
  294.       
  295.            1.  SLRMAC.COM from SLR systems (Z80ASM may also be used).  
  296.       
  297.            2.  SLRNK.COM from SLR systems 
  298.       
  299.            3.  PASCLIB.SLR.  The run-time library.  
  300.       
  301.             
  302.       
  303.       
  304.       Getting Started               Ch. 2-2         Pascal-P Manual v3.1.9 
  305.       
  306.       
  307.            4.  CPMLINK.SLR.  The master interface to CPM 
  308.       
  309.            5.  (optional) HEAPMARK.SLR (allows reduced object size when no 
  310.                use of the DISPOSE procedure is made).  
  311.       
  312.            6.  (optional)  ERRMSGL.SLR  (allows  more  elaborate  run-time
  313.                error messages.  The "L" stands for long.)  
  314.       
  315.       Also recommended, for convenience: 
  316.       
  317.            1.  JOB.COM.  The improved replacement for SUBMIT.  
  318.       
  319.            2.  JOBS.LBR    (or    extractions    of   COMPILE.JOB   and/or
  320.                PASCPREP.JOB) to allow single command compilation.  
  321.       
  322.       
  323.                             ASSMPCD and ASSMAP.COM 
  324.       
  325.                 If you use these rather than the  .PCD  versions
  326.                 simply omit the "runpcd " prefix for them in the 
  327.                 following.  
  328.       
  329.       
  330.       
  331.       2.2  Creating .PCD programs 
  332.       
  333.       To compile the source program YOURPROG.PAS to a .PCD file, do: 
  334.       
  335.                runpcd pascalp (yourprog.pas, con, yourprog.tic) 
  336.       
  337.       where  "con"  (the  console)  will  receive  the  list   file,   and
  338.       "yourprog.tic"  will  receive  the  temporary intermediate code.  At
  339.       completion enter: 
  340.       
  341.                runpcd assmpcd (yourprog.tic,yourprog.pcd) 
  342.       
  343.       If JOB.COM and COMPILE.JOB  are  available  (COMPILE.JOB  may  be  a
  344.       component of JOBS.LBR) this can all be simplified to: 
  345.       
  346.                job compile yourprog 
  347.       
  348.       At completion YOURPROG.TIC may be erased.  To then execute yourprog, 
  349.       enter: 
  350.       
  351.                runpcd yourprog 
  352.       
  353.       
  354.             
  355.       
  356.       
  357.       Getting Started               Ch. 2-3         Pascal-P Manual v3.1.9 
  358.       
  359.       
  360.       2.3  Creating .COM programs 
  361.       
  362.       To compile the source program YOURPROG.PAS to a .COM file, do: 
  363.       
  364.                runpcd pascalp (yourprog.pas, con, yourprog.tic) 
  365.       
  366.       just as for a .PCD file.  If you have saved the  .TIC  file  from  a
  367.       previous compilation (above) this step can be eliminated.  
  368.       
  369.                runpcd assmap (yourprog.tic, yourprog.mac) 
  370.       
  371.       Again,  at completion YOURPROG.TIC may be erased, unless required to
  372.       create a .PCD executable file.  If you are going to  use  Z80ASM  in
  373.       place of SLRMAC add "[64]" to the above command line, replace ".mac" 
  374.       with ".z80", and replace "slrmac" with  "z80asm"  in  the  following
  375.       step.   The  resultant  intermediate  source  file will be about 10%
  376.       larger, but the final code will be unchanged.  
  377.       
  378.                slrmac yourprog.@@z/rf 
  379.       
  380.       will assemble the .MAC source file.  At completion YOURPROG.SLR will 
  381.       have  been  created, and the .MAC file is no longer needed.  (If you
  382.       have not configured SLRMAC to use the  .SLR  extension,  change  the
  383.       extension accordingly) 
  384.       
  385.                slrnk /a:100,cpmlink,yourprog,pasclib/s,yourprog/n,/e 
  386.       
  387.       will do the complete linking, and leave you with YOURPROG.COM.  
  388.       
  389.       Again, if JOB.COM and PASCPREP.JOB are available  (PASCPREP.JOB  may
  390.       be a component of JOBS.LBR) this can be simplified to: 
  391.       
  392.                job pascprep yourprog 
  393.       
  394.       YOURPROG can then be executed just like any other program.  
  395.       
  396.       
  397.       
  398.       
  399.       2.4  Using PCDS.LBR 
  400.       
  401.       Any  .PCD  file  may be stored in PCDS.LBR, and RUNPCD will find and
  402.       load it whenever no file.PCD is found.  Since .PCD files tend to  be
  403.       small, this can result in significant savings in disk storage.  
  404.       
  405.             
  406.       
  407.       
  408.       Getting Started               Ch. 2-4         Pascal-P Manual v3.1.9 
  409.       
  410.       
  411.       2.5  Connecting files to programs 
  412.       
  413.       The standard input and output may always be redirected by  including
  414.       ">outputfile" and/or "<inputfile" on the command line.  This applies 
  415.       to both .COM and .PCD programs.  Other external  files  should  have
  416.       been  described in the program header line, and are simply described
  417.       as  parameters  to  the  program  by  suitable  replacements  within
  418.       parenthesis  in  the  command  line.   Any  unspecified file will be
  419.       attached to the default name, which is the name used in  the  source
  420.       program,  with  no extension.  The standard input and output must be
  421.       text files, but other files may be of any type.  
  422.       
  423.       Standard device file names available (on CPM) are: 
  424.       
  425.            1.  CON the console for output, keyboard for input.  Lines  are
  426.                buffered and input lines can be edited.  
  427.       
  428.            2.  KBD  The  console  for  output,  keyboard  for  input.   No
  429.                buffering.  
  430.       
  431.            3.  RDR The system RDR: device.  Input lines are buffered,  but
  432.                may not be edited.  
  433.       
  434.            4.  PUN The system PUN: device.  No buffering.  
  435.       
  436.            5.  LST The system LST: device.  No buffering.  
  437.       
  438.            6.  AUX The system RDR: device, no input buffering.  
  439.                All these file are textfiles.  
  440.       
  441.       
  442.       
  443.       2.6  Using CCP+ (and possibly DOS+) 
  444.       
  445.       If   you   have   installed  CCP+  in  your  system,  together  with
  446.       CCPXTEND.SYS, you can omit the "runpcd" prefixes.  The  system  will
  447.       automatically execute RUNPCD if no .COM file is found.  
  448.       
  449.       
  450.             
  451.       
  452.       
  453.       Program File Preparation      Ch. 3-1         Pascal-P Manual v3.1.9 
  454.       
  455.       
  456.         
  457.       
  458.       
  459.       
  460.       
  461.                                    Chapter 3 
  462.       
  463.                            Program File Preparation 
  464.       
  465.       
  466.       
  467.       
  468.       
  469.       
  470.       3.1  Line Numbers and Line Length 
  471.       
  472.    |  Source  files  for  Pascal-P are normally variable line length Ascii
  473.    |  files, with  or  without  FRONT  numbering  (described  below).   By
  474.       default  any characters past the first 80 of a line are ignored, and
  475.       treated as comments.  
  476.       
  477.       Source lines containing an initial string of 8 digits are treated as 
  478.       numbered, and  the  line  numbers  retained  and  processed  by  the
  479.       compiler.   These 8 digits are not included in the 80 (or other, see
  480.       w compiler option) character line length limitation.   The  compiler
  481.       assigns  sequential  line  numbers  to  un-numbered  source (but see
  482.       $include below).  
  483.       
  484.       
  485.       
  486.       
  487.       3.2  Indentation coding 
  488.       
  489.       Source files may use data compression for indentation, consisting of 
  490.       an  initial  "DLE"  (chr(16))  followed  by  the  printing character
  491.       chr(ord(' ') + indentationcount).  This both compresses source  code
  492.       storage,  and  speeds  up  compilation  by  eliminating  scanning of
  493.       unnecessary blanks.  The utility programs  "EXPAND"  and  "COMPRESS"
  494.       can  be  used  to  control  this  formatting.  The above line length
  495.       limitation applies to the expanded source line.  
  496.       
  497.       
  498.       
  499.       
  500.       3.3  Comments 
  501.       
  502.       Comments follow the standard Pascal conventions using either (*  and
  503.       *) or { and } as delimiters.  Note that "(*" cannot be terminated by 
  504.       "}", nor can "{" be  terminated  by  "*)".   This  is  a  deliberate
  505.       deviation from the ISO standard.  
  506.       
  507.             
  508.       
  509.       
  510.       Program File Preparation      Ch. 3-2         Pascal-P Manual v3.1.9 
  511.       
  512.       
  513.       3.4  File inclusion 
  514.       
  515.       A line beginning (at the extreme left, apart from line number)  with
  516.       "$include   filename"  causes  that  file  to  be  included  in  the
  517.       compilation at that point.  The remainder of the line is listed  but
  518.       ignored.   If  the  included file is unnumbered further line numbers
  519.       are assigned at the next multiple of 1000 plus 1.  
  520.       
  521.       The  "i"  compiler  option,  (See  compiler options) avoids the line
  522.       number control and may be combined with other options  on  the  same
  523.       line.  
  524.       
  525.       At present the master file and  two  (2)  levels  of  inclusion  are
  526.       available.  
  527.       
  528.       
  529.       
  530.       
  531.       3.5  Characters and Identifiers 
  532.       
  533.       The  compiler  recognizes  both UPPER and lower case letters.  A tab
  534.    |  character is treated as a space, but listed as a tab char.  A tab is 
  535.    |  considered  a  single  character  in  evaluating  line  length.  The
  536.       compiler considers names which differ only in the case of letters to 
  537.       be  identical.   The  underbar  character  "_"  is  considered to be
  538.       alphabetic in names.  Only the  first  8  characters  of  names  are
  539.       significant, although reserved words are checked for exact spelling. 
  540.       Thus "procedur" and "procedure" are  distinct,  but  "procedur"  and
  541.       "procedures"  are  not distinct.  The 8 character names are retained
  542.       throughout any linking/loading processes which may follow.   However
  543.       non-global  procedures  use  compiler  assigned unique names, rather
  544.       than user names, thus avoiding  name  collisions  in  any  following
  545.       assembly and linkage operations.  
  546.       
  547.       
  548.       
  549.       
  550.       3.6  Integers and Sets 
  551.       
  552.       Integers  are currently limited to the range -32768..32767, although
  553.       32768 may not be used as a constant in a source program.   Sets  are
  554.       limited  to  the  range  0..127.   This  allows  the  complete ASCII
  555.       character set.  
  556.       
  557.       
  558.       
  559.       
  560.       3.7  Editors 
  561.       
  562.       The CP/m based systems are completely compatible with  source  files
  563.    |  prepared  by  most  editors  (but  do not use Wordstar under the "D"
  564.    |  option, use the "N" option), and with files prepared by the  various
  565.       UCSD  editors.   The  significant  line termination character is the
  566.             
  567.       
  568.       
  569.       Program File Preparation      Ch. 3-3         Pascal-P Manual v3.1.9 
  570.       
  571.       
  572.       <CR>, and <LF> is ignored.  Line indentation coding is identical  to
  573.       that  of the UCSD system, but is controlled by application programs,
  574.       and thus not forced.  Note that  source  files  must  not  have  the
  575.       eighth  bit  set  in  characters,  and must not contain non-printing
  576.       characters outside of dle, cr, lf and tab.  
  577.       
  578.                                     CAUTION 
  579.       
  580.                 For efficiency reasons the  compiler  (and  many
  581.                 other  utilities)  do  not  check for EOF except
  582.                 after EOLN.   Files  with  EOF  in  unterminated
  583.                 lines  are  illegal  according  to  the  various
  584.                 Pascal  standards,  and  will   cause   run-time
  585.                 errors.   Thus  source  files  should  always be
  586.                 terminated by  a  final  end-of-line.   WordStar
  587.                 users  should  especially  note  this,  and  not
  588.                 inject a final space.  
  589.             
  590.       
  591.       
  592.       Compiler Switches & Options   Ch. 4-1         Pascal-P Manual v3.1.9 
  593.       
  594.       
  595.         
  596.       
  597.       
  598.       
  599.       
  600.                                    Chapter 4 
  601.       
  602.                           Compiler Switches & Options 
  603.       
  604.       
  605.       
  606.       Pascal-P recognizes commands placed in "pseudo-comments" of the form 
  607.       (*$...*) or  {$...}.   Options  are  separated  by  commas  with  no
  608.       intervening spaces.  Unrecognized options will generate a warning.  
  609.       
  610.       Compiler options never affect the sense of the compiled program, but 
  611.       may alter the run-time environment.  
  612.       
  613.       The following options are available (* marks defaults): 
  614.       
  615.           @nnnn     (nnnn is an unsigned integer) Sets initial  value
  616.                     for   compiler   generated   labels.   Used  with
  617.                     separate compilations so that internal  procedure
  618.                     names are unique to segments.  Default 0.  Misuse 
  619.                     can   cause   unusable   code.    Always   assign
  620.                     increasing values, and allow for usage in earlier 
  621.                     modules.  
  622.       
  623.       
  624.           B+      * (default).  Assign normal file buffer space.  
  625.       
  626.           B-        Assign no file buffer space beyond that  required
  627.                     for  file  flags and access to f^.  Normally used
  628.                     only with 8080 and P-code interpreter systems for 
  629.                     device files which are accessed directly.  
  630.       
  631.           Bnnn      nnn is an unsigned integer.  Assign nnn units  of
  632.                     file   buffer  space.   Useful  for  special  i/o
  633.                     drivers.  Note  that  this  option  takes  effect
  634.                     during the file type definition.  
  635.       
  636.       
  637.           C+      * (default).  Emit object code.  
  638.       
  639.           C-        No object code.  Useful for source syntax checks.  
  640.       
  641.       
  642.           D+      * (default) Emit run-time checks.  
  643.       
  644.           D-        No run-time checks.  
  645.       
  646.       
  647.             
  648.       
  649.       
  650.       Compiler Switches & Options   Ch. 4-2         Pascal-P Manual v3.1.9 
  651.       
  652.       
  653.           E+        Listing page eject.  
  654.       
  655.           E-        Ignored.  
  656.       
  657.       
  658.           H+        Accept  extensions  which  allow  compilation  of
  659.                     source  for Per Brinch Hansens Solo system.  Also
  660.                     sets the S- option, see below.  In this mode  the
  661.                     " is recognized as a comment delimiter (start and 
  662.                     end), VAR, CONST and  TYPE  declarations  may  be
  663.                     intermixed  and  "local"  global variables may be
  664.                     declared (invisible to earlier  portions  of  the
  665.                     source  file),  "OR"  may be used in place of "+"
  666.                     for set union,  and  characters  may  be  defined
  667.                     within  strings by (:nn:) where nn is the ordinal
  668.                     value of the character.  All but  "(:nn:)  within
  669.                     strings  and the "local module" VARS are normally
  670.                     executed with warnings in other modes.  
  671.       
  672.           H-      * (default) Reject the above  extensions.   If  the
  673.                     system  was  in  the H+ or S- modes it is left in
  674.                     the S- mode.  
  675.       
  676.       
  677.           I'filename' A second  method  for  including  other  source
  678.                     files.   This  can appear with other options in a
  679.                     single line (which must contain the *) or } char- 
  680.                     acters).    This  mode  avoids  the  line  number
  681.                     setting to a multiple of  1000  mentioned  above,
  682.                     and   will   not   be   tracked   by   the   XREF
  683.                     cross-referencer program unless  the  appropriate
  684.                     option bits are set.  
  685.       
  686.       
  687.           L+      * (default).  Generate a listing file.  
  688.       
  689.           L-        suppress listing until an L+ command encountered.  
  690.       
  691.       
  692.           N+      * (default).  Emit source line  numbers  in  object
  693.                     code.  
  694.       
  695.           N-        No tracing line numbers.  
  696.       
  697.       
  698.           P+      * (default).  Allow use of nonstandard std procs.  
  699.       
  700.           P-        Warnings  whenever  any  non-standard   "standard
  701.                     Procedure" encountered.  
  702.       
  703.       
  704.             
  705.       
  706.       
  707.       Compiler Switches & Options   Ch. 4-3         Pascal-P Manual v3.1.9 
  708.       
  709.       
  710.           S+      * (default) Warnings and/or  errors  signalled  for
  711.                     any  use  of nonstandard Pascal features, but not
  712.                     including   use    of    nonstandard    "standard
  713.                     procedures".  
  714.       
  715.           S-        enables  use  of  nonstandard   Pascal   features
  716.                     including  definition  of  character constants by
  717.                     (:nn:), where nn is  the  ordinal  value  of  the
  718.                     character,   use   of   the  substring  construct
  719.                     ARRAY[VAR FOR CONST], use of the second parameter 
  720.                     in  reset/rewrite  and equivalent procedures, use
  721.                     of "OTHERWISE" in case statements.  
  722.       
  723.           S'segmentname' Controls segmentation of the generated code. 
  724.                     Must appear outside the BEGIN END; of a procedure 
  725.                     and before the BEGIN of the main program block.  
  726.       
  727.       
  728.           T+        Print   compiler   internal    tables,    showing
  729.                     variables, types, etc.  
  730.       
  731.           T-      * (default) Suppress table printing.  
  732.       
  733.       
  734.           W+      * (default) Truncate input source at 80 characters.  
  735.       
  736.           W-        Truncate input source at 72 characters 
  737.       
  738.           Wnnn      (nnn is an  unsigned  integer).   Truncate  input
  739.                     source at nnn characters.  nnn <= 108.  
  740.       
  741.       
  742.           X+        save option setting for future restoration.  This 
  743.                     allows modules to set options as desired, without 
  744.                     affecting option settings for the including text.  
  745.       
  746.           X-        restore option  setting  saved  by  previous  X+.
  747.                     Note that only one level of storage is available. 
  748.                     An X- without a preceding X+ restores the default 
  749.                     settings.  
  750.       
  751.       
  752.           Y+        Not for user use.   Enables  ic  listing  on  prr
  753.                     file,  and  renders  that  file unusable for code
  754.                     generation.  For compiler debugging only.  
  755.       
  756.           Y-      * (default).  Normal compiler operation.  
  757.       
  758.       
  759.           Z+        Not for  user  use.   Controls  phase-in  of  new
  760.                     features,  which  may vary or be nonexistent, and
  761.                     may not work.  
  762.       
  763.             
  764.       
  765.       
  766.       Compiler Switches & Options   Ch. 4-4         Pascal-P Manual v3.1.9 
  767.       
  768.       
  769.           Z-      *  (default).   Undocumented  features  etc.    are
  770.                     disabled.  
  771.       
  772.       
  773.           ^+        As T+, except that pointer  variables  and  types
  774.                     are traced through all nesting levels.  
  775.       
  776.           ^-      * (default) No effect unless ^+ was in effect, when 
  777.                     effectively sets T+ option.  
  778.             
  779.       
  780.       
  781.       The Translation Process       Ch. 5-1         Pascal-P Manual v3.1.9 
  782.       
  783.       
  784.         
  785.       
  786.       
  787.       
  788.       
  789.                                    Chapter 5 
  790.       
  791.                             The Translation Process 
  792.       
  793.       
  794.       
  795.       
  796.       
  797.       
  798.       5.1  Translation Steps 
  799.       
  800.       Pascal  source  programs are translated into runable programs in two
  801.       or more steps shown schematically below (The PCODE is  legible  text
  802.       in a .TIC file): 
  803.       
  804.       PCD interpreters (no intrinsic procedures or segmentation): 
  805.        
  806.          SOURCE----->PCODE----->PCD=PROGRAM 
  807.                  !          ! 
  808.               PASCALP    ASSMPCD 
  809.        
  810.       PCD interpreters (intrinsic procedures or segmented): 
  811.        
  812.          SOURCE----->PCODE----->RBMFILE(s)----->PCD=PROGRAM 
  813.                  !          !               ! 
  814.               PASCALP    ASSMPCD          LINKER 
  815.        
  816.       8080 Native code: 
  817.        
  818.                                           LIBRARY----\ 
  819.          SOURCE----->PCODE----->ASSY------>SLRFILE------>PROGRAM 
  820.                  !          !          !             ! 
  821.               PASCALP    ASSMAP      SLRMAC        SLRNK 
  822.        
  823.       HP3000 (native code): 
  824.        
  825.          SOURCE----->PCODE----->SPL----->USL----->PROGRAM 
  826.                  !          !        !        ! 
  827.               PASCALP    ASSMSPL    SPL    SEGMENTER 
  828.        
  829.       
  830.                                  On File Sizes 
  831.       
  832.                 You can expect .TIC files to be roughly the same 
  833.                 size  as  the  Pascal  source  files.   For .COM
  834.                 generation the .MAC file will usually be about 3 
  835.                 to 4 times the size of the .TIC file.  
  836.       
  837.             
  838.       
  839.       
  840.       The Translation Process       Ch. 5-2         Pascal-P Manual v3.1.9 
  841.       
  842.       
  843.    |  5.2  The Compiler Header, showing files used 
  844.    |  
  845.    |  PASCALP (source, list,prr, ef, input, output) [parm] 
  846.       
  847.       PascalP   may   be  operated  directly  by  making  the  appropriate
  848.       substitutions in the program header.   The  pre-defined  jobs  below
  849.    |  combine  compiler  and  assembly execution into one command, and are
  850.       normally most convenient.   A  useful  specification  of  source  is
  851.       "CON",  which  allows  entry  of  options  and inclusion of the main
  852.       program, for example: 
  853.       
  854.                (*$n-,d-,i'yourprog.pas'*) 
  855.       
  856.       to  suppress  line  numbers  and  run-time  checks  when   compiling
  857.       "yourprog.pas".  This type of operation avoids any editing of source 
  858.       files.  See the "x" option under Compiler Switches, for a  mechanism
  859.       to  set  options  in  specific  program  areas without affecting the
  860.       overall option settings.  Similar "stub" files may  be  defined  for
  861.       convenient compilation with various modes set.  
  862.       
  863.       
  864.       
  865.       
  866.       5.3  Pre-defined Jobs 
  867.       
  868.    |  Under CPM the submit files COMPILE.JOB, PASCPCD.JOB and PASCPREP.JOB 
  869.    |  capture the complete (compilation assembly linkage) process into one 
  870.    |  command.  COMPILE.JOB simplifies entry to one filename.  
  871.       
  872.       
  873.                                      NOTE 
  874.       
  875.                 "JOB"  is  similar  to the standard CPM "SUBMIT"
  876.                 utility, but  allows  nested  jobs,  interactive
  877.                 entry,   execution   with   any   default  drive
  878.                 assignments,    specification     of     default
  879.                 parameters,   uses  the  comma  as  a  parameter
  880.                 delimiter,   and    allows    "quoted    string"
  881.                 parameters.  It will also perform the same drive 
  882.                 searches as the overall Pascal file system.   It
  883.                 is an enhancement of "SUPERSUB".  
  884.       
  885.       
  886.       
  887.       5.4  Compilation Commands 
  888.       
  889.       Using  the  supplied programs and job streams simplified compilation
  890.       commands are available.  
  891.             
  892.       
  893.       
  894.       The Translation Process       Ch. 5-3         Pascal-P Manual v3.1.9 
  895.       
  896.       
  897.       5.4.1  CPM: Typical commands are: 
  898.       
  899.                A>JOB PASCPCD source list object scratch 
  900.       
  901.                          (where scratch and object may be identical) 
  902.       or 
  903.                A>JOB COMPILE source    <<with no extension>> 
  904.       
  905.       
  906.       
  907.       
  908.       5.5  Options 
  909.       
  910.    |  A number of options have  been  added  to  control  the  compilation
  911.    |  process.  These options are specified by PARM values in the command. 
  912.       Multiple options  may  be  specified  by  adding  the  corresponding
  913.       values.   (Under  CPM  parm is a number enclosed by "[]" outside the
  914.       fileparameter section of the command line.)  
  915.       
  916.           PARM      Meaning 
  917.       
  918.           2         Generate procedure tracing code 
  919.       
  920.           4         Continue after compiler errors/warnings 
  921.       
  922.           8         Cross-compile (16  bit  on  8  or  8  on  16  bit
  923.                     machines) 
  924.       
  925.       
  926.       
  927.       
  928.       5.5.1  Under CPM 
  929.       
  930.       If  no  "8" bit is set code for an 8 bit machine (Pcd interpreter or
  931.       8080 native code) is generated.  The following apply: 
  932.       
  933.           16        Force a relocatable  PCD  file.   (Programs  with
  934.                     neither  intrinsics,  externals, nor segmentation
  935.                     will normally generate an  executable  PCD  file,
  936.                     which cannot be linked to external procedures.  
  937.       
  938.           64        For  .PCD  generation,   over-ride   segmentation
  939.                     commands and force generation of a single segment 
  940.                     code  file.   For  .COM  generation,  cause   the
  941.                     intermediate assembly source file to be generated 
  942.                     in Zilog  rather  than  Intel  mnemnonics.   This
  943.                     increases the file size by about 10%.  
  944.       
  945.           128       Echo the compiler listing on the  TIC  (temporary
  946.                     intermediate  code)  file  for subsequent listing
  947.                     during the assembly phase.  This  option  greatly
  948.                     enlarges  the  TIC  file  size.   If converted to
  949.                     executable PCD via ASSMPCD a complete listing can 
  950.             
  951.       
  952.       
  953.       The Translation Process       Ch. 5-4         Pascal-P Manual v3.1.9 
  954.       
  955.       
  956.                     be  extracted  on  "codelist"  file.  See the job
  957.                     file  PASCPCD.JOB,  which  installs   all   these
  958.                     options.   Similarly,  if  converted  to assembly
  959.                     source  with  ASSMAP,  the  original  compilation
  960.                     listing appears as comments.  
  961.       
  962.    |  
  963.    |  
  964.    |  
  965.    |  5.5.2  Under other systems (e.g.  HP3000) 
  966.    |  
  967.    |  Slightly different conventions apply.  Omitted from this manual.  
  968.       
  969.       
  970.       
  971.       5.5.3  Procedure Tracing 
  972.       
  973.       Compiled   programs   normally  do  not  contain  procedure  tracing
  974.       messages.  If procedure tracing is desired use the "2"  bit  option,
  975.       and  run  the program with an odd value of PARM specified.  Messages
  976.       of the form "ENTER procedurename" and "EXIT procedurename"  will  be
  977.    |  generated  automatically.   At  present  this feature is suppressed,
  978.    |  because most systems cannot conveniently supply sense  switches  for
  979.    |  control,  however  custom  interpreters can be supplied which enable
  980.    |  the feature.  The messages  are  indented  to  reflect  the  dynamic
  981.       procedure  level.   Therefore messages from recursive procedures may
  982.       disappear to the right.  
  983.       
  984.       
  985.       
  986.       
  987.       
  988.       5.5.4  Where options take effect 
  989.       
  990.       Of the above "bit" options, only the 4, 8 and 128 bits (no error job 
  991.       aborts,  byte  object  machine, and echo listing on P-Code file) are
  992.       directly implemented on the compiler.   The  remaining  options  are
  993.       passed to the various assembly programs which generate final code.  
  994.       
  995.       
  996.                              Microsoft .REL format 
  997.       
  998.                 While  it  is possible to use this format, it is
  999.                 not supported because a: Names are limited to  6
  1000.                 characters,  and  extremely confusing errors can
  1001.                 result  from  name  collisions;  b:  The   LIB80
  1002.                 program  is  unreliable,  and  loses portions of
  1003.                 large  libraries,  thus  making  maintenance  of
  1004.                 PASCLIB.REL impracticable.  
  1005.       
  1006.                 SLR Systems  format  and  librarian  avoids  all
  1007.                 these   problems,   and  is  also  an  order  of
  1008.                 magnitude   faster.    Unfortunately   the   SLR
  1009.             
  1010.       
  1011.       
  1012.       The Translation Process       Ch. 5-5         Pascal-P Manual v3.1.9 
  1013.       
  1014.       
  1015.                 programs  will only execute under Z80 processors
  1016.                 (while the  PascalP  system  can  execute  under
  1017.                 8080, 8085, and v20 processors).  
  1018.             
  1019.       
  1020.       
  1021.       Compiler Error Messages       Ch. 6-1         Pascal-P Manual v3.1.9 
  1022.       
  1023.       
  1024.         
  1025.       
  1026.       
  1027.       
  1028.       
  1029.                                    Chapter 6 
  1030.       
  1031.                             Compiler Error Messages 
  1032.       
  1033.       
  1034.       
  1035.       
  1036.       
  1037.       
  1038.       6.1  General 
  1039.       
  1040.       The  compiler  produces  error  codes,  and  lists  them  after  the
  1041.       offending line on both output and pasclist formal files.  If the  L-
  1042.       option  is  in  effect  output  to  pasclist  is suppressed.  If the
  1043.       translation  file  (formally  "ef",  normally  EF.   under  CPM)  is
  1044.       available  a list of error code translations follows.  Note that the
  1045.       position indicated in the source line is that in which the error was 
  1046.       detected, and that the actual error may occur earlier.  
  1047.       
  1048.       
  1049.       
  1050.       
  1051.       6.2  Action after errors 
  1052.       
  1053.       If any errors are found the compiler will set JCW (job control word) 
  1054.       to the error state, and if warnings are found it will set JCW to the 
  1055.       warn  state.   See  the  procedure SETJCW under Extensions.  This is
  1056.       very useful when executing long compilations under the various batch 
  1057.    |  mechanisms  (JOB  or  SUBMIT  under  CPM).   Under  CP/M SETJCW to a
  1058.    |  negative value causes any submit job  to  be  cancelled  on  program
  1059.    |  termination, and the warn state is ignored.  
  1060.       
  1061.       
  1062.       
  1063.       
  1064.       6.3  Some conditions causing errors/warnings 
  1065.       
  1066.       The  compiler  will  always generate a warning if the standard files
  1067.       INPUT or OUTPUT are reset or rewritten (or the  equivalent).   These
  1068.       files  are  normally  the user console, and cannot be reread nor can
  1069.       the effects of previous writes be erased.  
  1070.       
  1071.       While  NIL  is  implemented  as a predefined type, the compiler will
  1072.       forbid any attempts to redefine it, thus  giving  it  the  effective
  1073.       status of a reserved word.  
  1074.       
  1075.       In general the compiler will  generate  warnings  where  the  actual
  1076.       meaning  is  unambiguous  (e.g.  use of a feature in the wrong mode,
  1077.             
  1078.       
  1079.       
  1080.       Compiler Error Messages       Ch. 6-2         Pascal-P Manual v3.1.9 
  1081.       
  1082.       
  1083.       attempts to reset input, etc.)  and errors wherever the  possibility
  1084.       of a mis-spelling or faulty punctuation exists.  
  1085.       
  1086.       
  1087.       
  1088.       
  1089.       6.4  Accessing Error Messages 
  1090.       
  1091.       Under  CPM  the  error  message file is accessed as file "EF" with a
  1092.       blank extension.  If this file is not on the default or system disks 
  1093.       it should be specified on the command line with the appropriate disk 
  1094.       identifier, otherwise no translation will occur.  The error  message
  1095.       file  may  be  modified freely (one line per error) to install other
  1096.       languages, clarify errors, etc.  
  1097.             
  1098.       
  1099.       
  1100.       Features Not Implemented      Ch. 7-1         Pascal-P Manual v3.1.9 
  1101.       
  1102.       
  1103.         
  1104.       
  1105.       
  1106.       
  1107.       
  1108.                                    Chapter 7 
  1109.       
  1110.                    Standard Pascal Features Not Implemented 
  1111.       
  1112.       
  1113.       
  1114.       At  present  the following features of ANSI standard Pascal have not
  1115.       been implemented.  All  except  "GOTO"s  are  planned  for  eventual
  1116.       inclusion.  
  1117.       
  1118.       
  1119.            1.  Procedures/functions as parameters.  
  1120.       
  1121.            2.  GOTO's leading out of procedure/function bodies.  
  1122.       
  1123.            3.  Read/write for non-text files.  
  1124.       
  1125.       
  1126.       
  1127.       
  1128.       
  1129.       7.1  Packing 
  1130.       
  1131.    |  "PACKED" variables may or may not necessarily be packed.  At present 
  1132.    |  no items are packed no more than one item per byte.  
  1133.       
  1134.       The standard procedures  PACK  and  UNPACK  may  be  used,  but  may
  1135.       actually simply transfer variables.  
  1136.       
  1137.       PACKED and UNPACKED variables  are  not  distinguished  at  present,
  1138.       although  the  parameters  to  PACK  and  UNPACK  must  be correctly
  1139.       declared.  Thus standard Pascal errors in usage  of  such  variables
  1140.       probably will be undetected.  
  1141.       
  1142.       
  1143.       
  1144.       7.2  Set of Char 
  1145.       
  1146.       A  set  of  char  is  available, but any attempt to include graphics
  1147.       characters in that set {e.g.  chars with ordinal values larger  than
  1148.       127}  will  result  in  a run-time error (if checking is enabled) or
  1149.       compilation errors for constants.  
  1150.             
  1151.       
  1152.       
  1153.       Features Not Implemented      Ch. 7-2         Pascal-P Manual v3.1.9 
  1154.       
  1155.       
  1156.       7.3  Separate Compilation 
  1157.       
  1158.       The  compiler  will  handle  partial  source  programs  for separate
  1159.       compilation.  This facility is described in the chapter on  Language
  1160.       Extensions under "Procedure Calls".  S- mode is required.  
  1161.       
  1162.       The PROGRAM statement is optional under S- mode.  If it is  omitted,
  1163.       INPUT and OUTPUT files are still available.  
  1164.       
  1165.       
  1166.       
  1167.       
  1168.       7.4  Files in Structured Variables 
  1169.       
  1170.       The  user must give special consideration to ARRAYS OF FILE, RECORDS
  1171.       with file components, and pointers to FILE types or other types with 
  1172.       FILE  components.   Before any programmatic reference to these items
  1173.       it is necessary to call the standard procedure FILEINIT(f) for  each
  1174.       and  every  file  component.   After  this  the system will function
  1175.       normally, except that no automatic file close on exit from the block 
  1176.       in  which  the  file  was  declared will occur.  Again the user must
  1177.       specifically execute the standard procedure CLOSE(f) for  each  file
  1178.       opened  (via  reset/rewrite and equivalent procedures).  Under CP/m,
  1179.       if the file has only been used for  reading  (opened  via  RESET  or
  1180.       EXISTS)  the final close is not necessary.  However inclusion of the
  1181.       close  statement  will  avoid  portability  problems,  and  possible
  1182.       problems if program modifications are made later.  
  1183.       
  1184.       
  1185.       
  1186.       7.5  Reads of Real Variables 
  1187.       
  1188.       On  input, reads of real variables do not insist on a leading digit,
  1189.       but will accept values starting with ".".  This is  deliberate,  and
  1190.       avoids nuisance run-time errors.  
  1191.             
  1192.       
  1193.       
  1194.       Runtime File Assignments      Ch. 8-1         Pascal-P Manual v3.1.9 
  1195.       
  1196.       
  1197.         
  1198.       
  1199.       
  1200.       
  1201.       
  1202.                                    Chapter 8 
  1203.       
  1204.                            Runtime File Assignments 
  1205.       
  1206.       
  1207.       
  1208.       
  1209.       
  1210.       
  1211.       
  1212.       8.1  General 
  1213.       
  1214.       A number of run time errors can occur while running Pascal programs. 
  1215.       The messages are generally accompanied by a source code line  number
  1216.       if the N+ option was in effect on compilation.  File errors are also 
  1217.       accompanied by the file name.  
  1218.       
  1219.       Files named in the Program line of the Pascal source are external to 
  1220.    |  the Pascal program.  They may be defined by the run command, or  may
  1221.       be  temporary  or  permanent  user  files.   Files  declared  within
  1222.       procedures are unnamed temporary files (unless opened with a  second
  1223.       parameter in the opening RESET or REWRITE, as described below).  The 
  1224.       files "input" and "output" normally connect to the user's console.  
  1225.       
  1226.       
  1227.       
  1228.       
  1229.       8.2  On 8080/z80 under CPM: 
  1230.       
  1231.       The program command line is normally of the form: 
  1232.       
  1233.           d>RUNPCD program (fileparameters) [parm]; <inputfile >outputfile 
  1234.       
  1235.       (with "RUNPCD" omitted for .COM files)  but  is  not  restricted  to
  1236.       that, i.e.  use of the command line is entirely under the control of 
  1237.       the  application  program.   Any  section  after  "program"  may  be
  1238.       omitted,  and defaults apply.  The file parameters replace the files
  1239.       mentioned in the Pascal PROGRAM  heading.   If  omitted  the  Pascal
  1240.       internal  filename  is  used.   Files  input  and  output  cannot be
  1241.       redirected by this mechanism, but use the "Unix"  flavored  "<"  and
  1242.       ">"  (comesfrom  and goesto) redirection commands.  By default input
  1243.       and output connect to the users console.  Parm is an integer in  the
  1244.       range  0..32767,  with  a  default  value  of  0.   Use is up to the
  1245.       executing program, however odd values are used to cause  an  initial
  1246.       debug  trap, and to enable various run-time debugging aids.  Thus it
  1247.       is suggested  that  application  programs  rely  primarily  on  even
  1248.       values.  
  1249.       
  1250.             
  1251.       
  1252.       
  1253.       Runtime File Assignments      Ch. 8-2         Pascal-P Manual v3.1.9 
  1254.       
  1255.       
  1256.       8.2.1  CPM device files 
  1257.       
  1258.       Under CPM and other systems the following device files are  normally
  1259.       available  (and their names cannot be used for other files).  Unless
  1260.       mentioned  these  are  text  files.   Any  devicefile  may  be  used
  1261.       interchangably with a disk file of the same type.  
  1262.       
  1263.    |           CON       the system console, buffered for  input
  1264.    |                     or output.  
  1265.       
  1266.                KBD       the system  console  keyboard,  without
  1267.                          buffering or echoing of input.  Correct 
  1268.                          use  of  this  file   requires   either
  1269.                          modification    to    CPM    2.2.    or
  1270.                          (interpreters 2.8 up) prevents  use  of
  1271.                          the  CNTRL-P CPM function.  This avoids
  1272.                          loss of input characters during console 
  1273.                          output.  See the STATUS procedure.  
  1274.       
  1275.                RDR       The  system   "reader"   device,   line
  1276.                          buffered.  
  1277.       
  1278.                PUN       The system "punch" device 
  1279.       
  1280.                LST       The system "list" device 
  1281.       
  1282.                AUX       Identical to RDR device  with  no  line
  1283.                          buffering.   <lf>s  are  translated  to
  1284.                          <nul>.  See STATUS procedure.  
  1285.       
  1286.                NUL       a null file (bit bucket).  Any type.  
  1287.       
  1288.                CMD       A one  line  file  containing  the  run
  1289.                          command line.  
  1290.       
  1291.       Various other device  files  can  exist  at  various  installations.
  1292.       Examples are: 
  1293.       
  1294.                KBB       Identical   to   KBD,    except    that
  1295.                          "reset(kbb)"  causes all console i/o to
  1296.                          be performed through  interrupt  driven
  1297.                          buffers.   The  close  operation on kbb
  1298.                          (either specifically  performed  or  by
  1299.                          exit   from  the  declaring  procedure)
  1300.                          restores the normal unbuffered drivers.  
  1301.       
  1302.                AD1..AD8  A set of 8  analog/digital  converters.
  1303.                          FILE OF real.  
  1304.       
  1305.                RS1, RS2  Direct access to RS232 i/o ports.   See
  1306.                          STATUS.  
  1307.       
  1308.             
  1309.       
  1310.       
  1311.       Runtime File Assignments      Ch. 8-3         Pascal-P Manual v3.1.9 
  1312.       
  1313.       
  1314.                R1B, R2B  As  RS1  and  RS2,  but  buffered   via
  1315.                          interrupt system.  These files will not 
  1316.                          cause "waits" in the executing program, 
  1317.                          unless  the  buffers fill or are empty.
  1318.                          This can be pre-checked with the STATUS 
  1319.                          function.  
  1320.       
  1321.       
  1322.       
  1323.       8.2.2  File Redirection 
  1324.       
  1325.    |  Under CPM file redirection is available, by substituting the desired 
  1326.       files in the program header.  Files not  specified  by  this  method
  1327.       default  to  the  Pascal  filename.   A pair of commas can skip file
  1328.       redirection for any one file.  Note that INPUT and OUTPUT connect to 
  1329.       "CON"  by  default  and  cannot be redirected by this mechanism, but
  1330.       that the sequence 
  1331.       
  1332.                A>RUNPCD progfile(whatever) <inputfilename >outputfilename 
  1333.       
  1334.                                         will redirect INPUT and OUTPUT.  
  1335.       
  1336.       
  1337.                                      NOTE 
  1338.       
  1339.    |            The "lf" character is normally ignored on input. 
  1340.                 However  input  of  a  lf  will cause the STATUS
  1341.                 function to return a 2 bit (see  below)  because
  1342.                 the  hardware is physically loaded.  If a get is
  1343.                 now performed the system will flush the  lf  and
  1344.                 perform  the  following get automatically.  This
  1345.                 can  cause  unexpected  delays  when  performing
  1346.                 direct  device I/O.  For this reason some device
  1347.                 drivers are modified to translate  lf  into  nul
  1348.                 and  the user must specifically discard it.  The
  1349.                 AUX file translates all lf's into nulls for this 
  1350.                 reason.  
  1351.       
  1352.       
  1353.       
  1354.       8.2.3  Under CPM the file search order is: 
  1355.       
  1356.       
  1357.            1.  The default disk, if no drive specified, 
  1358.       
  1359.            2.  The system disk.  
  1360.       
  1361.                and then, for code files (.PCD) to be executed only: 
  1362.       
  1363.            3.  within the library file PCDS.LBR on the default disk.  
  1364.       
  1365.            4.  within  the  library  file PCDS.LBR on the system disk ONLY
  1366.                when no library was found on the default disk.  
  1367.       
  1368.             
  1369.       
  1370.       
  1371.       Runtime File Assignments      Ch. 8-4         Pascal-P Manual v3.1.9 
  1372.       
  1373.       
  1374.       If a drive has been specified the search is limited to the specified 
  1375.       drive.  If the modified CCP and JOB (for submit) files are installed 
  1376.       this  search  order  is  implemented  at all levels, otherwise it is
  1377.       limited to Pascal program executions.  
  1378.       
  1379.       Files  INPUT  and  OUTPUT  default to "CON" (the console) under CPM.
  1380.       See above for run-time re-direction.  
  1381.             
  1382.       
  1383.       
  1384.       Language Extensions           Ch. 9-1         Pascal-P Manual v3.1.9 
  1385.       
  1386.       
  1387.         
  1388.       
  1389.       
  1390.       
  1391.       
  1392.                                    Chapter 9 
  1393.       
  1394.                               Language Extensions 
  1395.       
  1396.       
  1397.       
  1398.       
  1399.       
  1400.       
  1401.       9.1  Standard Procedures 
  1402.       
  1403.       The following standard procedures have been added  to  the  required
  1404.       Pascal set.  Their use usually does not require the S- mode (See use 
  1405.       of fname below), and most can normally be replaced (for portability) 
  1406.       by  user written procedures.  {} enclose optional parameters.  If P-
  1407.       mode is in effect all procedures not in the standard Pascal set will 
  1408.       be flagged by warnings.  
  1409.       
  1410.       
  1411.                                      NOTE 
  1412.       
  1413.                 The  standard procedures required by the various
  1414.                 Pascal Standards are not discussed here.  
  1415.       
  1416.       In  the following fname may be a character string (e.g.  'fname') or
  1417.       a reference to a packed array of char terminated with a blank.   Use
  1418.       of  fname  in  calls  to  reset,  rewrite,  exists, appendto, update
  1419.       requires S- mode.  Note that fname should always be terminated  with
  1420.       a  blank.  Fname should normally begin with an alphabetic character,
  1421.       and contain only alpha-numeric characters.   Lower  case  characters
  1422.       are  automatically  upshifted before use, but a string variable will
  1423.       not be affected.  
  1424.       
  1425.       
  1426.       
  1427.       
  1428.       9.1.1  File Access 
  1429.       
  1430.       At present APPENDTO is parsed, but not implemented at run-time.  
  1431.       
  1432.                RESET(VAR f{, fname}); 
  1433.                REWRITE(VAR f{, fname}); 
  1434.       have  been  extended  to  allow  the optional 2nd.  parameter.  This
  1435.       causes attachment to the named external file.  
  1436.       
  1437.                EXISTS(VAR f{, fname}) : boolean; 
  1438.       is equivalent to "reset", but does not cause a run-time error if the 
  1439.       operation fails.  It returns true for success, else false.  
  1440.       
  1441.             
  1442.       
  1443.       
  1444.       Language Extensions           Ch. 9-2         Pascal-P Manual v3.1.9 
  1445.       
  1446.       
  1447.                APPENDTO(VAR f{, fname}); 
  1448.       is equivalent to "rewrite", but opens a file for append access.  The 
  1449.       file must pre-exist, and any further writes append to that file.  
  1450.       
  1451.                UPDATE(VAR f{, fname}); 
  1452.       is equivalent to rewrite/reset, but allows direct access to  records
  1453.       of  a  fixed  record  size  file.   f  may  not be a text file.  See
  1454.       REPOSITION.  
  1455.       
  1456.                RENAME(VAR f, fname) : boolean; 
  1457.       renames the previously opened file f  to  fname.   Returns  true  if
  1458.       successful.   Also  closes  the  file automatically.  Failure may be
  1459.       caused by a previously existing file named  "fname",  (on  the  same
  1460.    |  disk drive under CPM), by illegal fname, by f not being open, and by 
  1461.       f being a device-file rather than a disk file.  
  1462.       
  1463.                PURGE(VAR f); 
  1464.       purges the previously opened file f.  f must be a disk file.  
  1465.       
  1466.                CLOSE(VAR f); 
  1467.       closes the previously opened file f 
  1468.       
  1469.                FILENAME(f, fname : packed array[1..28] of char); 
  1470.       returns the actual system file name  to  fname.   f  must  be  open.
  1471.       Under CPM, if the file is open on other than the default drive, or a 
  1472.       drive was specified when opened, that drive id is returned in fname. 
  1473.       Fname is returned upshifted.  
  1474.       
  1475.                STATUS(f) : integer; 
  1476.       returns 0 if the file is not open, otherwise an odd value.  Negative 
  1477.       values signify some form of error.  For positive values various  bit
  1478.       positions  have special significance, and are especially useful with
  1479.       device files: 
  1480.        
  1481.            1 = file is open; 
  1482.            2 = a get will function without waits; 
  1483.            4 = put will function without waits 
  1484.            8 = writeln will function without waits. 
  1485.       
  1486.       
  1487.       
  1488.       9.1.2  File read/write procedures 
  1489.       
  1490.       
  1491.                OVERPRINT(f, ...); 
  1492.                PROMPT(f, ...); 
  1493.       are  syntatically  identical  to  the  standard  writeln  procedure.
  1494.       Overprint causes output without a following line  feed,  and  prompt
  1495.       causes  output without a following carriage return or line feed.  In
  1496.    |  all cases the output buffer is flushed to the output device.  Prompt 
  1497.    |  should  be  used  whenever  a  line  that  has not been completed by
  1498.    |  "writeln" is intended to appear on the output device (typically  the
  1499.    |  console).   Without  this  the message will probably remain within a
  1500.    |  system buffer.  
  1501.             
  1502.       
  1503.       
  1504.       Language Extensions           Ch. 9-3         Pascal-P Manual v3.1.9 
  1505.       
  1506.       
  1507.                READX(f, VAR) : boolean; 
  1508.       is similar to read for integer  or  real  variables,  but  does  not
  1509.       create  a  run-time  error when bad input is found.  It returns true
  1510.       when no  valid  input  was  supplied,  otherwise  false.   Only  one
  1511.       argument may be read, as opposed to read(f, VAR, VAR,..); 
  1512.       
  1513.    |           READ(f, VAR a : PACKED ARRAY[1..?] OF char); 
  1514.    |  The  read  procedure  has  been  extended to allow input of strings.
  1515.    |  Input will continue until either the string  is  full,  or  eoln  is
  1516.    |  encountered.   In any case the final character in the string will be
  1517.    |  a nul (chr(0)), and any remaining portion of the string will be  nul
  1518.    |  filled.   Note  that  this  means  that  the  maximum  length of the
  1519.    |  received string is one less than the  declared  string  length.   No
  1520.    |  automatic  readln  is  executed,  so  that  long  input lines may be
  1521.    |  completely received by multiple reads, or  flushed  by  readln.   If
  1522.    |  eoln  is true at completion, the complete line was read.  The length
  1523.    |  of the input line can be discovered with the LENGTH function.  
  1524.       
  1525.    |           LENGTH(VAR a : PACKED ARRAY[1..?] OF char) : integer; 
  1526.    |  is effectively a special application of the SCANFOR  function,  with
  1527.    |  some  parameters automatically supplied by the compiler.  It is used
  1528.    |  to discover the length of text lines read into  arrays.   Note  that
  1529.    |  this  describes  the  actual  length  of the string, and that proper
  1530.    |  storage with the terminating marker requires one extra byte.  
  1531.       
  1532.    |           STRINGCP(VAR s1,s2 : PACKED ARRAY[1..?] OF char) : integer; 
  1533.    |  compares strings read by the above string read procedure,  or  other
  1534.    |  strings terminated by a nul (chr(0)) byte.  Returns +1, 0, -1 for s1 
  1535.    |  greater, equal, or less than s2.  Comparison does  not  include  any
  1536.    |  characters  past  the  length  of  the  shorter string, and a string
  1537.    |  identical to a shorter string up to the lenth of the shorter  string
  1538.    |  is considered larger.  
  1539.       
  1540.                REPOSITION(f, integer); 
  1541.       repositions  file  f at record  (integer) for further random access.
  1542.       The file must have been opened with the "UPDATE" procedure, and must 
  1543.       not  be  a text file.  After reposition a get(f) may be performed to
  1544.       read the desired record, or a put(f)  can  write  into  the  desired
  1545.       record.   A  sequence  of  gets  or puts will act as if the file was
  1546.       sequential.  To switch  from  get  to  put  (or  from  put  to  get)
  1547.       REPOSITION  must  first  be  executed.  Under CPM repositioning to a
  1548.       point past the end of file will extend the file  and  fill  the  new
  1549.       record with binary zeroes.  This allows the use of "sparse" files in 
  1550.       databases.  The record size is defined by the Pascal declaration  of
  1551.       the file.  
  1552.       
  1553.    |        
  1554.       
  1555.       
  1556.       Language Extensions           Ch. 9-4         Pascal-P Manual v3.1.9 
  1557.       
  1558.       
  1559.    |  9.1.3  Unsigned arithmetic.  
  1560.    |  
  1561.    |  
  1562.    |  These procedures operate on values stored as integers, but will  not
  1563.    |  cause  integer overflows, and treat all values as unsigned.  The use
  1564.    |  of the type declaration "unsigned =  integer;"  is  suggested.   You
  1565.    |  should  imagine the appropriate arithmetic operator inserted between
  1566.    |  the parameters.  
  1567.    |  
  1568.    |           UADD(u1, u2 : unsigned) : unsigned; 
  1569.    |           USUB(u1, u2 : unsigned) : unsigned; 
  1570.    |           UMULT(u1, u2 : unsigned) : unsigned; 
  1571.    |           UDIV(u1, u2 : unsigned) : unsigned; 
  1572.    |  
  1573.    |           UCMP(u1, u2 : unsigned) : integer; 
  1574.    |  compares two unsigned values, returning +1, 0, or -1 for u1 greater, 
  1575.    |  equal, or less than u2.  
  1576.       
  1577.       
  1578.       
  1579.       
  1580.       9.1.4  Miscellaneous Procedures 
  1581.       
  1582.       
  1583.                SIZEOF(VAR or TYPE id) : integer; 
  1584.       a pseudo-function returning the storage requirements of the item  in
  1585.       the units of the executing system.  
  1586.       
  1587.                TYPEID(expression) : typeid; 
  1588.       a  pseudo-function,  converts  expression to a value of type typeid.
  1589.       Expression and typeid  must  occupy  the  identical  storage  space.
  1590.       Primarily  used  as the inverse of "ORD" to convert an integer to an
  1591.       enumerated type.  Other uses are possible, but  dangerous.   Use  of
  1592.       this function requires the S- mode.  
  1593.       
  1594.                TERMINATE; 
  1595.       terminates program execution whenever executed.  
  1596.       
  1597.                SETJCW(integer); 
  1598.       sets the system job control word.  Causes a running job to terminate 
  1599.       at program completion if set to a  negative  value.   No  effect  in
  1600.       interactive processing.  
  1601.       
  1602.                DATER(VAR dl : PACKED ARRAY[1..15] OF char); 
  1603.       returns the current date and time formatted as: 
  1604.       
  1605.                     yy/mm/dd hh:mm    (with a trailing blank) 
  1606.       
  1607.       
  1608.                                      NOTE 
  1609.       
  1610.                 This  meets  ISO  standards  and   collates   in
  1611.                 ascending time order.  If no system timers exist 
  1612.                 the string "00/00/00  0:00 " is returned.  
  1613.             
  1614.       
  1615.       
  1616.       Language Extensions           Ch. 9-5         Pascal-P Manual v3.1.9 
  1617.       
  1618.       
  1619.                ASL(i, n) : integer; 
  1620.                ASR(i, n) : integer; 
  1621.                LSL(i, n) : integer; 
  1622.                LSR(i, n) : integer; 
  1623.       These  functions  provide  various  integer  shifts.  The arithmetic
  1624.       shifts may cause overflows.  
  1625.       
  1626.                ALLOCATE(VAR p : ^something); 
  1627.       is functionally identical to NEW, except that no heap overflow error 
  1628.       (and attendant abort) will occur.  If the allocation fails p will be 
  1629.       set to NIL.  Thus the application program can detect that a  failure
  1630.       occurred, and take remedial action.  
  1631.       
  1632.    |           GETMEM(VAR p : ^something, size : integer); 
  1633.    |  is  functionally  identical  to  ALLOCATE,  except that the user can
  1634.    |  specify the size of memory to be  allocated  (in  bytes).   This  is
  1635.    |  UNSAFE  in  that  no protection now exists against storing items too
  1636.    |  large for the assigned memory.  S- mode is required.   The  assigned
  1637.    |  storage may be released with DISPOSE or RELEASE.  
  1638.       
  1639.                DEBUG; 
  1640.       accesses  the  system  debugger,  and  is  system dependant.  On the
  1641.       HP3000 this is the "debug" subsystem.  Under CPM the  entire  system
  1642.       should  be executing under DDT or the equivalent, because control is
  1643.       transferred  via  memory  location  038H  after  the  state  of  the
  1644.       P-machine is displayed.  
  1645.       
  1646.                DELAY(seconds : integer); 
  1647.       pauses  the  executing  program  for seconds.  If the system has not
  1648.       been customized to the clock speed (under CPM) the delay period  may
  1649.       be  in error.  Other implementations (e.g.  time shared) may pause a
  1650.       process.  
  1651.       
  1652.                RANDOM(VAR seed : integer) : real; 
  1653.       returns a pseudo-random number in the range 0 to less than  1.   The
  1654.       number  is  depandant  on  the input value of seed, which should not
  1655.       otherwise be altered.  
  1656.       
  1657.                MASK(integer, integer) : integer; 
  1658.       performs a bitwise AND over the integers.  No overflows can occur.  
  1659.       
  1660.                CRC(char, VAR integer); 
  1661.       incorporates the byte valued character in a CRC checksum, using  the
  1662.       polynomial x^16 + x^12 + x^5 + 1.  Useful for communication systems.  
  1663.       
  1664.                MARK(p); 
  1665.       Where  p  is  of  any  pointer  type.  Marks the heap in the current
  1666.       state.  The variable p should not be altered until the corresponding 
  1667.       "release".  
  1668.       
  1669.                RELEASE(p); 
  1670.       Releases all items created by NEW since the corresponding MARK(p).  
  1671.       
  1672.       
  1673.             
  1674.       
  1675.       
  1676.       Language Extensions           Ch. 9-6         Pascal-P Manual v3.1.9 
  1677.       
  1678.       
  1679.                                      NOTE 
  1680.       
  1681.                 Mark  and  release  are  found  on  many  Pascal
  1682.                 systems, but are not standard.  
  1683.       
  1684.       
  1685.       
  1686.       9.1.5  System Programming Procedures 
  1687.       
  1688.       These  procedures  are  used  in  various  system  programs, and are
  1689.       generally  useful.    They   insulate   against   various   run-time
  1690.       environments.  
  1691.       
  1692.                MERGEREAL(hi, lo : integer) : real; 
  1693.                MERGEBYTES(hi, lo : integer) : integer; 
  1694.                SPLITREAL(r : real; VAR hi, lo : integer); 
  1695.                SPLITBYTES(i : integer; VAR hi, lo : integer); 
  1696.       insulate between differing object machine storage  assignment  order
  1697.       and  patterns.   Programs  using  these  are  portable, while use of
  1698.       variant records is not.  (byte is used as a synonym for char).   For
  1699.       example 
  1700.       
  1701.                          i := mergebytes(ord(hibyte), ord(lobyte)); 
  1702.       
  1703.                                    is completely machine independent.  
  1704.       
  1705.       
  1706.                                      NOTE 
  1707.       
  1708.                 A  "standard  real" for the system is defined as
  1709.                 the bit pattern used on the HP3000 (sign, 9  bit
  1710.                 exponent  offset by 256, 22 bit significand with
  1711.                 an implied leading 1 bit), which  is  not  quite
  1712.                 identical   to  the  IEEE  standard.   All  real
  1713.                 constants in PCD files are of this form, and are 
  1714.                 automatically  converted  to  resident  form  at
  1715.                 execution time.  Native code files use  whatever
  1716.                 form is resident.  
  1717.       
  1718.       For systems programs format conversions are performed by: 
  1719.       
  1720.                STDREAL(r : real) : real; (* resident to standard *) 
  1721.                MYREALSTD(r : real) : real; (* std to resident *) 
  1722.                REAL8080(r : real) : real; (* resident to 8080 *) 
  1723.                MYREAL80(r : real) : real; (* 8080 to resident *) 
  1724.       In  general  the  output  of  these  functions  is  only  usable for
  1725.       assignment or manipulation by the split/merge  byte/real  procedures
  1726.       above.  
  1727.       
  1728.       The sequence 
  1729.                     r := real8080(myrealstd(standardreal)); 
  1730.       
  1731.       will convert standard reals to 8080 reals on all machines.  
  1732.       
  1733.             
  1734.       
  1735.       
  1736.       Language Extensions           Ch. 9-7         Pascal-P Manual v3.1.9 
  1737.       
  1738.       
  1739.                POINTERTO(variable); 
  1740.       allows generation of  a  pointer  to  that  variable.   S-  mode  is
  1741.       required.   Note  that  whenever  such a pointer is assigned d- mode
  1742.       should be in effect, because the "pointed to" variable is not in the 
  1743.       heap,  and  "invalid  pointer"  run-time errors will occur.  This is
  1744.       non-standard Pascal, and should be avoided wherever possible.  
  1745.       
  1746.                MOVETO(VAR char, char; integer); 
  1747.                MOVEUP(VAR char, char; integer); 
  1748.       are  NON-PORTABLE  in  general.   These avoid all type checking, and
  1749.       allow mass moves  of  storage  content  between  arrays.   The  char
  1750.       parameters  can be supplied by integer variables, pointers, etc.  as
  1751.       desired.  No run-time checks are made.   Usage  is  thus  inherently
  1752.       unsafe,  but  provides  an  escape from rigid Pascal type and bounds
  1753.       checking.  MOVETO moves the lower addressed elements first, and  can
  1754.       be  used  to  move arrays downwards within themselves.  MOVEUP moves
  1755.       the higher addressed elements first, and can be used to move  arrays
  1756.       upwards  within  themselves.   "integer"  is  the  number of storage
  1757.       elements to move, in terms of character storage  units.   The  first
  1758.       parameter  is  the  destination  (thus "moveto"), and the second the
  1759.       source.  
  1760.       
  1761.                SCANFOR (char; VAR char; max : integer) : integer; 
  1762.                SCANWHILE (char; VAR char; max : integer) : integer; 
  1763.       are  again  machine  dependant and NON-PORTABLE.  NO CHECKING ON the
  1764.       VAR char is performed.  Thus  this  may  be  supplied  by  an  array
  1765.       referance, or by a referance to an item within an array of char., or 
  1766.       any other variable.  It is treated as a pointer to element 1  of  an
  1767.       array  [1..max]  of  char  if  max  is positive, and as a pointer to
  1768.       element -1 of the  array  [-max..-1]  if  max  is  negative.   0  is
  1769.       returned if the searched-for element is not found (or only found for 
  1770.       scanwhile), else the index  (measured  as  above)  of  the  searched
  1771.       element.   Note that negative values of max cause backward searches,
  1772.    |  and return negative, or 0, values.  Scanwhile can  be  considered  a
  1773.    |  search for an element NOT equal to char.  No storage is ever altered 
  1774.       by the search, which simply returns information.  
  1775.       
  1776.       
  1777.       
  1778.       
  1779.       9.1.6  Special procedures 
  1780.       
  1781.       These  allow  for  precise  control  of   CPM   systems,   and   are
  1782.       non-portable.  They should therefore normally be avoided.  
  1783.       
  1784.                PEEK(n) : integer; 
  1785.                GETPORT(n) : integer; 
  1786.       are functions returning 0..255 
  1787.       
  1788.                POKE(n, i); 
  1789.                PUTPORT(n, i); 
  1790.       are procedures storing 0..255.  
  1791.       
  1792.                INTERRUPTS(onoff : boolean); 
  1793.             
  1794.       
  1795.       
  1796.       Language Extensions           Ch. 9-8         Pascal-P Manual v3.1.9 
  1797.       
  1798.       
  1799.       controls the interrupt system.  
  1800.                SYSCALL(fnct : integer; parm : integer) : integer; 
  1801.                IOCALL(entryno : integer; data : integer) : integer; 
  1802.       allow for direct connection to CPM  services.   The  parm  and  data
  1803.       parameters  are not checked, so that any type which fits in a single
  1804.       16  bit  word  may  be  used.   In  particular,   to   satisfy   CPM
  1805.       requirements,  these  may  be  pointers  generated  by the POINTERTO
  1806.       standard  procedure  (s-  mode  required).   With  these  procedures
  1807.       interface  procedures to the system may be generated, thus isolating
  1808.       system dependant  features  from  the  application.   Note  that  no
  1809.       protection against misuse exists.  
  1810.       
  1811.       
  1812.       
  1813.       
  1814.       9.1.7  Super Special Procedures 
  1815.       
  1816.       
  1817.       These  are  available  when suitable connectors have been installed,
  1818.       and are thus not generally  portable.   However  standard  connector
  1819.       locations  exist in the interpreters and run-time packages.  See the
  1820.       file CPMLINK.MAC.  
  1821.       
  1822.                CPUTIME(VAR t : ARRAY[0..1] OF 0..maxint); 
  1823.                TIMECLK(VAR t : ARRAY[0..1] OF 0..maxint); 
  1824.       return  (timeclk)  time  of  day  in  millisecs  after  midnight, or
  1825.       (cputime) central processor time used.  Under CPM the procedures are 
  1826.       identical.  ARRAY[0] is the less significant part.  
  1827.       
  1828.                TIMESET(hour, min : integer); 
  1829.                DATESET(VAR d : array[0..2] OF integer); 
  1830.                DATEGET(VAR d : array[0..2] OF integer); 
  1831.       provide  for Pascal program control of system timers.  On the HP3000
  1832.       timeset and dateset are illegal (reserved for system).  ARRAY[0]  is
  1833.       day,  ARRAY[1] is month, ARRAY[2] is year.  By convention dateset to
  1834.       an array of zeroes stops the time of day clock.  
  1835.       
  1836.                STARTINTERVALTIMER(interval : integer; where : ^boolean); 
  1837.                STOPTIMER; 
  1838.       provide  for  timed  input  systems.   Startintervaltimer causes the
  1839.       boolean "where" to be unconditionally  set  to  TRUE  at  "interval"
  1840.       periods.   This  can  be  used as a flag to acquire a value from A/D
  1841.       converter files, etc.  Stoptimer disables this.   Not  available  on
  1842.       HP3000.  
  1843.       
  1844.                STARTPROFILER(interval : integer; where : ^storage); 
  1845.       initializes  the  profiler  subsystem,  and  allows  measurement  of
  1846.    |  program  dynamic  execution.   The   main   program   must   include
  1847.    |  PROFILER.INC  file,  declare  the  auxiliary constants, and call the
  1848.       initializing, stopping, and dumping procedures.  The utility program 
  1849.       "PLOTPROF"  can  then  create  an  execution  time  histogram.  This
  1850.       subsystem provides information to guide  program  optimization,  and
  1851.       can  avoid wasting effort on pointless optimizations.  Note that the
  1852.             
  1853.       
  1854.       
  1855.       Language Extensions           Ch. 9-9         Pascal-P Manual v3.1.9 
  1856.       
  1857.       
  1858.       profiler, at present, is incompatible with STARTINTERVALTIMER, since 
  1859.       the identical timer hardware is used.  
  1860.       
  1861.       
  1862.       
  1863.       
  1864.       9.2  File System 
  1865.       
  1866.       The  file  system  contains  provisions  for  files as components of
  1867.       structured types, including pointers to files.  Use of files in such 
  1868.       types   requires   specific  user  use  of  the  standard  procedure
  1869.       FILEINIT(f) to initialize the file control blocks before  any  other
  1870.       use  of  the file is made, and of the standard procedure CLOSE(f) to
  1871.       close the file.  The compiler performs the equivalent procedures  on
  1872.       directly declared files (e.g.  f : text) automatically, but does not 
  1873.       detect the presence of the file types within structured variables.  
  1874.       
  1875.       The file system of standard Pascal has been extended to allow direct 
  1876.       access  and  attachment  to  files.   Additional  carriage   control
  1877.       procedures have been added.  
  1878.       
  1879.       A second  parameter  may  be  added  to  RESET  and  REWRITE.   This
  1880.       parameter is a character string containing the external file name in 
  1881.       internal format.  The last character of this string must be a blank.  
  1882.       
  1883.       Execution  of  "write(f,'string':0)"  and equivalent statements is a
  1884.       null operation.  This is non-standard Pascal, and is never  flagged.
  1885.       If  string  is  a  single  character (ex.  write(f,'a':0) ) an error
  1886.       occurs.  The maximum string length or field  size  is  255,  however
  1887.       multiple writes may create any length of line.  
  1888.       
  1889.       REPOSITION (file, integer) will reposition a file to  the  indicated
  1890.       record.   A  subsequent  GET  will  begin  at  this  record, while a
  1891.       subsequent PUT will write to this record.  Note that REPOSITION will 
  1892.       not  modify  the EOF flag; it is ignored in determining the validity
  1893.       of the next GET or PUT.  Future changes are possible.  
  1894.       
  1895.       Under  CPM  all  disk files are mapped into CPM standard formats and
  1896.       packed into successive 128 byte file records.  File items may  cross
  1897.       sector and extent boundaries.  
  1898.       
  1899.       Two new formatting procedures have  been  added.   OVERPRINT  (file)
  1900.       writes  the  buffer  without advancing the line.  The next line will
  1901.       print on top of this one.  The procedure PROMPT  (file)  writes  the
  1902.       current  line  without  repositioning  the  carriage.  This allows a
  1903.       subsequent READLN to read from the same line as the output  message.
  1904.       Both  OVERPRINT  and  PROMPT  deal  with  the  current line (buffer)
  1905.       contents.  Like PAGE, the file parameter  is  optional.   Note  that
  1906.       lines  output  by the PROMPT procedure will not have trailing blanks
  1907.       removed.  
  1908.       
  1909.       STATUS(file)  returns  an Integer value.  It is zero if the file has
  1910.       not yet been used, and odd if  the  file  is  open.   It  returns  a
  1911.             
  1912.       
  1913.       
  1914.       Language Extensions           Ch. 9-10        Pascal-P Manual v3.1.9 
  1915.       
  1916.       
  1917.       negative  value for errors (device and system dependant.  STATUS can
  1918.       be  used  to  determine  whether,  for  example,  a  "rewrite"   was
  1919.       successful.  
  1920.       
  1921.       
  1922.                                      NOTE 
  1923.       
  1924.                 a   rewrite   failure  always  causes  an  error
  1925.                 message, however the system normally  allows  up
  1926.                 to  5  non-fatal run-time errors to occur before
  1927.                 aborting.  
  1928.       
  1929.       
  1930.       
  1931.       
  1932.       9.3  Lazy I/O 
  1933.       
  1934.       The "lazyio" system is  implemented.   This  allows  normal  use  of
  1935.       interactive files (e.g.  CON) while meeting the Pascal standards for 
  1936.       reset, readln, etc.  These normally perform logical  access  to  the
  1937.       following  character  of  the file, which is then available for look
  1938.       ahead via eof,  eoln,  f^  references.   The  system  postpones  the
  1939.       physical  input  of  that  character/condition  until it is actually
  1940.       referenced, thus allowing natural use of  prompting  messages,  etc.
  1941.       While  not  yet  provided,  the  implementation  is such as to allow
  1942.       implementation of a single level UNGET(f) procedure  (for  textfiles
  1943.       only).  
  1944.       
  1945.       Note that some programming care must be taken to avoid referring  to
  1946.       eof, eoln, f^ until such prompts have been made.  
  1947.       
  1948.       Thus any text file may be routed to/from interactive  devices  (e.g.
  1949.       console), with no special programming considerations.  
  1950.       
  1951.       
  1952.       
  1953.       
  1954.       
  1955.       9.4  Procedure Calls 
  1956.       
  1957.       The  procedure  call  syntax has been extended to allow reference to
  1958.       separately compiled programs and  to  procedures  written  in  other
  1959.       languages.   The  word  "FORWARD"  is  replaced  by  "EXTERNAL"  for
  1960.       separately compiled procedures, and by "INTRINSIC" for procedures in 
  1961.       other languages.  
  1962.       
  1963.             
  1964.       
  1965.       
  1966.       Language Extensions           Ch. 9-11        Pascal-P Manual v3.1.9 
  1967.       
  1968.       
  1969.       9.4.1  Separate Compilation 
  1970.       
  1971.       Separate compilation is achieved by removing the  main  program  but
  1972.       leaving  the  trailing  ".".  Note that the ";" still terminates the
  1973.       final procedure.  S- mode is required.  All  procedures  defined  at
  1974.       the  outermost level may be referenced in another compilation.  Such
  1975.       separately compiled procedures may refer to globals  defined  within
  1976.       the  source  code,  but  it  is  up  to the user to ensure that such
  1977.       globals are  identical  with  those  used  in  other  modules.   The
  1978.       $include  facility (or {$i'name'} pseudo-comment) is useful for this
  1979.    |  purpose.  The resultant code files will be RBM  (relocatable  binary
  1980.    |  module)  files  under  CPM.   RBM  files can be linked with "LINKER"
  1981.    |  under CPM.  See "Program segmentation".  
  1982.       
  1983.       
  1984.       
  1985.       
  1986.       9.4.2  Procedure Parameters 
  1987.       
  1988.       Note that while access to programs written in languages  other  than
  1989.       Pascal  is  permitted  by  using  INTRINSIC, it is up to the user to
  1990.       create compatible parameters.  
  1991.       
  1992.       Procedure  parameters  are  stacked  in  the  order  declared in the
  1993.       procedure heading.  Value parameters are completely  evaluated,  and
  1994.       may  be  of any size.  They may be treated as initialized variables,
  1995.       but may not be used to control  FOR  loops.   A  function  value  is
  1996.       treated  as  a  parameter preceding all other paramaters, and is not
  1997.       removed on function exit.  The user  should  NOT  assume  a  default
  1998.       functional value, but should always explicitly set it.  
  1999.       
  2000.       
  2001.       
  2002.       
  2003.       9.5  Case Default 
  2004.       
  2005.       The  syntax  of  the  CASE  statement  has  been extended to allow a
  2006.       default  action  to  be  taken  if  the  expression  value  is   not
  2007.       represented  in the list of labelled statements using an "OTHERWISE"
  2008.       clause at the termination of the CASE statement (as defined  in  the
  2009.       draft ISO standard) This extension requires S- compilation mode.  In 
  2010.       the absence of this statement any execution of a case statement with 
  2011.       an  undefined  case  variable  will  cause a run-time error (with or
  2012.       without runtime checks enabled).  
  2013.       
  2014.             
  2015.       
  2016.       
  2017.       Language Extensions           Ch. 9-12        Pascal-P Manual v3.1.9 
  2018.       
  2019.       
  2020.       9.6  Complex Comparisons 
  2021.       
  2022.       Structured  variables  may  be  compared for (in)equality, as in "IF
  2023.       array1 = array2", but not for other relations.  This is an extension 
  2024.       to  standard  Pascal,  and  at  present  is  not  detected by the S+
  2025.       compiler option.   For  future  compatibility  such  use  should  be
  2026.       bracketed  by  the  S-  ....   S+  options in source code to prevent
  2027.       generation of warnings.  Note  that  "array1  :=  array2"  is  legal
  2028.       Pascal, enforcing equality.  
  2029.       
  2030.       
  2031.       
  2032.       
  2033.       9.7  Strings 
  2034.       
  2035.       An  ISO  standard compatible string facility has been included.  See
  2036.       the discussion of READ, LENGTH, and STRINGCP procedures above.   The
  2037.       design  is such that programs using these extension may be ported to
  2038.       any  standard  Pascal  system  by  writing  appropriate  procedures.
  2039.       However,  such  replacement  procedures  will have the normal strong
  2040.       typeing, rather than be universal.  
  2041.       
  2042.       
  2043.       
  2044.       
  2045.       9.8  Substrings 
  2046.       
  2047.       A  limited  substring  facility  has  been  provided.   A   modified
  2048.       subscript  specifies  the  initial index and length within a string.
  2049.       In keeping with normal Pascal philosophy, the substring length  must
  2050.       be  a  compile-time  constant.  A[I FOR 10] specifies 10 elements of
  2051.       array A starting at element I.  The substring variable may  be  used
  2052.       on  either  side of an assignment, or as a procedure parameter.  The
  2053.       same notation may be used for arrays of any  type,  but  no  further
  2054.       subscripts  or  field  selections  may be applied.  This notation is
  2055.       portable, but more restrictive that the MOVETO and MOVEUP procedures 
  2056.       noted above.  S- mode is required.  
  2057.       
  2058.             
  2059.       
  2060.       
  2061.       Program Segmentation          Ch. 10-1        Pascal-P Manual v3.1.9 
  2062.       
  2063.       
  2064.         
  2065.       
  2066.       
  2067.       
  2068.       
  2069.                                   Chapter 10 
  2070.       
  2071.                              Program Segmentation 
  2072.       
  2073.       
  2074.       
  2075.       
  2076.       
  2077.       
  2078.       10.1  Overview 
  2079.       
  2080.       Program segmentation is completely independant of program structure, 
  2081.       and  is  controlled  solely  by  the  placement  of  (*$s'segname'*)
  2082.       compiler  commands.  Any procedure, whether nested or global, can be
  2083.       placed in any segment.  All segmentation may be  performed  after  a
  2084.       program  is operational.  The source text never need be distorted to
  2085.       allow segmentation.  
  2086.       
  2087.       Under  CPM and the interpreter system no final decision on segmented
  2088.       operation need be taken until after compilation.  The output of  the
  2089.       compiler  is a TIC (temporary intermediate code) file which contains
  2090.       ".SEG" pseudo codes, created from the s'segname' commands.  
  2091.       
  2092.       If   this   is  converted  into  executable  code  with  ASSMPCD  no
  2093.       segmentation will be present in  the  final  file.   This  is  often
  2094.       useful  for debugging.  The output from ASSMPCD, however, will be in
  2095.       relocatable form, and must be passed through  LINKER  to  create  an
  2096.    |  executable  file  (This  may  be  prevented by use of [parm=64] when
  2097.    |  running  ASSMPCD).   Whenever  a  ".SEG"  pseudo-op  is  encountered
  2098.       ASSMPCD  assumes  that  a  segmented  file  is  being generated, and
  2099.       creates such a linkable object file.  
  2100.       
  2101.       Programs  created  from separately compiled modules will normally be
  2102.       segmented and use the techniques described  in  this  chapter.   The
  2103.       modules  may  themselves  be segmented.  See the chapter on Separate
  2104.       Compilation.  
  2105.       
  2106.       
  2107.       
  2108.       
  2109.       10.2  PCD segmentation (for interpreter execution) 
  2110.       
  2111.       At present, to implement segmentation the "TIC" file is  split  into
  2112.       multiple  single  segment  files  with the utility program SPLITTIC.
  2113.       Splittic will create a file for each  named  segment  in  the  input
  2114.       code,  with the extension .TIC, and using the segment name truncated
  2115.    |  to 8 characters (or to 7 characters with  a  user  specified  prefix
  2116.    |  character).   Each of these segment files must now be converted to a
  2117.             
  2118.       
  2119.       
  2120.       Program Segmentation          Ch. 10-2        Pascal-P Manual v3.1.9 
  2121.       
  2122.       
  2123.       RBM (relocatable binary module)  with  ASSMPCD,  just  as  a  single
  2124.       segment  program.   The  results  are  then  combined  into a single
  2125.    |  program file by LINKER.   The  first  file  linked  must  be  either
  2126.    |  "SEGS15.RBM"  or  "SEGS31.RBM",  which  contains  the  outline  of a
  2127.    |  segment table for a 15 or 31 segment codefile.  
  2128.    |  
  2129.    |  
  2130.    |  
  2131.    |  
  2132.    |  10.2.1  Splitting the TIC file 
  2133.    |  
  2134.    |  Execute: 
  2135.    |           B>runpcd splittic (ticfilename) 
  2136.    |  or 
  2137.    |           B>splittic (ticfilename) 
  2138.    |  
  2139.    |  and select a suitable  prefix  character  when  requested  (a  CTL-Z
  2140.    |  reply,  or  redirecting  input  from  nul  with "<nul" will omit the
  2141.    |  prefix).  The split files will occupy at least as much space as  the
  2142.       original.   At  completion  the  original TIC file may be discarded.
  2143.       The following assumes the selection of a prefix letter "X" (must  be
  2144.       upper case) and that segments are named "segfile".  SPLITTIC reports 
  2145.       on the actual filenames created during execution.  
  2146.       
  2147.       
  2148.       
  2149.       
  2150.       10.2.2  Assembly 
  2151.       
  2152.       For each output file generated execute (omit "runpcd " if using  the
  2153.       .COM versions) : 
  2154.       
  2155.                B>runpcd assmpcd (xsegfile.tic,xsegfile.rbm) 
  2156.       
  2157.       
  2158.       
  2159.       
  2160.       10.2.3  Linking 
  2161.       
  2162.       Execute linker as follows: 
  2163.       
  2164.                B>runpcd linker (objfile.pcd, loadmap) 
  2165.       
  2166.       replacing objfile and loadmap with appropriate file names.   Loadmap
  2167.       may  be  designated  con, lst, or a diskfile.  The information on it
  2168.       will be used in the next step, and therefore it should normally  not
  2169.       be routed to the console.  
  2170.       
  2171.    |  Reply to the first "filename" prompt with "SEGS15.RBM", and  to  the
  2172.       following  prompts  with  the  names of the just assembled segments.
  2173.       Terminate the entries with an empty line.  The object file prompt is 
  2174.       a  last  chance  to  change  your mind on the output file name.  The
  2175.       reply to the "loadpoint" prompt should be "0", and carriage  returns
  2176.             
  2177.       
  2178.       
  2179.       Program Segmentation          Ch. 10-3        Pascal-P Manual v3.1.9 
  2180.       
  2181.       
  2182.       can  be  entered for all other prompts.  LINKER will scan the files,
  2183.       announce that .CODSIZE, .DATASIZ, .SEGS., .WHERE01 through  .WHERE15
  2184.       are  undefined,  and  ask whether more modules are available.  Reply
  2185.       "n".  LINKER will now generate the output file and the loadmap.  All 
  2186.       intersegment procedure linkages have now been resolved.  
  2187.       
  2188.                                      NOTE 
  2189.       
  2190.                 For programs using more than 15 segments replace 
  2191.                 SEGS15.RBM with SEGS31.RBM.  
  2192.       
  2193.       
  2194.       
  2195.       10.2.4  Installing the segment map 
  2196.       
  2197.       The user must patch  into  the  final  file  the  addresses  of  the
  2198.       segments  in the code file, which are the loadpoint addresses of the
  2199.       segments in the LINKER output loadmap divided by 128.  These are CPM 
  2200.       record  numbers  in  the  code  file, and are the various ".WHEREnn"
  2201.       undefined in the preceding step.  The  addresses  are  installed  at
  2202.       locations  (segmentnum*8)  and  (segmentnum*8+1),  high  byte first.
  2203.       Program "DISKEDIT" can be used for this.   The  two  byte  value  at
  2204.       locations  0  and 1 (most significant byte first) must be set to the
  2205.       negative count of segments present.  This is the  undefined  ".SEGS"
  2206.       in  the  previous  step.  At present no more than 31 segments can be
  2207.       used, and this section generally assumes a maximum of 15.  If errors 
  2208.       are made in calculating these values the program will not load.  Any 
  2209.       further operations may be performed by the "TUNE" utility program.  
  2210.       
  2211.       
  2212.       
  2213.       
  2214.       10.2.5  Initial memory allocation 
  2215.       
  2216.       The value at locations 4 and 5 of the codefile must  be  patched  to
  2217.       specify  the  total  codespace  allocated.   This  is  the undefined
  2218.       ".CODSIZE" from the linking step.  (.DATASIZ is  unused).   The  run
  2219.       time system will then automatically swap code segments in and out of 
  2220.       main memory on demand, and select segments for discard  based  on  a
  2221.       least  recently  used  algorithm.   No  more than the specified code
  2222.       space will be used for the program code.  A system that buffers disk 
  2223.       tracks will greatly enhance performance.  
  2224.       
  2225.       The critical quantity to be selected is  the  codespace  above.   If
  2226.       this  is  too  small  the  system  will  thrash,  while if too large
  2227.       sufficient execution time data space will not be available.  It must 
  2228.       be  at least as large as the largest single segment in the codefile,
  2229.       or the program can never be loaded.  Normally this space is selected 
  2230.       sufficiently  large  to  hold  the  main  execution  portions of the
  2231.       program without any initialization or  rarely  used  error  handling
  2232.       segments.   This  will  automatically swap such segments out of main
  2233.       memory, and have negligible performance effects.  
  2234.       
  2235.             
  2236.       
  2237.       
  2238.       Program Segmentation          Ch. 10-4        Pascal-P Manual v3.1.9 
  2239.       
  2240.       
  2241.       The  user  can  also  control  the  time  span  used  by  the memory
  2242.       management system by altering byte 2 of the code file  (range  2  to
  2243.       255).   This  measures  time  in  terms  of  inter-segment transfers
  2244.       performed.  
  2245.       
  2246.                                      NOTE 
  2247.       
  2248.                 Since PCD files are quite compact, only the rare 
  2249.                 program  will  require segmentation.  Very large
  2250.                 program systems can be written as  a  collection
  2251.                 of  procedures, pass data through a global area,
  2252.                 and be supervised and co-ordinated  by  a  small
  2253.                 outer  block  using  this  segmentation  scheme.
  2254.                 There will be no necessity for  duplicated  code
  2255.                 within  sections  of  such  a system if suitably
  2256.                 segmented.  
  2257.       
  2258.       
  2259.       
  2260.       10.3  Prestored alternative settings 
  2261.       
  2262.       By convention, alternative settings for the memory management period 
  2263.       and  codespace values are stored in locations (8*i+5) and (8*i+6) to
  2264.       (8*i+7) for i := 1 to numberofsegments.  If these values are present 
  2265.       the  utility  program  "TUNE"  can  be  quickly  used  to  alter the
  2266.       memory-requirements/performance balance of the  program.   TUNE  may
  2267.       also be used to initially install these values.  
  2268.       
  2269.       The appearance of such a segment map may be examined by: 
  2270.       
  2271.       
  2272.                A>diskedit pascalp.pcd 
  2273.       
  2274.       followed by the command 
  2275.       
  2276.                r0 
  2277.       
  2278.       terminate the program by "q".  Use a copy  of  Pascalp  in  case  of
  2279.       error.  
  2280.       
  2281.                                      NOTE 
  2282.       
  2283.                 Other  areas  within the segment map are used by
  2284.                 the memory manager.  Therefore at  run-time  the
  2285.                 map contents will be different.  
  2286.       
  2287.                 Numerical input to diskedit is normally decimal, 
  2288.                 but  may  be  prefixed  by  "#"  for hexadecimal
  2289.                 input.  In some  cases  characters  enclosed  by
  2290.                 single   quotes  may  also  be  used.   Diskedit
  2291.                 provides no input line editing, and was built as 
  2292.                 a crude tool.  
  2293.       After segment addresses and segment  count  have  been  entered  via
  2294.       diskedit, further alterations may be performed by: 
  2295.             
  2296.       
  2297.       
  2298.       Program Segmentation          Ch. 10-5        Pascal-P Manual v3.1.9 
  2299.       
  2300.       
  2301.                A>RUNPCD tune (codefilename.ext) 
  2302.       using  the unprompted "I" and "D" commands (?  gets a prompt).  This
  2303.       is much safer than diskedit.  
  2304.       
  2305.       
  2306.       
  2307.       
  2308.       
  2309.       
  2310.       10.4  The structure of a code file/segment 
  2311.       
  2312.       All executable PCD files begin with a  single  descriptive  integer,
  2313.       which is stored high byte first, in 2's complement notation.  
  2314.       
  2315.       If this integer is positive  the  PCD  file  consists  of  a  single
  2316.       segment, and the integer is the length of that segment.  The segment 
  2317.       proper is enclosed by the integer, an unused word, and (at the  end)
  2318.       a single byte describing the number of transfer vectors.  These five 
  2319.       (total) bytes are not included in the length descriptor.  
  2320.       
  2321.       
  2322.       
  2323.       
  2324.       10.4.1  The segment map.  
  2325.       
  2326.       If this integer is negative it must be in the range -1 to -127 (only 
  2327.       -31  for now), and describes the number of segments in the PCD file.
  2328.       The following is based on a 15 segment limitation.  The initial  128
  2329.       bytes of the file are a segment map, consisting of 16 8-byte entries 
  2330.       which can be described as: 
  2331.       
  2332.          ARRAY[0..15] OF RECORD 
  2333.            CASE n OF 
  2334.       0: (   segcount     : -1..-15); (* hi byte first integer *) 
  2335.              tunevalue    : byte; 
  2336.              entryseg     : byte; (* id of outer block *) 
  2337.              codespace    : hifirstinteger; 
  2338.              dataspace    : hifirstinteger; (* not used yet *) ); 
  2339.       1,2,3,4,5,6,7,8,9,10,11,12,13,14,15: 
  2340.          (   fileaddress  : hifirstinteger; (* sector in PCD file *) 
  2341.              initflags    : byte; 
  2342.              workarea     : ARRAY[1..5] OF byte;) 
  2343.       
  2344.       By convention bytes 3, 4, 5 of workarea are used to  store  optional
  2345.       values  for  tunevalue  and codespace.  Eventually initflags will be
  2346.       able to describe segments not to be swapped out and machine language 
  2347.       segments.  In operation this byte also holds segment usage history.  
  2348.       
  2349.       The remainder of the PCD file holds segments organized as the single 
  2350.       segment  PCD  file above, but always filling complete sectors.  Thus
  2351.       the fileaddress value can address 128 * 65536 bytes of  code.   This
  2352.       is  an  absolute  limitation  on  the  total  size  of  a code file.
  2353.       Similarly no segment can reference more than 127 procedures (sum  of
  2354.       internal and external), and no segment can exceed 32K.  
  2355.             
  2356.       
  2357.       
  2358.       Program Segmentation          Ch. 10-6        Pascal-P Manual v3.1.9 
  2359.       
  2360.       
  2361.       Data segments are entirely separate,  and  are  addressed  via  base
  2362.       registers.   The  heap  and  stack areas must be contiguous, but can
  2363.       range up to 64K total size.  
  2364.       
  2365.       
  2366.       
  2367.       
  2368.       10.4.2  The transfer vector.  
  2369.       
  2370.       The last byte  of  each  segment  (located  by  the  segment  length
  2371.       descriptor) holds a count of transfer points.  0 means that only the 
  2372.       main program entry is present.  This final byte  is  preceded  by  n
  2373.       (where  n  is the contents of the count byte + 1) HIBYTEFIRST 16 bit
  2374.       transfer vectors.  They may be of two types (and a code listing will 
  2375.       show the type - See appendix C): 
  2376.       
  2377.       
  2378.       
  2379.       
  2380.       10.4.2.1  PCD transfers.  
  2381.       
  2382.       These  vectors  are  used  by the CUP (call user procedure) (and its
  2383.       variants, CLP and CGP call local and call global) P-codes.   If  the
  2384.       value  is negative, it is a self-relative pointer to the code within
  2385.       the segment.  If the value is positive, it  contains  two  one  byte
  2386.       fields,  holding  the  segment  number  and  entry number within the
  2387.       external segment.  
  2388.       
  2389.       
  2390.       
  2391.       
  2392.       10.4.2.2  Intrinsic transfers.  
  2393.       
  2394.       These vectors are used solely by the CIP (call intrinsic  procedure)
  2395.       P-code.   It  contains  the  absolute machine address of an external
  2396.       procedure.  Note that the external procedure is called with NO stack 
  2397.       marker,  but  with the appropriate parameters (and possible function
  2398.       return value space)  allocated  on  the  stack.   The  intrinsic  is
  2399.       responsible for clean-up.  
  2400.       
  2401.       The zeroth transfer is only used for entry to the main program.   In
  2402.       other   segments  it  will  normally  point  to  a  CSP  STP  (halt)
  2403.       instruction.  
  2404.             
  2405.       
  2406.       
  2407.       FILTERS and CONVENTIONS       Ch. 11-1        Pascal-P Manual v3.1.9 
  2408.       
  2409.       
  2410.         
  2411.       
  2412.       
  2413.       
  2414.       
  2415.                                   Chapter 11 
  2416.       
  2417.                             FILTERS and CONVENTIONS 
  2418.       
  2419.       
  2420.       
  2421.       
  2422.       
  2423.       
  2424.       11.1  General 
  2425.       
  2426.       Various "filter" programs  are  provided.   These  have  the  common
  2427.       characteristic  that  they  use only "input" and "output" files, and
  2428.       perform some sort of translation of the  input  file.   "Input"  and
  2429.       "output"  are  always  textfiles.   Filters have no extraneous files
  2430.       over which to prompt the user, and no added  verbiage  is  generally
  2431.       desired on the output, thus they are unable to prompt the user.  
  2432.       
  2433.       The programs are generally executed by  using  the  i/o  redirection
  2434.    |  facilities  ">"  and  "<"  (goes_to and comes_from respectively).  A
  2435.    |  minor exception is "TYPETEXT", as  detailed  below.   COPYCOLS  also
  2436.       provides for additional parameters in the command line.  
  2437.       
  2438.       
  2439.       
  2440.       
  2441.       11.2  LINE TERMINATORS 
  2442.       
  2443.       
  2444.       CPM   textfiles  universally  use  the  convention  that  lines  are
  2445.       terminated by a <cr><lf> pair.  Some  systems  generate  files  that
  2446.       omit  the  <lf>.  Any such files are legible to Pascal programs, and
  2447.       after passing through these filters will have the conventional  line
  2448.       terminators inserted.  
  2449.       
  2450.       
  2451.                                    WARNING: 
  2452.       
  2453.                 The  ISO  and ANSI Pascal standards specify, and
  2454.                 for good reason, that an  EOF  must  immediately
  2455.                 follow  an  EOLN  in  a non-empty textfile, i.e.
  2456.                 all lines must be terminated by EOLN (normally a 
  2457.                 <ret>   under  CPM).   Files  created  by  other
  2458.                 systems may not respect  this.   WordStar  is  a
  2459.                 notable    offender,   where   the   user   must
  2460.                 specifically terminate the last line in  a  file
  2461.                 and  not  add  any  invisible blanks at the end.
  2462.                 When these programs read such  files  they  will
  2463.             
  2464.       
  2465.       
  2466.       FILTERS and CONVENTIONS       Ch. 11-2        Pascal-P Manual v3.1.9 
  2467.       
  2468.       
  2469.                 probably  abort  with  a  "READ PAST EOF" error.
  2470.                 The cure is  to  be  sure  to  enter  the  final
  2471.                 carriage  return.   Programs  can  be written to
  2472.                 correct  this,  but  may  require  an   enormous
  2473.                 overhead  to  check  EOF  and  decide what to do
  2474.                 after every input character.  
  2475.       
  2476.       
  2477.       
  2478.       
  2479.       11.3  INDENTATION CODING 
  2480.       
  2481.       
  2482.       A convention widely used in the system  is  the  "indentation_code",
  2483.       patterned  after the coding used in the UCSD system.  This expresses
  2484.       an  indentation,  for  a  text  line,  as  the  character  010h,  or
  2485.       control-p,  or  16  decimal,  or  dle (all synonyms) followed by the
  2486.       printing character (space +  number_of_spaces_to_indent).   This  is
  2487.       only  a  convention,  rather than forced as in the UCSD system.  All
  2488.       system  programs  respect  this  (PASCALP,  PAGER,  XREF,  REFRENCE,
  2489.       COMPARE,   COPYCOLS,   TYPETEXT,  EXPAND)  and  perform  the  output
  2490.       expansion.  This avoids much useless and time-consuming scanning  of
  2491.       blanks in text files.  Program COMPRESS creates the indentation code 
  2492.       from plain text.  Of the above programs, COPYCOLS, TYPETEXT, EXPAND, 
  2493.       COMPRESS  and  REFRENCE  are  all  filters for textfiles.  Note that
  2494.       COPYTEXT simply passes on any indentation code.  
  2495.       
  2496.       
  2497.       
  2498.       
  2499.       11.4  NUMBERED LINES 
  2500.       
  2501.       
  2502.       A further convention used in this  system  is  that  textfile  lines
  2503.       which  have  an  initial string of 8 digits (all must be digits) are
  2504.       numbered, and that the first 5 digits  are  the  line  number.   The
  2505.       remaining  digits  express  a fractional line number.  Programs that
  2506.       process source text,  such  as  PASCALP,  XREF,  REFRENCE,  COMPARE,
  2507.       PAGER, XREFASSM respect this convention.  
  2508.       
  2509.       
  2510.       
  2511.       
  2512.       11.5  THE PIP [b] (buffered) OPTION: 
  2513.       
  2514.       
  2515.       To  co-operate  with  PIP,  several programs provide for the PIP [b]
  2516.       buffered option.  If the programs are executed with a non-zero value 
  2517.       of parm they will, at intervals, emit a dc3 character and then pause 
  2518.       for approximately parm seconds.  At file completion they will emit a 
  2519.       cntrl-z  character.  These cause PIP to flush buffers and terminate,
  2520.       and  enable  simple-minded   information   transfers   in   printing
  2521.       characters.   Programs  that  include  this  feature  are: COPYTEXT,
  2522.    |        
  2523.       
  2524.       
  2525.       FILTERS and CONVENTIONS       Ch. 11-3        Pascal-P Manual v3.1.9 
  2526.       
  2527.       
  2528.    |  STRIPNUM (both filters), BINHEX and RBMTOHEX (documented elsewhere). 
  2529.    |  The  time  delays  assume  execution  via  RUNPCD on a 2 Mhz machine
  2530.    |  (unless the CPMLINK portion has been customized), or on  the  HP3000
  2531.       (or  other  machines  with process blocking).  An even value of parm
  2532.       should normally be specified to avoid an initial debug trap.  
  2533.       
  2534.       
  2535.                                    WARNING: 
  2536.       
  2537.                 some earlier versions of  these  programs  exist
  2538.                 without  the  delay  feature.   They  should  be
  2539.                 replaced when found.  
  2540.       
  2541.       
  2542.       
  2543.       
  2544.       11.6  MINI-MANUALS 
  2545.       
  2546.       
  2547.       
  2548.       
  2549.       
  2550.       11.6.1  COPYCOLS (left_column, right_column) <infile >outfile 
  2551.       
  2552.       copies  left_column  through  right_column  from  infile to outfile.
  2553.       Left_column defaults to 1, and right_column to  132  (the  maximum).
  2554.       Indentation  codes  are  expanded  before measuring column position.
  2555.       Lines longer that 132 characters cannot be processed.  
  2556.       
  2557.       
  2558.       
  2559.       
  2560.       11.6.2  COPYTEXT <infile >outfile [optional_parm] 
  2561.       
  2562.       simply copies all input to the output.   No  indentation  codes  are
  2563.       expanded.   There is no limit to line length.  The PIP [b] option is
  2564.       supported (see above).  
  2565.       
  2566.       
  2567.       
  2568.       
  2569.       11.6.3  TYPETEXT <infile [>outfile may be specified, but is useless] 
  2570.       
  2571.       copies infile to "output", normally  the  user  console,  and  halts
  2572.       every  20  lines  until  a  <ret> is entered.  Indentation codes are
  2573.       expanded, and lines longer  that  80  characters  are  wrapped  into
  2574.       multiple  lines.   TYPETEXT  actually  uses  another  file (KBD) for
  2575.       non-echoing interaction with the operator.  This interaction reduces 
  2576.       its  portability.   Some versions may wrap at 79 characters to allow
  2577.       for terminals that wrap at 80 characters without detecting  that  no
  2578.       more  characters  follow.   An  EndofFile (control-z under CPM) when
  2579.       <ret> is expected ends the pauses permanently.  A control-c at  this
  2580.       point  exits  the  program.  [parm] may optionally be specified, and
  2581.             
  2582.       
  2583.       
  2584.       FILTERS and CONVENTIONS       Ch. 11-4        Pascal-P Manual v3.1.9 
  2585.       
  2586.       
  2587.       alters the default pagesize of 20.  Use an even number to  avoid  an
  2588.       initial debug trap.  
  2589.       
  2590.       
  2591.       
  2592.       
  2593.       11.6.4  EXPAND <infile >outfile 
  2594.       
  2595.       is  logically equivalent to COPYTEXT, but expands indentation codes.
  2596.       There are no provisions for delays etc.  
  2597.       
  2598.       
  2599.       
  2600.       
  2601.       11.6.5  COMPRESS <infile >outfile 
  2602.       
  2603.       is the inverse of EXPAND.  Files occupy less disk space, and require 
  2604.       less  transmission  time after this, but are still perfectly legible
  2605.       to compilers etc.  They remain comprehensible, but  not  pretty,  to
  2606.       human viewers.  
  2607.       
  2608.       
  2609.       
  2610.       
  2611.       11.6.6  STRIPNUM <infile >outfile 
  2612.       
  2613.       removes  any line numbers from infile.  See above for the definition
  2614.       of a line number.  The PIP [b] option is supported, see above.  
  2615.       
  2616.       
  2617.       
  2618.       
  2619.       11.6.7  ADDNUMS <infile >outfile [optional_parm] 
  2620.       
  2621.       adds sequential  line  numbers  to  a  textfile.   If  a  [parm]  is
  2622.       specified  it  sets the initial line number -1, i.e.  the first line
  2623.       will be numbered one higher.  This is consistent  with  the  default
  2624.       zero value of parm.  
  2625.       
  2626.       
  2627.       
  2628.       
  2629.       11.6.8  WSTOTEXT <infile >outfile [optional_parm] 
  2630.       
  2631.       is  a  preliminary program.  It converts the special characters in a
  2632.       WordStar document file to the normal Ascii set, removing any un-used 
  2633.       "soft"  hyphens,  suppressing  trailing  blanks  on  lines, etc.  In
  2634.       addition any "dot commands" (i.e.  lines beginning with a "."),  and
  2635.       pagination  are  deleted.   EOF  is correctly set in the output file
  2636.       (see the WARNING below).  [parm],  if  specified,  serves  the  same
  2637.       function as the WordStar ".po" dot command, and inserts blank spaces 
  2638.       at the left of each line.  This document was  prepared  on  WordStar
  2639.       and passed through WSTOTEXT.  
  2640.       
  2641.             
  2642.       
  2643.       
  2644.       FILTERS and CONVENTIONS       Ch. 11-5        Pascal-P Manual v3.1.9 
  2645.       
  2646.       
  2647.       11.6.9  REFRENCE <infile >outfile 
  2648.       
  2649.       is a highly specialized filter for showing the structure  of  Pascal
  2650.       source  programs,  and  respects indentation codes.  It also follows
  2651.       all $include filename statements, and, if  parm=100  was  specified,
  2652.       follows  all  (*$i'filename'*)  include  commands.  See the Pascal-P
  2653.       documentation for the specific syntax.  REFRENCE is a  customization
  2654.       of a program by Arthur Sale.  
  2655.       
  2656.       All these filters, with the exception of  REFRENCE,  are  small  and
  2657.       simple  programs.  P-code versions of these filters are all executed
  2658.       by the prefix "runpcd ".   Native  code  versions  are  executed  as
  2659.       shown.  
  2660.             
  2661.       
  2662.       
  2663.       RBM files and HEX files       Ch. 12-1        Pascal-P Manual v3.1.9 
  2664.       
  2665.       
  2666.         
  2667.       
  2668.       
  2669.       
  2670.       
  2671.                                   Chapter 12 
  2672.       
  2673.                             RBM files and HEX files 
  2674.       
  2675.       
  2676.       
  2677.       
  2678.       
  2679.       
  2680.       12.1  General 
  2681.       
  2682.       The  fundamental  relocatable binary modules are known as RBM files.
  2683.       They have  been  designed  to  be  compatible  with  the  INTEL  hex
  2684.       standard, and to be machine independant, in that the only assumption 
  2685.       made is that the host machine addresses in units of bytes.   Modules
  2686.       cannot  exceed  32768  bytes  in length, but no restriction on final
  2687.       code size is made, except that external values must  be  expressable
  2688.       in  two  bytes  for arithmetic to be performed.  Limitations on name
  2689.       length  have  been  expressly  avoided,  although  present  software
  2690.       truncates all names to 8 characters.  
  2691.       
  2692.       The structure of RBM files is best explained by first explaining HEX 
  2693.       files.  
  2694.       
  2695.       A HEX file is made up entirely of printing characters,  and  can  be
  2696.       tranmitted and manipulated as a text file.  A record, in a HEX file, 
  2697.       begins with the ":" character, has several  fields  containing  only
  2698.       the hexadecimal characters '0' through '9' and 'A' through 'F'.  The 
  2699.       fields are as follows: 
  2700.       
  2701.       
  2702.           colon     The character ":", beginning a record.  
  2703.       
  2704.           length    2 hex characters, describing a value in the range 
  2705.                     0  to  255 only.  This value specifies the length
  2706.                     of the remainder of the record.  
  2707.       
  2708.           address   4 hex characters, describing an  address  in  the
  2709.                     range  0  to 65535 (under some circumstances this
  2710.                     is considered a signed integer  in  the  range  -
  2711.                     32768 to 32767).  
  2712.       
  2713.           type      2 hex characters, describing a value in the range 
  2714.                     0  to 255 only.  The interpretation of this value
  2715.                     is central to the use of RBM files.  
  2716.       
  2717.             
  2718.       
  2719.       
  2720.       RBM files and HEX files       Ch. 12-2        Pascal-P Manual v3.1.9 
  2721.       
  2722.       
  2723.           data      (2 times length) hex characters.   Interpretation
  2724.                     varies with use.  
  2725.       
  2726.           checksum  2 hex characters, such that when  each  character
  2727.                     pair  since  the ":" is considered as a number in
  2728.                     the range (0..255), the sum MODULO  256  will  be
  2729.                     zero.  
  2730.       
  2731.           anything  except a ":" may follow the checksum, and may  be
  2732.                     used for formatting, comments, etc.  It is always 
  2733.                     ignored.  
  2734.       
  2735.       Note that every data item, after the initial colon, can be expressed 
  2736.       as  a  one  byte  value,   thus   reducing   storage   requirements,
  2737.       transmission time, etc.  by at least a factor of 2.  
  2738.       
  2739.       The original INTEL standard defined record types 0 and 1.  Type 0 is 
  2740.       an  absolute  load  code  record,  in  which "address" describes the
  2741.       machine address to be loaded with the first byte in the data  field.
  2742.       Type  1  is  an  end-of-file  record,  with  length always zero, and
  2743.       address describing an address to which execution control  is  to  be
  2744.       transferred.   Type  0,  when length is zero, is treated in the same
  2745.       manner.   By  convention,  a  transfer  address  of  zero  in  these
  2746.       end-of-file  records  signifies  that  no  control transfer is to be
  2747.       made.  
  2748.       
  2749.       
  2750.       
  2751.       
  2752.       12.2  RBM files 
  2753.       
  2754.       RBM records are exact images of HEX records, except that the leading 
  2755.       colon  and  trailing  checksum  have  been  discarded,  and that the
  2756.       information is presented as  8  bit  bytes  in  place  of  pairs  of
  2757.       hexadecimal  characters.  No trailing "anything" field is permitted,
  2758.       and a new record begins immediately after the previous record  ends.
  2759.       Verification  of  storage  is left up to the storage system on which
  2760.       the files reside (typically CRC checksums over the storage  blocks).
  2761.       Thus  RBM  records can be discussed in exactly the same terms as HEX
  2762.       records, and conversion between the systems is easy.  
  2763.       
  2764.       
  2765.       
  2766.       
  2767.       12.2.1  RBM record types 
  2768.       
  2769.       To preserve  compatibility  RBM  files  retain  the  original  INTEL
  2770.       definitions  of record types 0 and 1, and add further types starting
  2771.       at type 128 (080 hex).  In all cases the length byte  describes  the
  2772.       number  of  bytes  in the data field, which may be zero.  Additional
  2773.       types are: 
  2774.       
  2775.       
  2776.       
  2777.             
  2778.       
  2779.       
  2780.       RBM files and HEX files       Ch. 12-3        Pascal-P Manual v3.1.9 
  2781.       
  2782.       
  2783.           128       Relocatable data record.   Exactly  analogous  to
  2784.                     the  absolute  data  record  (0), but the address
  2785.                     field describes the location with respect to  the
  2786.                     base of the current module.  
  2787.       
  2788.           129       End module record.  Address and length are zero.  
  2789.       
  2790.           130       Relocatable Code Module Header.  The  relocatable
  2791.                     records  which  follow are to be placed in a code
  2792.                     segment.  The address field describes  the  total
  2793.                     length  of  the  following code.  The data field,
  2794.                     (which may be empty) may  hold  a  name  for  the
  2795.                     segment of up to 60 characters.  
  2796.       
  2797.           131       Entrypoint  descriptor.   Address  is   a   value
  2798.                     relative  to  the  base  of  the current segment.
  2799.                     Data holds the name of the entrypoint,  in  Ascii
  2800.                     characters.  
  2801.       
  2802.           132       Absolute entry.  Address is  an  absolute  value,
  2803.                     which  is to be used to resolve any referances to
  2804.                     the name  in  the  data  field  (again  in  Ascii
  2805.                     characters).  
  2806.       
  2807.           133       External referance.  Address is  an  index  value
  2808.                     used  by  the  linkage records which follow.  The
  2809.                     data field holds a name, in Ascii,  whose  actual
  2810.                     value  is  described  in some other module.  Note
  2811.                     that the index in the address field will never be 
  2812.                     less than 2, because indices 0 and 1 are reserved 
  2813.                     to  describe  code  and  data   module   relative
  2814.                     relocation.  
  2815.       
  2816.           134       Data module header.  As type 130, except that the 
  2817.                     following  data  records  are to be placed in the
  2818.                     data segment.  
  2819.       
  2820.           135       Alignment Record.  Must  only  occur  immediately
  2821.                     after  a module header record.  Causes the module
  2822.                     to adjust  its  location  so  that  the  absolute
  2823.                     location, modulo the address field, is zero.  The 
  2824.                     data field is unused.  
  2825.       
  2826.           136       Pcd module entry point.   At  linkage  time  this
  2827.                     value  must have the high order 8 bits set to the
  2828.                     module number in which it occured, in the range 1 
  2829.                     to  127  (only  31  at  present).  The data field
  2830.                     contains the entry name.  These records are  used
  2831.                     to    describe   PCD   linkages   in   terms   of
  2832.                     segment/entrynumber pairs.  The occurance of such 
  2833.                     an  entry  point causes LINKER to assume that the
  2834.                     output is to be a PCD program.  
  2835.       
  2836.             
  2837.       
  2838.       
  2839.       RBM files and HEX files       Ch. 12-4        Pascal-P Manual v3.1.9 
  2840.       
  2841.       
  2842.           137       Equate   names.    Not   presently   implemented.
  2843.                     Address field is unused.  The data field contains 
  2844.                     two Ascii names separated by the  "="  character,
  2845.                     as  in  "name1=name2".   Causes all referances to
  2846.                     name1 to be resolved as referances to name2.  The 
  2847.                     data  field should not exceed 60 characters, thus
  2848.                     effectively  limiting  names  to  less  than   30
  2849.                     characters.  
  2850.       
  2851.           138 
  2852.       
  2853.           thru      Reserved, not presently assigned.  
  2854.       
  2855.           143 
  2856.       
  2857.       Types  144 through 159 are reserved as linkage records, in which the
  2858.       type modulo 16 is used as an operator.  The  address  field  (except
  2859.       for  types 152 through 154 below) contains an index, which refers to
  2860.       an external referance record active within this module (or 0 or 1 to 
  2861.       specify  the current code or data segment bases), and the data field
  2862.       contains a list of 16 bit addresses,  in  high  byte  first  format,
  2863.       specifying a location relative to the current module beginning which 
  2864.       is to be adjusted.  All operators discard any  carrys  and  borrows,
  2865.       and  thus never cause arithmetic overflows.  The operators currently
  2866.       assigned are: 
  2867.       
  2868.       
  2869.           144       Add lobytefirst words.   The  value  of  external
  2870.                     referance  is  added  to  the  two  bytes  of the
  2871.                     module.  
  2872.       
  2873.           145       Subtract  lobytefirst.   The  value  of  external
  2874.                     referance is subtracted from the two bytes of the 
  2875.                     module.  
  2876.       
  2877.           146       Add byte.  The value of external  referance,  low
  2878.                     order  8  bits  only, is added to the byte of the
  2879.                     module.  
  2880.       
  2881.           147       Subtract byte.  The value of external  referance,
  2882.                     low  order  8  bits  only, is subtracted from the
  2883.                     byte of the module.  
  2884.       
  2885.           148       Add high byte.  The value of external  referance,
  2886.                     high  order  8 bits only, is added to the byte of
  2887.                     the module.  
  2888.       
  2889.           149       Subtract  high  byte.   The  value  of   external
  2890.                     referance,  high order 8 bits, is subtracted from
  2891.                     the byte of the module.  
  2892.       
  2893.             
  2894.       
  2895.       
  2896.       RBM files and HEX files       Ch. 12-5        Pascal-P Manual v3.1.9 
  2897.       
  2898.       
  2899.           150       Add hibytefirst words.  Similar to type 144,  but
  2900.                     the  module  contents  is  treated as a high byte
  2901.                     first integer.  Note that this  does  not  affect
  2902.                     the value of the external.  
  2903.       
  2904.           151       Subtract hibytefirst words.  As 150, but external 
  2905.                     referance is subtracted from the module content.  
  2906.       
  2907.       Types 152  through  154  are  anonymous  linkage  records.   Address
  2908.       contains  the  value of the "external", rather than an index to it's
  2909.       entry  record.   These  records  permit  construction  of  one  pass
  2910.       assemblers  and  codegenerators, by postponing "fixup" operations to
  2911.       linkage time.  Since modules are  in  their  most  compact  form  at
  2912.       linkage  time,  and  since general code generation always requires a
  2913.       two pass algorithm at some point,  the  linkage  step  is  the  most
  2914.       efficient point at which to implement the second pass.  
  2915.       
  2916.       
  2917.           152       Add lowbytefirst fixup linkage.  
  2918.       
  2919.           153       Add hibytefirst fixup linkage.  
  2920.       
  2921.           154       Add byte (8 bits only) fixup linkage.  
  2922.       
  2923.       
  2924.           155 
  2925.       
  2926.           thru      Unassigned operators.  
  2927.       
  2928.           159 
  2929.       
  2930.       
  2931.           160 
  2932.       
  2933.           thru      Reserved for future use.  
  2934.       
  2935.           191 
  2936.       
  2937.       
  2938.           192 up    Available for system dependant special operations 
  2939.                     which  cannot  be  handled by the existing types.
  2940.                     No reliance on portablity  should  be  made  when
  2941.                     these types are used.  
  2942.       
  2943.       
  2944.       
  2945.       
  2946.       12.3  Utility Programs 
  2947.       
  2948.       The  utility  programs  HEXTORBM  and  RBMTOHEX  perform conversions
  2949.       between RBM and HEX files, and are principally used to transfer  RBM
  2950.       files  over  transmission  links (e.g.  RS232 lines).  RBM files are
  2951.       generated by assemblers, compilers, etc, and linked into  executable
  2952.             
  2953.       
  2954.       
  2955.       RBM files and HEX files       Ch. 12-6        Pascal-P Manual v3.1.9 
  2956.       
  2957.       
  2958.       programs  by  LINKER.   LINKER  operation  is documented separately.
  2959.       RBMLOAD converts  RBM  files  which  contain  only  absolute  loader
  2960.       records,  into  program  files.   HEXLOAD  is the equivalent for HEX
  2961.       files, and similar  to  the  CPM  standard  program  LOAD.   However
  2962.       HEXLOAD  and  RBMLOAD use the file redirection systems, and are thus
  2963.       much more flexible.  RBMTOHEX also has provisions  for  co-operation
  2964.       with the PIP [b] option.  See the manual on FILTERS.  
  2965.       
  2966.       The typical execution command is 
  2967.       
  2968.                B>runpcd hextorbm(hexfile, rbmfile) 
  2969.       
  2970.       or 
  2971.       
  2972.                B>runpcd rbmtohex(rbmfile, hexfile); [parm] 
  2973.       
  2974.       For example, to transfer a rbm file named MYFILE.RBM over  an  RS232
  2975.       link,  such as a modem, on the PUN device, with 10 second delays for
  2976.       buffer flushing by the receiver, enter: 
  2977.       
  2978.                B>runpcd rbmtohex(myfile.rbm, pun); [10] 
  2979.       
  2980.       If no files can be found for the input files  (hexfile  or  rbmfile)
  2981.       the  programs  will prompt for their names, and request confirmation
  2982.       before purging  any  previous  versions  of  the  destination  file.
  2983.       RBMLOAD and HEXLOAD act in the identical manner.  
  2984.       
  2985.       BINHEX (binfile, hexfile) can be used to  convert  binary  files  to
  2986.       absolute  load  hex  files.   By default the origin is set at 0100h.
  2987.       The output may be converted  back  to  a  binary  file  by  HEXLOAD.
  2988.       [parm]  may  be  used  to co-operate with PIP operating with the [b]
  2989.       option.  See "FILTERS".  
  2990.       
  2991.       
  2992.       See the separate documentation on LINKER and its companion SCANRBMS.  
  2993.             
  2994.       
  2995.       
  2996.       LINKER v1.1.4                 Ch. 13-1        Pascal-P Manual v3.1.9 
  2997.       
  2998.       
  2999.         
  3000.       
  3001.       
  3002.       
  3003.       
  3004.                                   Chapter 13 
  3005.       
  3006.                                  LINKER v1.1.4 
  3007.       
  3008.       
  3009.       
  3010.       
  3011.       
  3012.       
  3013.       
  3014.       13.1  GENERAL 
  3015.       
  3016.       
  3017.       LINKER  (and  the companion program SCANRBMS, documented separately)
  3018.       scans relocatable binary module files and  forms  an  absolute  load
  3019.       module.   The  command structure is flexible, and designed to permit
  3020.       either interactive operation or  complete  control  in  the  command
  3021.       line,  using the standard file redirection facilities, together with
  3022.       the "indirect" and library files detailed  below.   The  "RBM"  (See
  3023.       RBMFILES  documentation)  format code files are machine independant,
  3024.       but do expect a byte addressing system with addresses up  to  65535.
  3025.       Byte  and  word  externals/relocation,  with either high byte or low
  3026.       byte first word order, separation of data  areas  from  code  areas,
  3027.       module  alignment,  segmented .PCD files, and "fixups" from one pass
  3028.       code generators are catered for.  Name length  is  controlled  by  a
  3029.       compile time constant, and is presently set to 8 characters.  
  3030.       
  3031.       File names are accepted up to an empty line.  Any filename  preceded
  3032.       by "@" specifies indirect access, i.e.  that file contains a list of 
  3033.       files, which may in turn use indirect access.  
  3034.       
  3035.       In  interactive  (normal) mode, following the empty filename prompts
  3036.       are made for the output file name, code and data load points.  After 
  3037.       the  input  has  then  been  scanned,  if  any external names remain
  3038.       undefined, the operator is prompted for  further  module  names.   A
  3039.       "no"  reply  here causes any such undefined names to be evaluated as
  3040.       zero.  
  3041.       
  3042.       A  file  name  beginning  with  "-"  specifies  a library file.  The
  3043.       default extension is ".LBR".   The  name  "-"  alone  specifies  the
  3044.       default library file, which is "RBMS.LBR".  Note that the "-" is not 
  3045.       part of the filename, but  must  directly  precede  it  without  any
  3046.       intervening  spaces.   The  default  library  file  is automatically
  3047.       selected unless a "-nul" (or other empty or non-existant file)  file
  3048.       name  is specified.  Note that nul is the system defined bit-bucket,
  3049.       and always exists.  
  3050.       
  3051.       
  3052.             
  3053.       
  3054.       
  3055.       LINKER v1.1.4                 Ch. 13-2        Pascal-P Manual v3.1.9 
  3056.       
  3057.       
  3058.       13.2  SEARCH ORDER: 
  3059.       
  3060.       
  3061.       Files  and  modules  are  searched  in the following order (unless a
  3062.       specific drive has been specified, when the search is limited  to  a
  3063.       file on that drive): 
  3064.       
  3065.            1:   On the default drive.  
  3066.            2:   On the system drive.  
  3067.            3:   If a module (not a library) is not yet found,  it  is
  3068.                 searched  in  the  current library.  When the library
  3069.                 was selected it used the above search pattern.  
  3070.       
  3071.       If  a  file  is  found on other than the default drive, it's name is
  3072.       revised to show the drive.  If a module is found as a file it's name 
  3073.       is upshifted.  If found in a library the name is unchanged.  
  3074.       
  3075.       Thus files, modules, indirect files, may exist on up to two  drives,
  3076.       and  modules and indirect files may be found as files or as modules.
  3077.       This allows an existing library module to be re- placed by  creating
  3078.       a  file with the same name, without altering the library in any way.
  3079.       If all is well the library may then be permanently altered with  the
  3080.       public  domain  LU  (library  utility)  program  and the replacement
  3081.       module file removed.  
  3082.       
  3083.       
  3084.       
  3085.       
  3086.       
  3087.       13.3  BATCH OPERATION: 
  3088.       
  3089.       
  3090.       A numerical input (hex with  a  leading  digit)  to  the  "filename"
  3091.       prompt  is  a  specification  of the load point.  A second numerical
  3092.       input specifies the data  load  point.   Any  such  numerical  input
  3093.       causes  the  system  to  operate  in  the batch mode, and no further
  3094.       prompts are output.  In particular no  opportunity  then  exists  to
  3095.       resolve  undefined  labels by adding further modules.  Similarly any
  3096.       end of file  on  "INPUT"  (or  the  file  from  which  it  has  been
  3097.       redirected) causes operation in the batch mode.  
  3098.       
  3099.       
  3100.       
  3101.       
  3102.       
  3103.       13.4  CONNECTION TO PREVIOUSLY LINKED MODULES: 
  3104.       
  3105.       
  3106.       Any file name whose group/extension begins with ".CON" is considered 
  3107.       a connector file.  Any such file must contain  only  absolute  entry
  3108.       points,  (NOT  CHECKED),  and  is  used  only  to  resolve undefined
  3109.       external referances  at  that  point  in  the  loading  process.   A
  3110.       connector  file  can be created from the loaded module by specifying
  3111.             
  3112.       
  3113.       
  3114.       LINKER v1.1.4                 Ch. 13-3        Pascal-P Manual v3.1.9 
  3115.       
  3116.       
  3117.       file "cnct" in the run command with PARM=2.  Such a "cnct"  file  is
  3118.       in RBM format, specifying absolute values.  
  3119.       
  3120.       
  3121.       
  3122.       
  3123.       
  3124.       13.5  RUN-TIME OPTIONS: 
  3125.       
  3126.       
  3127.       Several run-time options may be selected by numerical "parm" values, 
  3128.       specified within "[]" on the command line.  For multiple options use 
  3129.       the sum of the values.  
  3130.       
  3131.         Value Effect 
  3132.           2   Generate a "cnct" file with  a  listing  of  all  entry
  3133.               points.  See above.  
  3134.           4   Generate  an  output  listing  (on  "loadmap")  of  the
  3135.               complete symbol table.  
  3136.           10  Generate output code in "RBM" absolute  loader  format,
  3137.               rather  than  as  a  "COM" format file.  This format is
  3138.               forced if initialized data segments exist in the  input
  3139.               modules,  since a continuous output binary image cannot
  3140.               be generated.  
  3141.       
  3142.       
  3143.       
  3144.       
  3145.       13.6  MACHINE DEPANDANCIES: 
  3146.       
  3147.       
  3148.       On word addressing machines where an integer occupies only one  unit
  3149.       of  storage  (e.g.  HP3000) the sense of the parm=4 and parm=10 bits
  3150.       is reversed.  Such  output  is  normally  used  to  down-load  other
  3151.       machines,  and  a  binary  file  is useless.  Time and disk space to
  3152.       generate complete symbol table listings are less critical,  and  the
  3153.       table  is  normally  examined  later by listing it.  In addition, on
  3154.       such  machines  no  libraries  are  presently  used,  nor  do  drive
  3155.       specifiers or searches apply.  
  3156.       
  3157.       
  3158.       
  3159.       
  3160.       
  3161.       
  3162.       13.7  EXAMPLE: 
  3163.       
  3164.       
  3165.       To  link  and  relocate  modules  "a.y" and "b.y" to origin 0100h on
  3166.       codefile "ab.com" 
  3167.       
  3168.        
  3169.       B>linker (ab.com, con) 
  3170.       LINKER (objfile,  loadmap,  cnct, input, output); Ver. 1.1.4 
  3171.             
  3172.       
  3173.       
  3174.       LINKER v1.1.4                 Ch. 13-4        Pascal-P Manual v3.1.9 
  3175.       
  3176.       
  3177.       filename >a.y 
  3178.       filename >b.y 
  3179.       filename > 
  3180.       Loadfile (code)   (default "objfile") = ? 
  3181.       Code address (default 100H)       hex = ? 
  3182.       Data address (default after code) hex = ? 
  3183.        
  3184.       <<output showing modules loaded and starting addresses>> 
  3185.        
  3186.       <<output showing the final loadmap, with data relocated>> 
  3187.       <<this output is routed to formal file "loadmap", and  >> 
  3188.       <<may contain a symbol table.  See parm=4 above        >> 
  3189.             
  3190.       
  3191.       
  3192.       Validation                    A-1             Pascal-P Manual v3.1.9 
  3193.       
  3194.       
  3195.                                   Appendix A 
  3196.       
  3197.                  Validation Suite Results (Preliminary 3.0.79) 
  3198.       
  3199.       
  3200.       Pascal Processor Identification 
  3201.         Machines     :  8080 under CPM 2.2, Interpreter 2.2.6 
  3202.                         HP3000 under MPE HP32002C.G0.C3 
  3203.         Compiler     :  Pascal-P V3.0.79 (Revised to 3.1.1) 
  3204.         Level        :  0 
  3205.         Date         :   8 Mar. 1983 
  3206.         Tests by     :  C.B.Falconer 
  3207.         Test Version : 3.1 
  3208.       
  3209.       
  3210.                                      NOTE 
  3211.       
  3212.                 system maxset is 127.  Tests 6.7.1-9 & 6.7.2.4-6 
  3213.                 modified accordingly.  
  3214.       
  3215.       Conformance Tests:             HP3000        8080 CPM 
  3216.       =================              ======        ======== 
  3217.       Number of tests passed       =    166             159 
  3218.       Number of tests failed       =     13              20 
  3219.       
  3220.       Details of failed tests: 
  3221.       
  3222.                Six primary reasons (apply to both systems) : 
  3223.       
  3224.            1.  functional and procedural parameters are  not  implemented.
  3225.                Affects tests: 
  3226.                          6.6.3.1-4      6.6.3.4-1      6.6.3.4-2 
  3227.                          6.6.3.5-1 
  3228.       
  3229.            2.  Variables are identified by their initial 8  chars.   only.
  3230.                Affects: 
  3231.                          6.1.3-2        6.4.3.5-11 
  3232.       
  3233.            3.  (*  *)  and  {}  comments are separate, and one type may be
  3234.                nested within the other, although comments  of  any  single
  3235.                type may not be nested.  Affects: 
  3236.                          6.1.9-1 
  3237.       
  3238.            4.  GOTO's   out   of   a   procedure/function  block  are  not
  3239.                implemented.  Affects: 
  3240.                          6.8.2.4-1 
  3241.       
  3242.            5.  File types can be used in structured variables, but only if 
  3243.                the   system  special  standard  procedure  FILEINIT(f)  is
  3244.                executed on each such file, i.e.  array of file.   Test  is
  3245.                successful with this change.  Affects: 
  3246.                          6.4.3.5-4 
  3247.       
  3248.            6.  CASE table size restricted to 1000 entries.  Affects: 
  3249.             
  3250.       
  3251.       
  3252.       Validation                    A-2             Pascal-P Manual v3.1.9 
  3253.       
  3254.       
  3255.                          6.8.3.5-2 
  3256.       
  3257.                Implementation errors detected (both systems): 
  3258.       
  3259.            7.  Functional values may only  be  assigned  within  the  main
  3260.                function block.  Affects: 
  3261.                          6.2.2-6 
  3262.       
  3263.            8.  Real output formatting is non-standard.  
  3264.                          6.9.3.5.1-1    6.9.3.5.1-2 
  3265.       
  3266.                8080 CPM implementation errors detected: 
  3267.       
  3268.            9.  In the  CPM  file  environment,  for  non  TEXT  files,  no
  3269.                accurate   EOF  marker  is  available.   Thus  eof  is  not
  3270.                necessarily set  after  read-back  from  a  non-text  file.
  3271.                6.4.3.5-11 already failed for identifier length.  Affects: 
  3272.                          6.4.3.5-5      6.5.3.5-6      6.4.3.5-7 
  3273.                          6.4.3.5-8      6.5.3.5-9      6.4.3.5-10 
  3274.                          6.4.3.5-11     6.4.3.5-12 
  3275.       
  3276.       
  3277.                                      NOTE 
  3278.       
  3279.                 Except as noted  above  for  system  maxset,  no
  3280.                 textual  changes  whatsoever  were  made  to the
  3281.                 validation suite programs.  
  3282.             
  3283.       
  3284.       
  3285.       Compilation Example           B-1             Pascal-P Manual v3.1.9 
  3286.       
  3287.       
  3288.                                   Appendix B 
  3289.       
  3290.                               Compilation Example 
  3291.       
  3292.       
  3293.         This is the sole operator input for this example 
  3294.         ------------------------------------------------------ 
  3295.       B>job pascpcd typetext.pas con typetext.pcd typetext.pcd 
  3296.       JOB V1.2 
  3297.        
  3298.       B>; PcdCompile source listing pcd tic codelist options 
  3299.       B>; For unsegmented programs with no intrinsic/external calls. 
  3300.       B>; Use "NUL" for any unwanted files 
  3301.       B>; Tic may later be used to create assembly source with ASSMAP. 
  3302.       B>; Tic and pcd may be identical to save disk space 
  3303.       B>;   since assmpcd does not use pcd until tic has been read. 
  3304.       B>; Set options 128 for listing on assmpcd listing 
  3305.       B>;   (8 bit compiles for 16 bit machine(HP3000) with increasing stack) 
  3306.       B>;   (16 bit forces RBM format output on pcd) 
  3307.       B>RUNPCD pascalp (TYPETEXT.PAS,CON,TYPETEXT.PCD);[] 
  3308.        
  3309.        
  3310.       PascalP system Ver. 2.3.0 Copyright (C) 1982 
  3311.       CP/M installation rev. 2.3 
  3312.       PASCALP (pasctext, pasclist, prr, ef, output); V 3.1.0 
  3313.       83/09/07  9:57               PASCAL-P Universal Compiler Ver. 3.1.0 
  3314.        
  3315.           1000     0:d   PROGRAM typetext(kbd, input, output); 
  3316.           2000     0:d   (* Modification of "EXPAND" to paginate to crts    *) 
  3317.           3000     0:d   (* and wrap over-long lines into multiple lines.   *) 
  3318.           4000     0:d   (* Converts textfiles, replacing indention codes   *) 
  3319.           5000     0:d   (* by spaces.       dle, ' '+i represents i spaces *) 
  3320.           6000     0:d   (* Revised 14 July 83 to handle the sequences      *) 
  3321.           7000     0:d   (*   dle eoln     and     dle code eoln            *) 
  3322.           8000     0:d   (* both are mapped into simply eoln.  This avoids  *) 
  3323.           9000     0:d   (* anomolies generated by a UCSD format editor.    *) 
  3324.          10000     0:d   (* Assumes no non-printing characters in input     *) 
  3325.          11000     0:d 
  3326.          12000     0:d     LABEL 1; 
  3327.          13000     0:d 
  3328.          14000     0:d     CONST 
  3329.          15000     0:d       dle      = 16; 
  3330.          16000     0:d       pagesize = 24;   (* lines *) 
  3331.          17000     0:d       linesize = 80;   (* columns *) 
  3332.          18000     0:d 
  3333.          19000     0:d     VAR 
  3334.          20000     0:d       c        : char; 
  3335.          21000     1:d       linenum, 
  3336.          22000     1:d       column   : integer; 
  3337.          23000     5:d       kbd      : text; (* for continue/terminate control only *) 
  3338.          24000   191:d 
  3339.          25000   191:d   (*$n-,d- No runtime checks or linenos for speed *) 
  3340.          26000   191:d 
  3341.          27000   191:d     (* 1--------------1 *) 
  3342.             
  3343.       
  3344.       
  3345.       Compilation Example           B-2             Pascal-P Manual v3.1.9 
  3346.       
  3347.       
  3348.          28000   191:d 
  3349.          29000   191:d     PROCEDURE pause; 
  3350.          30000     0:d 
  3351.          31000     0:d       BEGIN (* pause *) 
  3352.          32000     0: 2      IF eof(kbd) THEN terminate 
  3353.          33000    11: 4      ELSE readln(kbd); 
  3354.          34000    21: 2      linenum := 1; 
  3355.          35000    25: 2      END; (* pause *) 
  3356.          36000    27: 2 
  3357.          37000    27: 2    (* 1--------------1 *) 
  3358.          38000    27: 2 
  3359.          39000    27: 2    PROCEDURE linewrap; 
  3360.          40000    27: 2 
  3361.          41000    27: 2      BEGIN (* linewrap *) 
  3362.          42000     0: 2      IF column > linesize THEN BEGIN (* linewrap *) 
  3363.          43000    11: 4        column := 1; linenum := succ(linenum); 
  3364.          44000    22: 4        IF linenum > pagesize THEN pause; 
  3365.          45000    32: 4        writeln; END; 
  3366.          46000    37: 2      END; (* linewrap *) 
  3367.          47000    39: 2 
  3368.          48000    39: 2    (* 1--------------1 *) 
  3369.          49000    39: 2 
  3370.          50000    39: 2    BEGIN (* typetext *) 
  3371.          51000     0: 1    reset(kbd); linenum := 1; column := 1; 
  3372.          52000    41: 1    WHILE NOT eof DO BEGIN 
  3373.          53000    50: 3      WHILE NOT eoln DO BEGIN 
  3374.          54000    59: 5        read(c); 
  3375.          55000    67: 5        WHILE c = chr(dle) DO BEGIN 
  3376.          56000    75: 7          IF NOT eoln THEN read(c); 
  3377.          57000    92: 7          IF eoln THEN GOTO 1 (* dle eoln & dle code eoln -> eoln *) 
  3378.          58000   103: 9          ELSE BEGIN 
  3379.          59000   106: 9            IF c > ' ' THEN BEGIN 
  3380.          60000   114:11              write(' ' : ord(c)-ord(' ')); 
  3381.          61000   125:11              column := column + ord(c) - ord(' '); END; 
  3382.          62000   137: 9            read(c); END; 
  3383.          63000   145: 7          END; 
  3384.          64000   147: 5        write(c); column := succ(column); 
  3385.          65000   163: 5        IF (column > linesize) AND NOT eoln THEN linewrap; END; 
  3386.          66000   182: 3  1:  readln; column := 1; linenum := succ(linenum); 
  3387.          67000   198: 3      IF linenum > pagesize THEN pause; 
  3388.          68000   208: 3      writeln; END; 
  3389.          69000   215: 1    END. (* typetext *) 
  3390.        
  3391.       NO. ERRORS=0 WARNINGS=0 Program size(pcode bytes)=288 
  3392.        
  3393.       NO. ERRORS=0 WARNINGS=0 Program size(pcode bytes)=288 
  3394.        
  3395.       Exit Pascal system, Max heap use @9F0C 
  3396.       B>RUNPCD assmpcd (TYPETEXT.PCD,TYPETEXT.PCD,);[] 
  3397.        
  3398.        
  3399.       PascalP system Ver. 2.3.0 Copyright (C) 1982 
  3400.       CP/M installation rev. 2.3 
  3401.       EXECUTABLE Code size (bytes) is 301 = 012D (hex) 
  3402.             
  3403.       
  3404.       
  3405.       Compilation Example           B-3             Pascal-P Manual v3.1.9 
  3406.       
  3407.       
  3408.        
  3409.       Exit Pascal system, Max heap use @6E7E 
  3410.       B>era temp0001.$$$ 
  3411.       B> 
  3412.             
  3413.       
  3414.       
  3415.       Compilation with codelisting  C-1             Pascal-P Manual v3.1.9 
  3416.       
  3417.       
  3418.                                   Appendix C 
  3419.       
  3420.                          Compilation with codelisting 
  3421.       
  3422.       
  3423.         This is the sole operator input for this example 
  3424.         -------------------------------------------------------------- 
  3425.       B>job pascpcd typetext.pas nul typetext.pcd typetext.pcd con 128 
  3426.       JOB V1.2 
  3427.        
  3428.       B>; PcdCompile source listing pcd tic codelist options 
  3429.       B>; For unsegmented programs with no intrinsic/external calls. 
  3430.       B>; Use "NUL" for any unwanted files 
  3431.       B>; Tic may later be used to create assembly source with ASSMAP. 
  3432.       B>; Tic and pcd may be identical to save disk space 
  3433.       B>;   since assmpcd does not use pcd until tic has been read. 
  3434.       B>; Set options 128 for listing on assmpcd listing 
  3435.       B>;   (8 bit compiles for 16 bit machine(HP3000) with increasing stack) 
  3436.       B>;   (16 bit forces RBM format output on pcd) 
  3437.       B>RUNPCD pascalp (TYPETEXT.PAS,NUL,TYPETEXT.PCD);[128] 
  3438.        
  3439.        
  3440.       PascalP system Ver. 2.3.0 Copyright (C) 1982 
  3441.       CP/M installation rev. 2.3 
  3442.       PASCALP (pasctext, pasclist, prr, ef, output); V 3.1.0 
  3443.        
  3444.       NO. ERRORS=0 WARNINGS=0 Program size(pcode bytes)=288 
  3445.        
  3446.       Exit Pascal system, Max heap use @9F0C 
  3447.       B>RUNPCD assmpcd (TYPETEXT.PCD,TYPETEXT.PCD,CON);[128] 
  3448.        
  3449.        
  3450.       PascalP system Ver. 2.3.0 Copyright (C) 1982 
  3451.       CP/M installation rev. 2.3 
  3452.       ASSMPCD (assmtext, rbmfile, listfile, output) Ver. 1.1.8 
  3453.       ;    1000     0:d   PROGRAM typetext(kbd, input, output); 
  3454.       ;    2000     0:d   (* Modification of "EXPAND" to paginate to crts    *) 
  3455.       ;    3000     0:d   (* and wrap over-long lines into multiple lines.   *) 
  3456.       ;    4000     0:d   (* Converts textfiles, replacing indention codes   *) 
  3457.       ;    5000     0:d   (* by spaces.       dle, ' '+i represents i spaces *) 
  3458.       ;    6000     0:d   (* Revised 14 July 83 to handle the sequences      *) 
  3459.       ;    7000     0:d   (*   dle eoln     and     dle code eoln            *) 
  3460.       ;    8000     0:d   (* both are mapped into simply eoln.  This avoids  *) 
  3461.       ;    9000     0:d   (* anomolies generated by a UCSD format editor.    *) 
  3462.       ;   10000     0:d   (* Assumes no non-printing characters in input     *) 
  3463.       ;   11000     0:d 
  3464.       ;   12000     0:d     LABEL 1; 
  3465.       0006              PGM  TYPETEXT 
  3466.       ;   13000     0:d 
  3467.       ;   14000     0:d     CONST 
  3468.       ;   15000     0:d       dle      = 16; 
  3469.       ;   16000     0:d       pagesize = 24;   (* lines *) 
  3470.       ;   17000     0:d       linesize = 80;   (* columns *) 
  3471.       ;   18000     0:d 
  3472.             
  3473.       
  3474.       
  3475.       Compilation with codelisting  C-2             Pascal-P Manual v3.1.9 
  3476.       
  3477.       
  3478.       ;   19000     0:d     VAR 
  3479.       ;   20000     0:d       c        : char; 
  3480.       ;   21000     1:d       linenum, 
  3481.       ;   22000     1:d       column   : integer; 
  3482.       ;   23000     5:d       kbd      : text; (* for continue/terminate control only *) 
  3483.       ;   24000   191:d 
  3484.       ;   25000   191:d   (*$n-,d- No runtime checks or linenos for speed *) 
  3485.       ;   26000   191:d 
  3486.       ;   27000   191:d     (* 1--------------1 *) 
  3487.       ;   28000   191:d 
  3488.       ;   29000   191:d     PROCEDURE pause; 
  3489.       ;   30000     0:d 
  3490.       ;   31000     0:d       BEGIN (* pause *) 
  3491.       0006              FWD  PAUSE 
  3492.       ;   32000     0: 2      IF eof(kbd) THEN terminate 
  3493.       0006              PRO  PAUSE 
  3494.       0006              NTR  PAUSE 
  3495.                        PAUSE: 
  3496.       0006 F70000       ENT  1,@5 
  3497.       0009 66FF41       LAO  191 
  3498.       000C F00C         EOF 
  3499.       000E F8FFF0       FJP  @6 
  3500.       ;   33000    11: 4      ELSE readln(kbd); 
  3501.       0011 F025         CSP  TRM 
  3502.       0013              PAR  0 
  3503.       0013 FAFFEB       UJP  @7 
  3504.                        @6: 
  3505.       0016 66FF41       LAO  191 
  3506.       0019 F01B         CSP  RLN 
  3507.       001B              PAR  1 
  3508.                        @7: 
  3509.       ;   34000    21: 2      linenum := 1; 
  3510.       001B 01           LDCI 1 
  3511.       001C 73FFFB       STOI 5 
  3512.       ;   35000    25: 2      END; (* pause *) 
  3513.       001F 00F6         RET  0 
  3514.                       @5=0 
  3515.        
  3516.       ;   36000    27: 2 
  3517.       ;   37000    27: 2    (* 1--------------1 *) 
  3518.       ;   38000    27: 2 
  3519.       ;   39000    27: 2    PROCEDURE linewrap; 
  3520.       ;   40000    27: 2 
  3521.       ;   41000    27: 2      BEGIN (* linewrap *) 
  3522.       0021              FWD  LINEWRAP 
  3523.       ;   42000     0: 2      IF column > linesize THEN BEGIN (* linewrap *) 
  3524.       0021              PRO  LINEWRAP 
  3525.       0021              NTR  LINEWRAP 
  3526.                        LINEWRAP: 
  3527.       0021 F70000       ENT  1,@9 
  3528.       0024 7BFFFD       LDOI 3 
  3529.       0027 50           LDCI 80 
  3530.       0028 CB           GRTI 
  3531.       0029 F8FFD5       FJP  @10 
  3532.             
  3533.       
  3534.       
  3535.       Compilation with codelisting  C-3             Pascal-P Manual v3.1.9 
  3536.       
  3537.       
  3538.       ;   43000    11: 4        column := 1; linenum := succ(linenum); 
  3539.       002C 01           LDCI 1 
  3540.       002D 73FFFD       STOI 3 
  3541.       0030 7BFFFB       LDOI 5 
  3542.       0033 E0           INCI 1 
  3543.       0034 73FFFB       STOI 5 
  3544.       ;   44000    22: 4        IF linenum > pagesize THEN pause; 
  3545.       0037 7BFFFB       LDOI 5 
  3546.       003A 18           LDCI 24 
  3547.       003B CB           GRTI 
  3548.       003C F8FFC2       FJP  @11 
  3549.       003F F301         CGP  1,PAUSE 
  3550.                        @11: 
  3551.       ;   45000    32: 4        writeln; END; 
  3552.       0041 7A000C       LDOA -12 
  3553.       0044 F01D         CSP  WLN 
  3554.       0046              PAR  1 
  3555.                        @10: 
  3556.       ;   46000    37: 2      END; (* linewrap *) 
  3557.       0046 00F6         RET  0 
  3558.                       @9=0 
  3559.        
  3560.       ;   47000    39: 2 
  3561.       ;   48000    39: 2    (* 1--------------1 *) 
  3562.       ;   49000    39: 2 
  3563.       ;   50000    39: 2    BEGIN (* typetext *) 
  3564.       ;   51000     0: 1    reset(kbd); linenum := 1; column := 1; 
  3565.       0048 F027         MAI  TYPETEXT 
  3566.                        TYPETEXT: 
  3567.       004A F70000       ENT  1,@13 
  3568.       004D 01           LDCI 1 
  3569.       004E 01           LDCI 1 
  3570.       004F 5D86         LDCI 134 
  3571.       0051 0C           LDCI 12 
  3572.       0052 5C084B424420 
  3573.       0058 20202020     LCA  'KBD     ' 
  3574.       005C 08AA         MVS  8 
  3575.       005E 66FF41       LAO  191 
  3576.       0061 F026         CSP  FIN 
  3577.       0063              PAR  9 
  3578.       0063 66FF41       LAO  191 
  3579.       0066 00           LDCA NIL 
  3580.       0067 F019         CSP  RES 
  3581.       0069              PAR  2 
  3582.       0069 01           LDCI 1 
  3583.       006A 73FFFB       STOI 5 
  3584.       006D 01           LDCI 1 
  3585.       006E 73FFFD       STOI 3 
  3586.       ;   52000    41: 1    WHILE NOT eof DO BEGIN 
  3587.                        @14: 
  3588.       0071 7A000A       LDOA -10 
  3589.       0074 F00C         EOF 
  3590.       0076 EC           NOT 
  3591.       0077 F8FF87       FJP  @15 
  3592.             
  3593.       
  3594.       
  3595.       Compilation with codelisting  C-4             Pascal-P Manual v3.1.9 
  3596.       
  3597.       
  3598.       ;   53000    50: 3      WHILE NOT eoln DO BEGIN 
  3599.                        @16: 
  3600.       007A 7A000A       LDOA -10 
  3601.       007D F00B         CSP  ELN 
  3602.       007F              PAR  0 
  3603.       007F EC           NOT 
  3604.       0080 F8FF7E       FJP  @17 
  3605.       ;   54000    59: 5        read(c); 
  3606.       0083 66FFFF       LAO  1 
  3607.       0086 7A000A       LDOA -10 
  3608.       0089 F016         CSP  RDC 
  3609.       008B              PAR  2 
  3610.       ;   55000    67: 5        WHILE c = chr(dle) DO BEGIN 
  3611.                        @18: 
  3612.       008B 79FFFF       LDOC 1 
  3613.       008E 10           LDCI 16 
  3614.       008F B1           EQUC 
  3615.       0090 F8FF6E       FJP  @19 
  3616.       ;   56000    75: 7          IF NOT eoln THEN read(c); 
  3617.       0093 7A000A       LDOA -10 
  3618.       0096 F00B         CSP  ELN 
  3619.       0098              PAR  0 
  3620.       0098 EC           NOT 
  3621.       0099 F8FF65       FJP  @20 
  3622.       009C 66FFFF       LAO  1 
  3623.       009F 7A000A       LDOA -10 
  3624.       00A2 F016         CSP  RDC 
  3625.       00A4              PAR  2 
  3626.                        @20: 
  3627.       ;   57000    92: 7          IF eoln THEN GOTO 1 (* dle eoln & dle code eoln -> eoln *) 
  3628.       00A4 7A000A       LDOA -10 
  3629.       00A7 F00B         CSP  ELN 
  3630.       00A9              PAR  0 
  3631.       00A9 F8FF55       FJP  @21 
  3632.       00AC FAFF52       UGO  @3 
  3633.       ;   58000   103: 9          ELSE BEGIN 
  3634.       00AF FAFF4F       UJP  @22 
  3635.                        @21: 
  3636.       ;   59000   106: 9            IF c > ' ' THEN BEGIN 
  3637.       00B2 79FFFF       LDOC 1 
  3638.       00B5 20           LDCC ' ' 
  3639.       00B6 C9           GRTC 
  3640.       00B7 F8FF47       FJP  @23 
  3641.       ;   60000   114:11              write(' ' : ord(c)-ord(' ')); 
  3642.       00BA 20           LDCC ' ' 
  3643.       00BB 79FFFF       LDOC 1 
  3644.       00BE 20           LDCC ' ' 
  3645.       00BF A0           SBI 
  3646.       00C0 7A000C       LDOA -12 
  3647.       00C3 F01F         CSP  WRC 
  3648.       00C5              PAR  3 
  3649.       ;   61000   125:11              column := column + ord(c) - ord(' '); END; 
  3650.       00C5 7BFFFD       LDOI 3 
  3651.       00C8 79FFFF       LDOC 1 
  3652.             
  3653.       
  3654.       
  3655.       Compilation with codelisting  C-5             Pascal-P Manual v3.1.9 
  3656.       
  3657.       
  3658.       00CB 9E           ADI 
  3659.       00CC 20           LDCC ' ' 
  3660.       00CD A0           SBI 
  3661.       00CE 73FFFD       STOI 3 
  3662.                        @23: 
  3663.       ;   62000   137: 9            read(c); END; 
  3664.       00D1 66FFFF       LAO  1 
  3665.       00D4 7A000A       LDOA -10 
  3666.       00D7 F016         CSP  RDC 
  3667.       00D9              PAR  2 
  3668.                        @22: 
  3669.       ;   63000   145: 7          END; 
  3670.       00D9 FEB1         UJS  @18 
  3671.                        @19: 
  3672.       ;   64000   147: 5        write(c); column := succ(column); 
  3673.       00DB 79FFFF       LDOC 1 
  3674.       00DE 01           LDCI 1 
  3675.       00DF 7A000C       LDOA -12 
  3676.       00E2 F01F         CSP  WRC 
  3677.       00E4              PAR  3 
  3678.       00E4 7BFFFD       LDOI 3 
  3679.       00E7 E0           INCI 1 
  3680.       00E8 73FFFD       STOI 3 
  3681.       ;   65000   163: 5        IF (column > linesize) AND NOT eoln THEN linewrap; END; 
  3682.       00EB 7BFFFD       LDOI 3 
  3683.       00EE 50           LDCI 80 
  3684.       00EF CB           GRTI 
  3685.       00F0 7A000A       LDOA -10 
  3686.       00F3 F00B         CSP  ELN 
  3687.       00F5              PAR  0 
  3688.       00F5 EC           NOT 
  3689.       00F6 EF           AND 
  3690.       00F7 F8FF07       FJP  @24 
  3691.       00FA F302         CGP  0,LINEWRAP 
  3692.                        @24: 
  3693.       00FC FE7D         UJS  @16 
  3694.                        @17: 
  3695.       ;   66000   182: 3  1:  readln; column := 1; linenum := succ(linenum); 
  3696.                        @3: 
  3697.       00FE 7A000A       LDOA -10 
  3698.       0101 F01B         CSP  RLN 
  3699.       0103              PAR  1 
  3700.       0103 01           LDCI 1 
  3701.       0104 73FFFD       STOI 3 
  3702.       0107 7BFFFB       LDOI 5 
  3703.       010A E0           INCI 1 
  3704.       010B 73FFFB       STOI 5 
  3705.       ;   67000   198: 3      IF linenum > pagesize THEN pause; 
  3706.       010E 7BFFFB       LDOI 5 
  3707.       0111 18           LDCI 24 
  3708.       0112 CB           GRTI 
  3709.       0113 F8FEEB       FJP  @25 
  3710.       0116 F301         CGP  0,PAUSE 
  3711.                        @25: 
  3712.             
  3713.       
  3714.       
  3715.       Compilation with codelisting  C-6             Pascal-P Manual v3.1.9 
  3716.       
  3717.       
  3718.       ;   68000   208: 3      writeln; END; 
  3719.       0118 7A000C       LDOA -12 
  3720.       011B F01D         CSP  WLN 
  3721.       011D              PAR  1 
  3722.       011D FE53         UJS  @14 
  3723.                        @15: 
  3724.       ;   69000   215: 1    END. (* typetext *) 
  3725.       011F 66FF41       LAO  191 
  3726.       0122 F00A         CSP  CLO 
  3727.       0124              PAR  1 
  3728.       0124 F024         STP 
  3729.                       @13=192 
  3730.        
  3731.       0126              END 
  3732.       0126 FEFAFEDDFF1D 
  3733.       012C 02 
  3734.        
  3735.         0 TYPETEXT       0048 global 
  3736.         1 PAUSE          0006 global 
  3737.         2 LINEWRAP       0021 global 
  3738.       EXECUTABLE Code size (bytes) is 301 = 012D (hex) 
  3739.        
  3740.       Exit Pascal system, Max heap use @6E7E 
  3741.       B>era temp0001.$$$ 
  3742.       B> 
  3743.       
  3744. e