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 / SIMTEL / CPMUG / CPMUG052.ARK / BATCH.RM < prev    next >
Text File  |  1984-04-29  |  36KB  |  785 lines

  1.             BATCH Reference Manual
  2.  
  3.             Writing started Feb. 4, 1981
  4.             Revised Feb. 18, 1981
  5.  
  6.             by:
  7.             Daniel Ross
  8.             Succinct Systems
  9.             1346 River St.
  10.             Santa Cruz, Calif. 95060
  11.             phone (408) 426-4197
  12.  
  13. This document is entered into the public domain by its author, Daniel
  14. Ross.  Please do not remove this notice.
  15.  
  16.  
  17. INTRODUCTION
  18. ------------
  19.  
  20. BATCH is a user program which runs on 8080, 8085, or Z80 CP/M systems.
  21. It copies a small amount of code, and some textual data supplied by the
  22. user, into a user-designated "safe" region of main memory.  Then it
  23. temporarily modifies some of the entry addresses of CP/M BIOS, so that
  24. the copied code will intercept subsequent requests for character input.
  25. Instead of normal character input from the console terminal, character
  26. input will be taken from the textual data that had been copied into
  27. safe memory.  Thus any repetitive aspect of typing, either to the CP/M
  28. Console Command Processor or to any other user program, can be
  29. preprogrammed into a text file to be supplied to BATCH.
  30.  
  31. Certain sequences of input characters are recognized as commands to
  32. BATCH.  One command changes the source of character input, to be the
  33. console terminal.  Other commands change the source of character input,
  34. to be the stored textual data.  By including the appropriate commands
  35. in the stored textual data, it is possible to intermix typed input with
  36. preprogrammed input.  Thus, if part of the input is constant and part
  37. is variable, the constant part can be preprogrammed with provision for
  38. typing in the variable part.  The typed-in information can either be
  39. passed along directly to CP/M or a user program, or it can be stored
  40. into a program variable within the BATCH processor, to be fetched later
  41. and used perhaps several times.  Observe that the value of any BATCH
  42. variable always is a character string.
  43.  
  44. One characteristic of using computers, is that the best-laid plans of
  45. mice and men gang oft agley.  If some preprogrammed sequence of
  46. computer operation has gung agley, it may become necessary to intervene
  47. in some unplanned manner from the console terminal.  BATCH can accept
  48. unsolicited character input from the console terminal.  If the
  49. unsolicited characters are commands to BATCH, BATCH will interpret them
  50. and respond accordingly.  Any other unsolicited characters are passed
  51. along to CP/M or to the currently running user program, just as though
  52. the unsolicited characters had been typed in with BATCH absent.  Any
  53. unsolicited character which does not start a command to BATCH, also
  54. changes the source of character input, to be the console terminal.
  55. Thus once unsolicited intervention occurs, that intervention can
  56. continue until BATCH is commanded to resume preprogrammed input.
  57. Alternatively, BATCH may be commanded to terminate its operation
  58. prematurely.
  59.  
  60. In addition to the features mentioned above, BATCH has 2 commands for
  61. generating typed output.
  62.  
  63. The comment command is intended for use in typing out lengthy
  64. explanations or instructions to the human operator.  Comment commands
  65. are interpreted out of sequence from any other BATCH commands.  All
  66. comments are typed out at the start of BATCH execution, prior to
  67. interpreting any other BATCH commands.  Comment text is not copied into
  68. safe memory; therefore comments can be lengthy without requiring that a
  69. large amount of safe memory be withdrawn from accessibility to other
  70. CP/M user programs.
  71.  
  72. The output command is intended for use in typing out brief prompting
  73. messages prior to accepting typed input, or for other applications
  74. involving only a small amount of textual data.  Text used for output is
  75. copied into safe memory.  Output commands are interpreted in sequence
  76. with the other BATCH commands.
  77.  
  78. BATCH terminates operation either in response to a command, or when all
  79. the preprogrammed text has been supplied as character input.  When
  80. BATCH terminates, it restores the original entry addresses of CP/M
  81. BIOS, so that normal character input from the console terminal will
  82. resume.
  83.  
  84. The distribution diskette contains 2 versions of the BATCH program.
  85. The version with full capabilities requires (hex) 3DD = (decimal) 989
  86. bytes of safe memory, exclusive of the safe memory needed to hold the
  87. textual data.  A version with reduced capabilities requires (hex) 1E2 =
  88. (decimal) 482 bytes of safe memory, exclusive of the safe memory
  89. needed to hold the textual data.  The reduced version lacks the output
  90. command and lacks the program variables.
  91.  
  92. When you are deciding whether to use BATCH at all, or choosing which
  93. version of BATCH to use, consider some of the possible reasons for
  94. using BATCH:
  95.  
  96.    To reduce the tedium of repetitive typing of the same input, or of
  97.    input which is almost the same except for a few variables.
  98.  
  99.    To prepare a canned procedure of operations, for use by untrained
  100.    personnel.
  101.  
  102.    To eliminate typing errors in standard sequences of typed input.
  103.  
  104.    To document a sequence of operations, with the aid of the BATCH
  105.    comment and output commands.
  106.  
  107.  
  108. HOW TO START BATCH PROCESSING
  109. -----------------------------
  110.  
  111. Before BATCH can be used at any particular computer installation, the
  112. BATCH program must be customized for that installation.  A later
  113. section of this manual describes how to perform the customization.  In
  114. the remainder of this section, we will assume that a customized BATCH
  115. program already exists.
  116.  
  117. Any CP/M-compatible text editor program may be used to prepare a file
  118. of preprogrammed textual data.  No special editing precautions are
  119. needed when preparing the file.  In particular:
  120.  
  121.    Normal CP/M text files contain a line feed character following
  122.    every carriage return character.  However, users at the console
  123.    terminal are not expected to type in line feed after carriage
  124.    return.  BATCH automatically deletes a line feed if it follows
  125.    carriage return, but permits isolated line feed characters to remain
  126.    in the text file.
  127.  
  128.    BATCH automatically appends a command to terminate BATCH processing,
  129.    after the end of the text in the file.
  130.  
  131. The text file may have any name, and may have any file name extension.
  132. (The file name extension is the 3 characters following the period.  The
  133. "file name extension" also may be called the "file type".)  Let us
  134. assume for example that the file is named PREPROG.RAM.  Then BATCH
  135. processing is initiated by typing in the CP/M command line:
  136. BATCH PREPROG.RAM
  137. If the file name extension is omitted from the CP/M command line, as in:
  138. BATCH PREPROG
  139. then BATCH assumes that the file has the default file name extension
  140. BAT.
  141.  
  142. Once started, BATCH processing continues until commanded to stop, or
  143. until all the preprogrammed text has been supplied as input.
  144.  
  145.  
  146. EXAMPLE BATCH PROCESSING
  147. ------------------------
  148.  
  149. Before proceeding with the explanation of BATCH, it might be helpful to
  150. try running an example BATCH program.
  151.  
  152. Please copy files VARBATCH.COM and EXAMPLE.BAT, from the distribution
  153. diskette to some other diskette that you use for scratchwork.  Although
  154. you might later decide to rename file VARBATCH.COM, or to customize it,
  155. the example should be run with the original file name VARBATCH.COM and
  156. no customization.  Also, you must copy CP/M program DDT.COM onto the
  157. scratch diskette.  DDT.COM is not supplied on the distribution
  158. diskette.
  159.  
  160. If necessary, type in the CP/M command line which will make CP/M use
  161. the scratch diskette as the CP/M "system" diskette.  Then start BATCH
  162. execution by typing in the CP/M command line:
  163. VARBATCH EXAMPLE
  164. The computer will prompt you for the remaining type-in.
  165.  
  166. If the example BATCH program worked properly for you, fine!  If it did
  167. not work properly, do not give up.  Skip over the example for now,
  168. continue reading this manual, and return to the example at some later
  169. convenient time.  There is a section near the end of this manual which
  170. describes some possible reasons why BATCH might not have worked, and
  171. suggests remedies for the problems.
  172.  
  173.  
  174. COMMANDS
  175. --------
  176.  
  177. Each command to BATCH consists of an Escape character followed by a
  178. single letter which distinguishes the various commands.
  179.  
  180. The Escape character is not the ASCII ESC (hex value 1B), because some
  181. text editor programs interpret ESC, thereby preventing ESC from being
  182. included in the stored text.  Instead, the Escape character is ASCII
  183. SOH (Ctrl-A, hex value 01), chosen because it is easy to type and
  184. because it is not in frequent use for any other purpose.
  185.  
  186. The Escape character may be changed as part of the optional
  187. customization of BATCH.  The chosen Escape character should be a
  188. nonprinting control character, so that it will be least likely to have
  189. any other use in conventional programming languages.
  190.  
  191. The commands are:
  192.  
  193.    Escape C                (comment)
  194.  
  195.       The subsequent text is interpreted to be a comment, and is typed
  196.       out on the console terminal.  The comment extends to the next
  197.       BATCH command, or to the end of the file of preprogrammed
  198.       textual data.
  199.  
  200.       Comment commands are interpreted out of sequence from any other
  201.       BATCH commands.  All comments are typed out at the start of
  202.       BATCH execution.  The comment text is not copied into safe
  203.       memory.
  204.  
  205.    Escape O                (typed output)
  206.  
  207.       The subsequent text is typed out on the console terminal.
  208.       Output text extends to the next BATCH command, or to the end of
  209.       the file of preprogrammed textual data.
  210.  
  211.       Output commands are interpreted in sequence with other BATCH
  212.       commands.  The text used for output is copied into safe memory.
  213.  
  214.       The reduced version of BATCH lacks this command.
  215.  
  216.    Escape I                (typed input)
  217.  
  218.       This command has differing interpretations, depending upon the
  219.       current source of character input.
  220.  
  221.       If the current source is preprogrammed text, the source is
  222.       changed immediately to be the console terminal.
  223.  
  224.       If the current source is the console terminal being used normally,
  225.       no change occurs.
  226.  
  227.       If the current normal source is preprogrammed text, but this
  228.       command is typed in as unsolicited input from the console
  229.       terminal, then the source will remain preprogrammed text until
  230.       the end of the current line.  After the end of the line, the
  231.       source will be changed to be the console terminal.  The line can
  232.       be ended by any of the following characters:
  233.      carriage return
  234.      Ctrl-U
  235.      Ctrl-C
  236.       Observe that immediate change to console input occurs if any
  237.       unsolicited character except Escape is typed in.
  238.  
  239.       (See also TYPING CONVENTIONS below.)
  240.  
  241.    Escape B                (batch input)
  242.  
  243.       This command changes the source to be preprogrammed text.  If the
  244.       source already is preprogrammed text, this command has no effect
  245.       other than to cancel out any planned change that was due to an
  246.       unsolicited Escape I command having been typed in.
  247.  
  248.       Before explaining how to use this command, it is necessary to
  249.       describe the typing conventions.
  250.  
  251.       (TYPING CONVENTIONS)
  252.  
  253.       Once the console terminal becomes the source of input, it remains
  254.       the source until Escape B, Escape Z, Ctrl-C, or carriage return
  255.       is typed in.  If several lines of input are to be typed in, all
  256.       but the last line should be ended with line feed instead of
  257.       carriage return.  BATCH passes along a carriage return in place
  258.       of the line feed that was typed in, but does not change the
  259.       source of character input.
  260.  
  261.       If an unsolicited Ctrl-C is typed in from the console terminal,
  262.       BATCH passes along the Ctrl-C character and also immediately
  263.       terminates all BATCH processing.
  264.  
  265.       Thus the BATCH command Escape B is needed only to change the
  266.       source without passing along either carriage return or Ctrl-C.
  267.       It makes possible the typing in of only part of a line, with the
  268.       remainder of the line coming from the preprogrammed text.
  269.  
  270.    Escape R                (ring for attention)
  271.  
  272.       This command enables a mechanism which may be actuated later.  If
  273.       enabled, the bell on the console terminal will ring whenever the
  274.       source of input changes from preprogrammed text to the console
  275.       terminal, if the change was due to preprogramming.  The bell
  276.       also will ring at the end of BATCH processing.  This permits
  277.       BATCH processing to run unattended, yet have the human operator
  278.       alerted when intervention is required.
  279.  
  280.       The bell does not ring if the source is changed due to unsolicited
  281.       type-in.  In that circumstance the human operator obviously does
  282.       not need to be alerted, and there is no point in being any
  283.       noisier than necessary.
  284.  
  285.    Escape Q                (quiet)
  286.  
  287.       This command disables the bell-ringing mechanism.
  288.  
  289.    Escape Y                ("yes" from CONST)
  290.    Escape N                ("no" from CONST)
  291.  
  292.       CONST is called by some other user programs, when they want to
  293.       detect unsolicited type-in.  Generally, they stop execution
  294.       when unsolicited type-in occurs.  Unsolicited type-in is defined
  295.       to be type-in which occurs prior to any programmed request for
  296.       type-in.  Thus, unsolicited type-in is distinguished from
  297.       requested type-in by the time at which the typed-in character
  298.       first becomes available to the user program.  But character
  299.       input from BATCH preprogrammed text always is available in
  300.       advance of any request, because the text had been stored in safe
  301.       memory prior to executing the user programs.  Therefore, BATCH
  302.       must be instructed how to respond to queries about time-
  303.       dependent data availability.
  304.  
  305.       The above commands determine what the BATCH version of BIOS
  306.       procedure CONST passes back as an output parameter, when the
  307.       source of character input is preprogrammed text.  Escape Y causes
  308.       CONST to pass back value (decimal) 255 = (hex) FF.  Escape N
  309.       causes CONST to pass back value 0.
  310.  
  311.       If the source of character input is the console terminal, whether
  312.       the input is normal or due to an unsolicited character being
  313.       typed in, CONST will pass back an output parameter which is
  314.       appropriate for the current state of type-in.  However, if an
  315.       unsolicited BATCH command is being typed in, the command is
  316.       intended only for interpretation by BATCH, and therefore does not
  317.       directly affect the output parameter of CONST.
  318.  
  319.    Escape Z                (terminate BATCH processing)
  320.  
  321.       This command causes BATCH processing to terminate immediately.
  322.       The entry addresses of BIOS are restored to their former values,
  323.       and all subsequent character input will come from the console
  324.       terminal.
  325.  
  326.    Escape S0                (store into BATCH variable 0)
  327.       to
  328.    Escape S9                (store into BATCH variable 9)
  329.  
  330.       The subsequent text is stored into the designated variable.
  331.       Storage continues until the carriage return which ends the input
  332.       line.  A Ctrl-C character in the line, or any BATCH commands in
  333.       the line, are stored without interpretation; they will be
  334.       interpreted when they are fetched back from the variable.
  335.  
  336.       Assume for the moment that the source of character input is
  337.       preprogrammed text.  Then unsolicited type-in of any of the
  338.       commands Escape S0 to Escape S9, causes immediate change of the
  339.       source of character input, to be the console terminal.  Console
  340.       input continues to the end of the line (coinciding with the end
  341.       of the value of the variable), at which time the source of
  342.       character input reverts back to being preprogrammed text.
  343.  
  344.       Preprogrammed storage into variables can be used to provide
  345.       initial default values, which later can be overridden by type-in
  346.       from the console terminal.  In the absence of any storage into
  347.       variables, the BATCH processor has the following initial values:
  348.  
  349.      Variable 0 through variable 6 are initialized to the empty
  350.      string, consisting of no characters.
  351.  
  352.      Variable 7 is initialized to a string consisting of the single
  353.      character Ctrl-P.
  354.  
  355.      Variable 8 is initialized to a string consisting of the single
  356.      character Ctrl-Z.
  357.  
  358.      Variable 9 is initialized to a string consisting of the single
  359.      character Ctrl-C.
  360.  
  361.       It is not possible to store into a variable and fetch from a
  362.       variable simultaneously.
  363.  
  364.       The reduced version of BATCH lacks this set of commands.
  365.  
  366.    Escape F0                (fetch from BATCH variable 0)
  367.       to
  368.    Escape F9                (fetch from BATCH variable 9)
  369.  
  370.       The designated variable becomes the source of character input.
  371.       Characters are fetched from the variable up to, but not
  372.       including, the carriage return that ends the value of the
  373.       variable.  After fetching from the variable, subsequent
  374.       character input is taken from its previous source.
  375.  
  376.       Any BATCH commands that were stored as part of the value of the
  377.       variable, are interpreted when the value is fetched.  In
  378.       particular, the value of one variable may include BATCH commands
  379.       to fetch from other variables.  (Caution:  In order to limit the
  380.       amount of code in the BATCH processor, there is no built-in test
  381.       to prevent recursive fetching from the same variable.  You just
  382.       will have to exercise care, because recursive fetching is
  383.       guaranteed to have unpleasant consequences.)
  384.  
  385.       Any line feed character fetched from a variable, is passed along
  386.       as a carriage return to CP/M or the user program.
  387.  
  388.       The reduced version of BATCH lacks this set of commands.
  389.  
  390.    Escape A0                (answer into BATCH variable 0)
  391.       to
  392.    Escape A9                (answer into BATCH variable 9)
  393.  
  394.       These commands have the same effect as Escape S0 to Escape S9,
  395.       except that the source of character input is changed to be the
  396.       console terminal, until the end of the value of the variable
  397.       being stored.  After storing into the variable, subsequent
  398.       character input is taken from its previous source.
  399.  
  400.       These commands are intended for use in the preprogrammed text.
  401.       They combine the 2 functions of changing the source of character
  402.       input, and designating the variable for storage, so that the
  403.       human operator needs to type in only the value of the designated
  404.       variable.
  405.  
  406.       The reduced version of BATCH lacks this set of commands.
  407.  
  408.    Escape V                (variable choice of a variable)
  409.  
  410.       After this command, the next character input always is taken
  411.       from the console terminal.  The input character must be a decimal
  412.       digit, 0 to 9.  The digit designates the choice of program
  413.       variable to become the source for subsequent character input.
  414.       Fetching from the designated variable is performed in the same
  415.       manner as though the corresponding Escape Fn command had been
  416.       used (n = 0, ..., 9).
  417.  
  418.       This command is intended for use in the preprogrammed text.  It
  419.       provides a means whereby the human operator can control the
  420.       branching of BATCH processing, merely by typing in a single
  421.       digit.
  422.  
  423.       The reduced version of BATCH lacks this command.
  424.  
  425.    Escape X                (error, or no-op)
  426.  
  427.       This command has no effect on BATCH.  It is useful if you already
  428.       have typed in Escape, then change your mind and decide that you
  429.       do not want to type in any other command to BATCH.
  430.  
  431.    Escape any-other-character        (invalid command)
  432.  
  433.       If the source of character input is preprogrammed text, an
  434.       invalid command causes immediate termination of BATCH
  435.       processing.
  436.  
  437.       If the source of character input is the console terminal, then
  438.       BATCH rings the bell and waits for a valid command letter to be
  439.       typed in.
  440.  
  441.  
  442. SAFE MEMORY
  443. -----------
  444.  
  445. BATCH starts operation as a conventional user program.  That program
  446. copies part of itself into "safe" memory, and then terminates execution
  447. as a conventional user program.  The part that was copied into safe
  448. memory, will execute whenever CP/M subsequently calls BIOS procedures
  449. CONST or CONIN.  Since other user programs may be executing at that
  450. time, the safe memory must be chosen such that it will not be affected
  451. by the normal operation of CP/M or the other user programs.
  452.  
  453. The choice of where that safe memory is located, depends upon the
  454. particulars of the computer installation, the version of CP/M, and the
  455. BIOS being used.  Therefore the determination of addresses for safe
  456. memory, is a required customization of the BATCH program.
  457.  
  458. A recommended, but not required, location for safe memory is:  starting
  459. just after the end of BIOS, and ending at the end of actually existing
  460. memory.  The customization code may be written to accept a single
  461. version of CP/M and BIOS, running in differing amounts of main memory.
  462. For example, it may accept 32K, 48K, and 64K versions of CP/M, by using
  463. the contents of the word at address 0006 to find the starting address
  464. of BDOS.
  465.  
  466.  
  467. SOURCE CODE FILES
  468. -----------------
  469.  
  470. The BATCH program is assembled from 5 files of source code.  2 of the
  471. files, named COMPENS8.SIL and SMALCPLR.SIL, contain declarations of
  472. general-purpose macros.  These copyrighted files are standard
  473. components of every program written in the systems implementation
  474. language of the Succinct Systems macro assembler SIL80Z80.
  475.  
  476. The remaining 3 files are specific to the BATCH program.  The files
  477. are named VARBATCH.1, VARBATCH.2, and VARBATCH.3 for the full version
  478. of BATCH, or BATCH.1, BATCH.2, and BATCH.3 for the reduced version of
  479. BATCH.  All files named VARBATCH or BATCH are in the public domain.
  480. Unless there is need to distinguish VARBATCH from BATCH, just the name
  481. BATCH will be used in the following discussion.
  482.  
  483. File BATCH.1 contains the data and code which program BATCH will copy
  484. into safe memory.
  485.  
  486. File BATCH.3 contains the code which performs the copying, and which
  487. reads the file of preprogrammed textual data.  The code that is
  488. assembled from file BATCH.3, executes as a conventional user program.
  489.  
  490. Before the code from file BATCH.3 can copy the data and code from file
  491. BATCH.1 into safe memory, all the internal address references in the
  492. BATCH.1 data and code must be relocated to the newly-discovered
  493. addresses in safe memory.  In order to distinguish the constant
  494. information (data or code) from the relocatable addresses, there exists
  495. a second copy of this data and code.  The second copy is assembled from
  496. file BATCH.2, at different addresses than the data and code from file
  497. BATCH.1.  The code from file BATCH.3 compares these 2 copies.  Where
  498. they are alike, the information is constant.  Where they differ, the
  499. addresses in the copy from file BATCH.1 must be relocated.  After the
  500. comparison and relocation has been completed, the copy from file
  501. BATCH.2 is of no further use, and is ignored.
  502.  
  503. File BATCH.2 is created from file BATCH.1 by translating all lower case
  504. letters to upper case.  The translation may be performed by using the
  505. "U" option in either CP/M program PIP.COM or CP/M program ED.COM.  Every
  506. statement label in file BATCH.1 includes at least 1 lower case letter,
  507. so translation to upper case creates a completely new set of statement
  508. labels.  Thus there are no naming conflicts when the source code from
  509. files BATCH.1 and BATCH.2 are assembled together (as 2 of the total of
  510. 5 source code files).
  511.  
  512.  
  513. INTERNAL OPERATION
  514. ------------------
  515.  
  516. When BATCH starts execution as a conventional user program, it performs
  517. the following steps in sequence:
  518.  
  519. 1.  Open the file of preprogrammed textual data.
  520.  
  521. 2.  Discover the address of safe memory.  This step is customized for
  522.     each computer installation.
  523.  
  524. 3.  Relocate the addresses in the data and code which later will be
  525.     copied into safe memory.
  526.  
  527. 4.  Copy some of the CP/M BIOS entry addresses, from BIOS to the data
  528.     which later will be copied into safe memory.
  529.  
  530. 5.  Copy the data and code into safe memory.
  531.  
  532. 6.  Read the file of preprogrammed textual data, process it (typing out
  533.     and then deleting comments, deleting line feeds after carriage
  534.     return, appending the Escape Z command), and copy it into safe
  535.     memory following the code in safe memory.
  536.  
  537. 7.  Close the file of preprogrammed textual data.
  538.  
  539. 8.  Copy the entry addresses of the BATCH versions of procedures CONST
  540.     and CONIN, into CP/M BIOS.  This instates the BATCH code in safe
  541.     memory, as the new provider of character input.  The BATCH code in
  542.     safe memory, decides whether the source of subsequent character
  543.     input is to be preprogrammed text or the console terminal.
  544.  
  545. 9.  Terminate execution as a conventional user program.  As a result,
  546.     the CP/M Console Command Processor starts execution.  The Console
  547.     Command Processor calls the BATCH version of procedure CONIN for its
  548.     first character input.
  549.  
  550.  
  551. CUSTOMIZATION
  552. -------------
  553.  
  554. All instructions in the preassembled object code version of the BATCH
  555. program, are executable on 8080, 8085, and Z80 computers.
  556.  
  557. In addition to the required customization, BATCH also has provision for
  558. some optional customization.  None of the customization requires
  559. reassembling the BATCH program.
  560.  
  561. The preassembled object code version of the BATCH program, starts at
  562. memory address (hex) 0100.  The first few bytes of the program are:
  563.  
  564. 0100:    An instruction which transfers execution to the start of the
  565.     main portion of BATCH.
  566.  
  567. 0103:    A word which ultimately must contain the starting address of
  568.     safe memory.  If the address is a known constant, it may be
  569.     patched directly into this word, so that no address calculation
  570.     will be required.  If the address is variable, a customized
  571.     procedure must be written to calculate the address and store
  572.     the result into this word.
  573.  
  574. 0105:    A word which ultimately must contain the size in bytes of safe
  575.     memory.  If the size is a known constant, it may be patched
  576.     directly into this word, so that no size calculation will be
  577.     required.  If the size is variable, a customized procedure must
  578.     be written to calculate the size and store the result into this
  579.     word.
  580.  
  581. 0107:    A word which already contains the size in bytes of the BATCH
  582.     data and code that will be copied into safe memory.  Safe
  583.     memory must be at least this size, and must have whatever
  584.     additional space is needed to hold the preprogrammed text.  If
  585.     safe memory is too small, the BATCH program will not execute
  586.     correctly.
  587.  
  588. 0109:    These 2 words contain the addresses of the 2 copies of the data
  589. and    and code, one of which will be copied into safe memory, and the
  590. 010B:    other of which is used to distinguish relocatable addresses.
  591.     These words are of interest only if optional customization is
  592.     to be performed.
  593.  
  594. 010D:    This word contains the address of the customization procedure
  595.     which calculates the address and size of safe memory.  The
  596.     contents of this word must not be changed.  Instead, you should
  597.     examine this word to determine where to assemble your
  598.     customization procedure.
  599.  
  600.     You must provide some customization procedure, even if both the
  601.     address and the size of safe memory are known constants that
  602.     have been patched into the words at addresses 0103 and 0105.
  603.     In that case, the customization procedure may consist of just
  604.     the single instruction:   RET
  605.  
  606.     There already exists a customization procedure at the designated
  607.     address.  It is the procedure used by the author of the BATCH
  608.     program.  Although this procedure will not be directly usable
  609.     at any other computer installation, it may serve as a source of
  610.     ideas for writing other customization procedures.
  611.  
  612.     The customization procedure occupies the highest addresses of
  613.     the conventional user program part of BATCH.  Therefore the
  614.     procedure may be as large as necessary for any given computer
  615.     installation, and may extend arbitrarily far upward in user
  616.     memory address space.
  617.  
  618. 010F:    These 4 words = 8 bytes initially contain the value 0.  They
  619. 0111:    may be used to contain diagnostic information for any errors
  620. 0113:    that are detected during the conventional user program part of
  621. 0115:    BATCH processing.  The nature of the diagnostic information may
  622.     depend upon the specific error that was detected.
  623.  
  624. The optional customization is performed only by patching.  Each 1
  625. customized change requires 2 patches.  The patches must be of identical
  626. values, but be performed at 2 different addresses.  The addresses are
  627. the 2 corresponding relative addresses, within the 2 copies of the data:
  628. one copy will later be copied into safe memory, the other copy is used
  629. to distinguish relocatable addresses.  The starting addresses of these
  630. 2 copies are contained in the words at addresses 0109 and 010B.  These
  631. copies initially have identical data, except for the relocatable
  632. addresses.  The first few bytes in each of these copies are:
  633.  
  634. Rel. addr. 0000:  Either 0 or (decimal) 255 = (hex) FF.  This is the
  635.           initial default output parameter of the BATCH version
  636.           of procedure CONST, when the source of character
  637.           input is preprogrammed text.  This value may be
  638.           changed during BATCH processing, by the Escape Y and
  639.           Escape N commands.
  640.  
  641. Rel. addr. 0001:  Either 0 or any chosen nonzero value.  This is the
  642.           initial default value for enabling BATCH to ring the
  643.           bell of the console terminal.  0 means ringing is
  644.           disabled; any nonzero value means ringing is enabled.
  645.           This value may be changed during BATCH processing, by
  646.           the Escape R and Escape Q commands.
  647.  
  648. Rel. addr. 0002:  This byte contains the ASCII value of the Escape
  649.           character.
  650.  
  651. Rel. addr. 0003 and onward:
  652.           Starting at relative address 0003 is a table.  Each
  653.           entry in the table occupies 3 bytes.  The 1st byte of
  654.           each entry contains the ASCII value of a BATCH
  655.           command letter.  The 2nd and 3rd bytes of each entry
  656.           contain the relocatable address of the BATCH
  657.           procedure which executes the designated command.  The
  658.           relocatable addresses must not be changed, but the
  659.           letters may be changed if so desired.  The table
  660.           entries contain command letters in the sequence:
  661.           I, B, R, Q, Y, N, X, Z, F, O, A, V, S.
  662.  
  663.  
  664. ASSEMBLY NOTES
  665. --------------
  666.  
  667. If you plan on reassembling the BATCH source code, using the SIL80Z80
  668. assembler, be sure to redefine the value of symbol _x in file
  669. SMALCPLR.SIL, to have the value (decimal) 200.
  670.  
  671. All 5 source code files must be concatenated into a single temporary
  672. file for assembly.  Succinct Systems utility program NOCOMENT may be
  673. used to perform the concatenation.  The order of the original files
  674. within the temporary file must be:
  675.    COMPENS8.SIL
  676.    SMALCPLR.SIL
  677.    BATCH.1
  678.    BATCH.2
  679.    BATCH.3
  680.  
  681.  
  682. IF THE EXAMPLE BATCH PROGRAM DID NOT WORK PROPERLY
  683. --------------------------------------------------
  684.  
  685. Some people have tried running the example program, and found that it
  686. did not work properly for them.  There are 2 possible causes.
  687.  
  688. 1. Symptom:  The program types out about 2/3 of a screen full of text,
  689.    performs a warm boot, and then disappears.  CP/M continues to
  690.    operate normally, as though BATCH never had been run.
  691.  
  692.    Probable cause:  This usually occurs on double-density disk systems,
  693.    in which 256-byte blocks are read instead of the CP/M standard 128-
  694.    byte blocks.  The problem occurs because CP/M occupies an odd number
  695.    of 128-byte blocks.  During the course of warm boot, the first 128
  696.    bytes of BIOS are overwritten by initialized data from the disk,
  697.    thereby overwriting the pointers that BATCH has stored into BIOS.
  698.  
  699.    Solution:  Change warm boot so that it does not overwrite BIOS.  The
  700.    solution conforms with Digital Research's description of warm boot:
  701.    that it overwrites CP/M but does not alter BIOS.  The reason for
  702.    this rule is that BIOS may contain other context relating to disk
  703.    status, which must not be lost during warm boot.
  704.  
  705. 2. Symptom:  The program types out about 2/3 of a screen full of text,
  706.    performs a warm boot, and then runs wild.
  707.  
  708.    Probable cause:  Program VARBATCH.COM on the distribution diskette
  709.    uses memory starting at address (hex) 3000 as its safe memory.
  710.    This memory is not safe for general use, but it is safe for just the
  711.    example program.  The example program requires only that the chosen
  712.    safe memory not be used by DDT.COM or by CP/M.  However, if warm
  713.    boot uses memory starting at (hex) 3000, it will destroy the example
  714.    BATCH program.
  715.  
  716.    Solution:  Choose some other 2K region to be safe memory, and
  717.    customize VARBATCH.COM to use that region.
  718.  
  719.  
  720. SOURCE CODE NOTATION
  721. --------------------
  722.  
  723. The source code of the BATCH program is written in the systems
  724. implementation language of macro assembler SIL80Z80.  SIL80Z80 is a
  725. commercial product of Succinct Systems, Santa Cruz, Calif.
  726.  
  727. For the most part, each source code statement (terminated by semicolon)
  728. assembles into a single 8080 instruction.  The notation is:
  729.  
  730. ^   represents the assembler's pseudo-location counter.
  731. A   represents accumulator register A.
  732. B   represents register B.
  733. C   represents register C.
  734. D   represents register D.
  735. E   represents register E.
  736. H   represents register H.
  737. L   represents register L.
  738. ?   represents the condition code register.
  739. SP  represents stack pointer register SP.
  740. A?  represents register pair A and ?.
  741. BC  represents register pair B and C.
  742. DE  represents register pair D and E.
  743. HL  represents register pair H and L.
  744. CY  represents the condition code bit Carry-Borrow.
  745. LSB represents the least significant bit of a byte.
  746. N   is a self-reference to the operand.
  747. .   means "contents of", or indicates absolute addressing for the GO
  748.     instructions (written:  GO.)
  749.  
  750. ><  represents the least significant byte of a word.
  751. <>  represents the most significant byte of a word.
  752. \/  represents pushing a word into the program stack.
  753. /\  represents popping a word from the program stack.
  754. <-  represents copying a byte or word of data, to be read "gets".
  755. ->  represents copying a byte or word of data, to be read "goes to".
  756. <-> represents exchanging bytes or words of data, to be read "exchanged
  757.     with".
  758. <<  represents copying bits of data, or setting condition codes.
  759. >>  represents copying bits of data, or setting condition codes.
  760.  
  761. Rules:
  762. 1.  Where either data direction <- or -> could be used, that direction
  763.     is chosen which avoids the need for a self-reference N.
  764. 2.  If Rule 1 does not determine the data direction, -> is used.
  765. 3.  Where shifts or rotations are performed, << or >> is chosen such
  766.     that the most significant bit is represented by the leftmost
  767.     character of the notational symbol.
  768.  
  769. Source code notation:
  770.     ? << <- .  parameter;
  771. is a macro call which expands into the following 2 instructions:
  772.     A <- .  parameter;
  773.     A >> ?;
  774.  
  775. Source code notation:  PROCEDURE, END PROCEDURE, DO, END DO, IF = THEN,
  776. ELSE, END IF, REPEAT, EXIT, etc. all are macro calls.
  777.  
  778. The destination of a REPEAT statement is the innermost nested PROCEDURE
  779. or DO, unless specifically designated otherwise.  The destination of an
  780. EXIT statement is the innermost nested END PROCEDURE or END DO, unless
  781. specifically designated otherwise.  IF and END IF do not delimit
  782. REPEAT and EXIT statements.
  783.  
  784. (End of document.)
  785.