home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / simtel / sigm / vols000 / vol068 / unspool.doc < prev    next >
Text File  |  1984-04-29  |  13KB  |  392 lines

  1.  
  2.  
  3.       Documentation    for UNSPOOL Version 3.1
  4.  
  5.  
  6.             for    CP/M 2.0 and up.
  7.  
  8. AUTHOR:
  9.             Gary P. Novosielski
  10.                Rutherford, NJ
  11.                (201) 935-4087
  12.            Evenings and    weekends.
  13.  
  14. INTRODUCTION:
  15.  
  16.      UNSPOOL  (Ver    3.0) is    a program to send a standard
  17. CP/M file such as a .PRN or .ASM file to the  system's    list
  18. or  punch  device,  while  still  allowing  almost all other
  19. system operations to take place.  The  file  is     transferred
  20. during periods when console is waiting for input.
  21.  
  22. SYNTAX:
  23.  
  24.      UNSPOOL [d:]filename.ext [dev]
  25.          or
  26.      UNSPOOL dummy OFF
  27.  
  28.      [square brackets denote optional parameters]
  29.  
  30. Where           d:           is  an  optional     drive    spec
  31.                    such as    A:  or    B:.  If     not
  32.                    entered,     the current default
  33.                    drive is    assumed.
  34.            filename.ext    is the name of the CP.M    file
  35.                    to be printed/punched.
  36.            dev           is  the    symbolic name of the
  37.                    output  device  to  be  used.
  38.                    Valid  devices  are  LST     and
  39.                    PUN. Note that the colon     (:)
  40.                    usually     present   in  these
  41.                    names is    NOT entered. If     not
  42.                    specified, the LST: device is
  43.                    assumed.
  44.            OFF           If  OFF    is specified instead
  45.                    of   a    device     name,     the
  46.                    operator     will be offered the
  47.                    option of cancelling  UNSPOOL
  48.                    if it is    already    running.
  49.            dummy           Because    the  word OFF is the
  50.                    second parameter, a  filespec
  51.                    is still    needed.    A dummy    name
  52.                    of  "."    will  suffice  as  a
  53.                    place holder.
  54. Examples:
  55.      UNSPOOL TEST.PRN
  56.          will  send  the  file    TEST.PRN  from     the
  57.  
  58.  
  59. Revised    81-12-06            Page 1 of 6
  60.  
  61. _______________________________________________________________
  62.  
  63.  
  64.       Documentation    for UNSPOOL Version 3.1
  65.  
  66.  
  67. current    default    drive to the current LST: device.
  68.  
  69.      UNSPOOL A:TEST.PRN LST
  70.          is   exactly    equivalent   to     the  above,
  71. assuming drive A is the    default    drive. Note that the  device
  72. name has no trailing colon.
  73.  
  74.      UNSPOOL B:ZINGER.HEX PUN
  75.          will  send  the  file ZINGER.HEX from the B
  76. drive to the current PUN: device regardless of    which  drive
  77. is  currently the default. Note    that the device    is "PUN" not
  78. "PUN:".
  79.  
  80.      UNSPOOL . OFF
  81.      UNSPOOL *.* OFF
  82.      UNSPOOL OFF OFF
  83.          all cause an operator prompt: "Do you    want
  84. to  cancel  UNSPOOL?"  A  single  "Y"  or "N" (Yes or No) is
  85. accepted from the console as a response. Any other character
  86. is assumed to mean "No".
  87.  
  88.      UNSPOOL OFF
  89.          causes    the file "OFF.     " to be sent to the
  90. list device.
  91.  
  92. OPERATION:
  93.  
  94.      Upon loading, the program checks to  see  that     the
  95. the  BIOS  vector  table  pointed to by    the word at location
  96. 0001H  is  valid,  i.e.     is  a    table  of  JMP    instructions
  97. containing at least 16 entries.    If an error is detected, the
  98. program     will  display    an  error message on the console and
  99. attempt    to warm-boot CP/M.
  100.  
  101.      If found, the BIOS vector table is copied into     the
  102. program     segment  which    will remain active during unspooling
  103. so that    subsequent application programs    running    concurrently
  104. with UNSPOOL will still    have access to the BIOS.
  105.  
  106.      This table is modified    to  trap  attempts  to    warm
  107. boot  the  system,  perform direct console input, or perform
  108. direct disk sector writes.  Direct  sector  writes  are     not
  109. permitted  (see     notes)    under UNSPOOL. Warmboot    requests and
  110. direct console input are handled as described below.
  111.  
  112.      The address of    the old    BIOS vector table, the    BDOS
  113. entry  address,     and the CCP return address (from the top of
  114. the stack on entry) are    saved in memory.
  115.  
  116.      The  "dev"  parameter    from  the  command  line  is
  117. checked. If not    valid, an error    message    is typed and control
  118. returns    to the CCP.
  119.  
  120.      If  the  "dev"     parameter  is    the literal OFF, the
  121. program     executes  a  BDOS  funcion  0    (System     Reset)     and
  122. terminates.
  123.  
  124.  
  125. Revised    81-12-06            Page 2 of 6
  126.  
  127. _______________________________________________________________
  128.  
  129.  
  130.       Documentation    for UNSPOOL Version 3.1
  131.  
  132.  
  133.  
  134.      The  file  named  in the command line is opened for
  135. input. If not present, the command is echoed to    the  console
  136. followed by a "?" and control returns to CCP.
  137.  
  138.      If  the  drive    is not explicit, the current default
  139. drive number is    recorded  internally  in  case    the  default
  140. drive is changed while UNSPOOL is active.
  141.  
  142.      The  current  user  number  and  IOBYTE  values are
  143. checked    and stored internally so that if the user number  is
  144. changed,  UNSPOOL will still be    able to    read the input file.
  145. If the device is changed (using    STAT LST:=TTY: for  example)
  146. unspool     will  continue    to use the physical device in effect
  147. at the time  the  program  was    initiated.  Any     application
  148. programs  will,     however,  use    the  new  values of the    user
  149. number and the new physical device assignments.
  150.  
  151.      If no errors  were  detected,    the  active  program
  152. segment     which    monitors all calls to BDOS is relocated    into
  153. high memory just below the CCP.    This reduces  the  available
  154. user program area by 3 K: 4 pages for the UNSPOOL supervisor
  155. segment,   and    8  pages  for  the  CCP     which    is  commonly
  156. overwritten by user program buffers. The BOOT and BDOS jumps
  157. in low memory are modified to protect the  CCP    and  UNSPOOL
  158. supervisor segment.
  159.  
  160.      Control  is  then  returned  to the console. Normal
  161. CP/M operation will then be  possible.    Characters  will  be
  162. sent  from  the    input file to the output device    whenever the
  163. console    is idle.
  164.  
  165.      Whenever an application program or the    CCP requests
  166. console    input using BDOS functions 1 or    10, or a direct    call
  167. into the  jump    table  at  A(BOOT + 1) + 6,  the  supervisor
  168. segment     intercepts  these requests and    checks to see if the
  169. console    is idle. If it is, characters are  transferred    from
  170. the  input  file  to  the  output  device  until the console
  171. becomes    ready, i.e. a key is actually pressed. At that    time
  172. the  BDOS  function  or     BIOS call is executed normally, and
  173. control    returns    to the application program.
  174.  
  175.      If a jump  to    BOOT  is  attempted,  this  is    also
  176. intercepted  by     the UNSPOOL supervisor    segment. The message
  177. "Unspooling in progress" is displayed on the console, and no
  178. actual    boot  takes  place.  Control  is  returned  to     the
  179. protected  copy    of the CCP instead. Before returning, a    disk
  180. reset is performed and the default DMA address is  reset  to
  181. 0080H to simulate a true warm-boot as closely as possible.
  182.  
  183.      If warmboot is    attempted using    BDOS function 0, the
  184. program     will prompt the operator with the option to cancel.
  185. If the response    is "Y",    warmboot  is  performed     using    BDOS
  186. function 0 as requested. Otherwise the request is handled as
  187. with normal warmboot, above.
  188.  
  189.  
  190.  
  191. Revised    81-12-06            Page 3 of 6
  192.  
  193. _______________________________________________________________
  194.  
  195.  
  196.       Documentation    for UNSPOOL Version 3.1
  197.  
  198.  
  199.      If  a direct BIOS call    to write a sector to disk is
  200. attempted,  UNSPOOL  will  display  the      message   "Invalid
  201. operation  attempted  under  UNSPOOL.  Program aborted." The
  202. application program will be  terminated,  but  UNSPOOL    will
  203. continue  to run. (See Notes.) This restriction    applies    only
  204. to direct BIOS writes. All normal file-oriented    (BDOS) reads
  205. and writes are fully supported under UNSPOOL.
  206.  
  207.      When the input    file is    completely transferred,    or a
  208. 1AH  end-of-file  character  is     detected,  the      supervisor
  209. becomes     inactive,  and     passes     on  previously     intercepted
  210. requests immediately, without checking console    status.     The
  211. sole  exception    to this    is that    direct BIOS writes are still
  212. not permitted until the    next warmboot.
  213.   When    the  next  warm-boot  request    is   detected,     the
  214. supervisor  removes  itself  from memory by executing a    true
  215. warm-boot,  and     informs  the  operator     with  the   message
  216. "UNSPOOL completed.".
  217.  
  218. NOTES:
  219.  
  220.      While    UNSPOOL     makes    every  effort to restore the
  221. values of the DMA address, USER    number,    IOBYTE,    and  default
  222. disk  drive  before  returning    control     to  the  program, a
  223. hardware reset may leave these    values    in  an    undetermined
  224. state if unspooling was    actually taking    place at the time.
  225.  
  226.      When  function     10,  Read  Console  Buffer is used,
  227. UNSPOOL    will transfer characters only until the    first key is
  228. pressed. At that time, no  characters  will  be     transferred
  229. until  the  input  line     is completed by pressing a carriage
  230. return.
  231.  
  232.      UNSPOOL requires that the List    Status    function  in
  233. the  BIOS  was    properly  implemented at system    installation
  234. time. UNSPOOL will not send characters to  the    LST:  device
  235. unless    it  recieves  a    ready condition    from the List Status
  236. routine. If the    PUN: device is    used,  no  status  check  is
  237. provided  for by CP/M, so a not-ready condition    on the punch
  238. may cause the system to    hang up    if PUN was specified on     the
  239. command    line. See the CP/M Alteration Guide for    a discussion
  240. of the BIOS List Status    routine.
  241.  
  242.      Although  the    console     is polled frequently during
  243. the unspooling of the file, some of the    diskette  operations
  244. may take a second or two to complete, for example when a new
  245. extent    is  opened.  Since  the    console    is not polled during
  246. this period,  high  speed  typing  may    cause  one  or    more
  247. characters  to be lost.    This effect will vary depending    upon
  248. the program being run, the types of input reqests (character
  249. or line) it uses, and the relative locations on    disk of     the
  250. spool file and any files in use    by the program.    As a result,
  251. heads-down  typing  is    not  reccommended  while  UNSPOOL is
  252. running. Some experience with UNSPOOL will  teach  the    user
  253. when caution is    required.
  254.  
  255.  
  256.  
  257. Revised    81-12-06            Page 4 of 6
  258.  
  259. _______________________________________________________________
  260.  
  261.  
  262.       Documentation    for UNSPOOL Version 3.1
  263.  
  264.  
  265.      Although  it  would  be  possible to perform direct
  266. BIOS writes  while  unspool  is     active,  (indeed  this     was
  267. permitted  in  earlier    versions) this action is now trapped
  268. and prohibited.    The reason this    was deemed necessary is    that
  269. some existing software,    for example DU.COM, uses direct    BIOS
  270. writes in a manner which could cause a major system crash if
  271. allowed    under UNSPOOL.
  272.  
  273.      The problem arises when a program  calls  the    BIOS
  274. directly  (it is actually calling UNSPOOL's copy of the    BIOS
  275. table) to select the drive, set    the track  and    sector,     and
  276. perform     direct     disk  I/O  without going through the normal
  277. CP/M file handling system. This    causes    no  problem  if     the
  278. selecting, addressing, and I/O are all done together, but if
  279. a console input    is done    between    the time the disk address is
  280. set and    the call to read or write a sector, the    disk address
  281. may  no     longer     be valid. This    could cause the    sector to be
  282. written     to  the  wrong     disk  address,     or  even  over     the
  283. directory.
  284.  
  285.      This is true because a    request    for console input is
  286. taken    by   UNSPOOL  as  an  opportunity  perform  its     own
  287. functions, which themselves include disk I/O. Although    this
  288. problem     could    be eliminated by insuring that console input
  289. is not allowed to intervene between disk addressing and    disk
  290. I/O, it    is not in the author's power to    rewrite    all existing
  291. applications software. This better-safe-than-sorry trap     was
  292. therefore included.
  293.  
  294.      Note  that direct reads are NOT trapped, since    they
  295. do not have the    same potential for disaster, but  still     may
  296. be   unreliable     for  the  same     reasons.  It  is  therefore
  297. recommended that software using    direct disk I/O    not  be     run
  298. under  UNSPOOL.     Normal     CP/M file-oriented (BDOS) reads and
  299. writes always  re-select  and  re-address  the    disk  before
  300. reading    or writing a sector, so    no similar problem exists in
  301. the  vast  majority  of     software which    uses the normal    CP/M
  302. file handling system.
  303.  
  304. INSTALLATION:
  305.  
  306.      The source file is written for     assembly  with     the
  307. MAC  assembler.     The  .HEX file    produced is LOADed to a    .COM
  308. file and executed just as any normal program. Relocation  is
  309. done at    execution time as described above.
  310.  
  311.      If  the  assembly option EXPAND is set    to TRUE, tab
  312. characters in the input    file will be expanded to spaces    with
  313. assumed    tab stops  at  every  eighth  print  position.    This
  314. option    should    be set to FALSE    if the printer driver or the
  315. printer    itself can properly handle the tab character. If the
  316. option PHYSBS is set to    TRUE,  a  backspace  character    will
  317. cause  the  tab     expansion  algorithm to recognize backspace
  318. characters and decrement the column count when    a  backspace
  319. is  encountered    in the input file. This    option should be set
  320. to FALSE if backspace characters are ignored by    the printer.
  321.  
  322.  
  323. Revised    81-12-06            Page 5 of 6
  324.  
  325. _______________________________________________________________
  326.  
  327.  
  328.       Documentation    for UNSPOOL Version 3.1
  329.  
  330.  
  331. All other control codes    except carriage    return    are  assumed
  332. to be non- printing, and are ignored by    the algorithm.
  333.  
  334.      If tab    expansion is included, the version number in
  335. the signon message will    be followed by "/T".
  336.  
  337.               Gary Novosielski
  338.  
  339.  
  340.  
  341.  
  342.  
  343.  
  344.  
  345.  
  346.  
  347.  
  348.  
  349.  
  350.  
  351.  
  352.  
  353.  
  354.  
  355.  
  356.  
  357.  
  358.  
  359.  
  360.  
  361.  
  362.  
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389. Revised    81-12-06            Page 6 of 6
  390.  
  391. _______________________________________________________________
  392.