home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / CPM / TURBOPAS / TRUN.LBR / TRUN.DQC / TRUN.DOC
Text File  |  2000-06-30  |  8KB  |  226 lines

  1.  
  2.  
  3.  
  4.           (c) August, 1985  by Mike Dingacci, MD
  5.  
  6.       This material is hereby placed in the public domain.  
  7.    The author accepts no responsibility for the accuracy 
  8.    of the software, nor for any problems which may result 
  9.    from its use.           - RMD -
  10.  
  11.    Comments or questions to:    P.O. Box 1124
  12.                                 Fallon, Nevada  89406
  13. --------------------------------------------------------------
  14.  
  15.                            TRUN.DOC
  16.                            --------
  17.  
  18.    Turbo Pascal requires that every program must have included
  19. within it the run-time pascal library.  This is usually not a 
  20. problem unless there are many Turbo programs on a disk.  In 
  21. this case, there is a large overhead of storage space for all
  22. those duplicate pascal libraries in every program.
  23.  
  24.    One method of solving this problem has been the inclusion 
  25. of a "menu" program in packages of programs distributed on the
  26. same disk.  An initializing program is used to "chain" to a 
  27. CHN-type menu program.  The pascal library is placed in memory
  28. when the initializing program is run and the menu program 
  29. contains a menu or list of the various CHN-type programs on 
  30. the disk.  The user chooses the appropriate program to run and
  31. the menu program chains to that program.  At the end of the 
  32. run, the chosen program chains back to the menu again.  In 
  33. this way, the user can chain back and forth from the menu to 
  34. the various programs on the disk, using the same pascal 
  35. library already contained in memory.  This works well, but is 
  36. limited to a finite group of programs on the distributed disk.
  37.  
  38.    TRUN is a program which acts as a run-time loader for any 
  39. CHN-type program.  TRUN loads the pascal library into memory 
  40. and then chains to a specified CHN-type program.  The program 
  41. to be run is specified on the command line by using the 
  42. syntax:   TRUN filename<cr>.  If no extension is specified,
  43. the loader will supply CHN as the default file extension.  
  44.  
  45. Example:  TRUN FRAP<cr>   would chain to program FRAP.CHN.  
  46.  
  47. To use an extension other than CHN for chained programs, an 
  48. extension may be specified on the command line.
  49.  
  50. Example:  TRUN FRAP.C30<cr>   would chain to program FRAP.C30.
  51.  
  52.    If no program is specified on the command line, the program
  53. will display an instructional message and then ask for the 
  54. name of the program to be run.  The same syntax for default 
  55. extension holds for program names entered via this prompt.  
  56. If a blank line is entered, the program ends.
  57.  
  58.  
  59.  
  60.  
  61.  
  62.                              p. 1
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.    The advantages of a program of this type are obvious.  You
  71. can now compile all your programs to CHN files instead of COM
  72. files, thus saving 8k+ of space for each program on the disk.
  73. In situations where files are transferred over phone lines  
  74. using modems, the advantages are even more notable.  On a
  75. remote data base, one copy of TRUN could be available and all 
  76. other compiled Turbo programs on the data base would be in
  77. the form of CHN files.  This would save 8k+ of data to be
  78. either uploaded or downloaded with each compiled Turbo pro-
  79. gram.  On services like CompuServe, this could save you a 
  80. fortune, especially if you only have a 300-baud modem.
  81.  
  82.    In order to work under ALL CP/M and MS-DOS versions of 
  83. Turbo Pascal, TWO versions of TRUN are needed.  The first 
  84. version, TRUN28, contains routines for parsing the command 
  85. line with earlier CP/M and MS-DOS Turbo versions 1.0 and 2.0.
  86. It should also work just as well with version 3.0.  For those
  87. who have already written programs using Turbo Pascal v3.0, 
  88. however, parameters may be more easily passed by using the 
  89. standard functions ParamStr and ParamCount.  The second 
  90. version, TRUN3, therefore, uses those standard Turbo v3.0 
  91. functions for parsing the command line.
  92.  
  93. Program Variables:
  94. -----------------
  95.  
  96.    Cmdline:    Contains the entire un-parsed command line.
  97.                Used for passing command line paramters 
  98.                when chaining to CHN programs.  This should  
  99.                be the first variable declared in both the
  100.                TRUN loader and the CHN program which is
  101.                receiving command line parameters.
  102.  
  103.    Cmdbuffer:  Contains the entire command line in
  104.                versions of TRUN which use the Absolute
  105.                variable declaration for the command
  106.                buffer location at $80.
  107.  
  108.    Cmd:        Contains the name of the program being 
  109.                chained to.  An equivalent of ParamStr(1).
  110.                In all versions of TRUN, a file extension
  111.                of ".CHN" is added to this variable if
  112.                no extension is specified in the original
  113.                file name taken from the command line.
  114.                This may be changed to any file extension 
  115.                preferred.  For instance, you may want to
  116.                use ".C3N" as the extension for CHN-type
  117.                files to be used with Turbo v3.0 and TRUN3.
  118.  
  119.    Cmdfile:    Cmd variable is assigned to the file
  120.                variable Cmdfile before chain can occur.
  121.  
  122.    Cmdln:      Integer varaible containing the location of
  123.                the command line copy at the bottom of CCP
  124.                in program TRUN2C (see comments in TRUN2C).
  125.  
  126.  
  127.  
  128.                              p. 2
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.    Ltr:        Integer variable containing the number of
  137.                characters (letters) in the command line.
  138.  
  139.    a:          String variable containing a carriage 
  140.                return + line feed.  Used for pretty 
  141.                formatting of text in the source file, 
  142.                while saving a few bytes of space.
  143.  
  144.    Z:          Integer variable increments to count the
  145.                command line parameters as they are built.
  146.  
  147.    I:          Integer variable increments as a counter  
  148.                in "For" and "While" loops.
  149.  
  150.  
  151.                     For CP/M Programmers
  152.                     --------------------
  153.  
  154.    Most CP/M programs which parse the command line have an 
  155. intrinsic limitation of 32 characters for the length of the
  156. command line.  This is because, in CP/M, the TPA starts at 
  157. address 0100 hex and the command buffer starts at 0080 hex.
  158. Whenever a program is loaded and run, it over-writes any part
  159. of the command tail which extends beyond 0100 hex.  Since the
  160. command buffer starts at 0080 hex and it cannot extend beyond
  161. 0100 hex, its length cannot be over 20 hex or 32 characters.
  162. In Turbo Pascal's version 3.0 for CP/M, this limitation also 
  163. applies when using the functions Paramcount and ParamStr for 
  164. parsing the command line.  Fortunately, whenever a program is 
  165. loaded into the TPA, CP/M places a copy of the entire command
  166. line in high memory near the start of the CCP.  For those who
  167. wish to parse command lines longer than 32 characters, this
  168. copy provides a convenient substitute for the command buffer.
  169. For CP/M users who may need this longer command line, a third 
  170. version of TRUN, named TRUN2C, is provided which parses the
  171. copy in high memory instead of the command buffer.  It should
  172. work with all three CP/M versions of Turbo Pascal, operating
  173. with most standard varieties of CP/M.  It was tested during 
  174. development using Kaypro's CP/M versions 2.2F and 2.2G.
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.                              p. 3
  197.  
  198.  
  199.  
  200. sing Kaypro's CP/M versions 2.2F and 2.2G.
  201.  
  202.  
  203.  
  204.  
  205.  
  206.  
  207.  
  208.  
  209.  
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219.  
  220.  
  221.  
  222.                              p. 3
  223.  
  224.  
  225.  
  226.