home *** CD-ROM | disk | FTP | other *** search
/ Frostbyte's 1980s DOS Shareware Collection / floppyshareware.zip / floppyshareware / USCX / DOSUT-09.ZIP / COVER.TXT < prev    next >
Text File  |  1985-02-13  |  19KB  |  619 lines

  1. CBHFT
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.      HF-GECOVER UTILITYHF-
  19.      HF-GEfor IBM PC, XT, or ATHF-
  20.      HF-GE(PRINT SORTED DIRECTORY)HF-
  21.      HF-
  22.  
  23.  
  24.  
  25.      November 1, 1984
  26.  
  27.  
  28.      Dan Daetwyler
  29.  
  30.      Route 5, Box 518A
  31.      Springdale, AR 72764
  32.      (501) 756-0212
  33.  
  34.  
  35.  
  36. -                               COVER UTILITY 
  37.  
  38.      GContents
  39.  
  40.  
  41.      G  Introduction ................................................. 1
  42.  
  43.      G  Operation .................................................... 2
  44.  
  45.      G  Source Code .................................................. 3
  46.  
  47.      G  Patching ..................................................... 6
  48.  
  49.      G  Modifications ................................................ 7
  50.  
  51.      G  Rights and Data .............................................. 8
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97. -     Contents                                                        ii
  98.  
  99. -                               COVER UTILITY 
  100.  
  101.      GE-INTRODUCTIONHF-HF-
  102.  
  103.  
  104.  
  105.      Just  what  you always  needed!   Yet  another  redundant,  dupli-
  106.      cative,  and space occupying utility...  Hopefully,  this  fills a
  107.      niche left open in the  array of PC-DOS utilities.  This one sorts
  108.      and formats the directory data and prints it so its  "just  right"
  109.      to  fit  inside the diskette envelope.   You have to provide  your
  110.      own paper cutter... the utility does the rest.
  111.  
  112.      The  program runs under PC-DOS Versions 1.x, 2.x,  or 3.0 and will
  113.      operate  on any normal configuration.   It does expect the IBM  or
  114.      Epson MX80 printer (or equivalent), but should be easily  modified
  115.      to apply to any printer that offers "condensed"  print and 8 lines
  116.      per inch line spacing.
  117.  
  118.      It has  two known limitations.   It ignores hidden  files,  and if
  119.      you're  a  Version  2.0  or later user  and have  implemented  the
  120.      "tree"   directory  paths   with   multiple   directories   on   a
  121.      diskette,  only  the  "root" directories  will  be printed.  Since
  122.      the "path" logic  seems  primarily aimed at  fixed disk,  and this
  123.      utility  is directed towards  diskettes,  these limitations should
  124.      not  effect most  users.
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.  
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160. -     Introduction                                                     1
  161.  
  162. -                               COVER UTILITY 
  163.  
  164.      GE-OPERATIONHF-
  165.  
  166.  
  167.  
  168.      Simply  place  the diskette  containing  COVER.COM  in a  diskette
  169.      drive, and enter the command:  COVER.
  170.  
  171.      The utility will prompt with a console  message asking which drive
  172.      contains the diskette to be listed, so enter the  single character
  173.      drive designator appropriate  (A-G).   No colon or carriage return
  174.      will be required.  The program will then  prompt for the title you
  175.      wish  to  appear on  the top line of  the  list.   A  37 character
  176.      field is provided.   If you do not want the title, simply  hit the
  177.      "Enter" key, and the top line of the  listing will be blank except
  178.      for the date, and the  diskette label (if  it  has one).  When the
  179.      first listing  is complete,  the  utility  will  loop back and ask
  180.      for another drive.  This iterative  process  will  continue  until
  181.      you  respond  with  an "Escape" key  to the drive  request prompt.
  182.      Exit is then made to the DOS.
  183.  
  184.      Note  that although the utility prints  two  envelope  covers  per
  185.      page,  forms will  be advanced to  the "top of  form"  position in
  186.      effect  when the utility  was started.   The printer will also  be
  187.      restored to "power up" status.   If you use Control-Break to  exit
  188.      the  utility,  this will not be true,  so  you'll have to manually
  189.      re-aline and reset your printer.
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.  
  206.  
  207.  
  208.  
  209.  
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219.  
  220.  
  221.  
  222.  
  223. -     Operation                                                        2
  224.  
  225. -                               COVER UTILITY 
  226.  
  227.      GE-SOURCE CODEHF-
  228.  
  229.  
  230.  
  231.      For those of you who do  not wish to  modify or extend COVER, this
  232.      section will contain little of value.  If  your need  is only that
  233.      of trying to "fit"  COVER to a different printer, read the section
  234.      on "patching" first.
  235.  
  236.      The   program   is   composed   of   seven   separately  assembled
  237.      modules:  COVER,  COTITL,  COFREE,  COSCAN,  COSORT,  COPRNT,  and
  238.      COENDP.  The listings are commented, but  I'll include a few words
  239.      on each of the modules.
  240.  
  241.      COVER  is  the  main  control  module,  and  contains   the  major
  242.      loop.   Its  first action is to preset the printer to 8 lines  per
  243.      inch,  condensed  print,  and  a  44  line page.   If you  have  a
  244.      "different"  printer,  you  may need to change the control  stream
  245.      defined at SETPRT.   The final zero in the control stream  is  not
  246.      sent to the printer, but marks the end of string for DOPRT.
  247.  
  248.      Next, COVER checks for the DOS Version.  The  return from the  30H
  249.      call  (which  is  valid  on  release  1.x),  is  the  release  and
  250.      version numbers  under V2.0 of DOS.   On prior releases it returns
  251.      a  zero.   This  code  simply  sets a switch that will  be  tested
  252.      later.   The  "default"  drive is then determined and  saved,  and
  253.      finally,   the   number   of  drives  on  the   configuration   is
  254.      determined.
  255.  
  256.      COVER   then  prompts  for   the   drive  letter  for   the  drive
  257.      containing the  diskette to be listed.  The single character input
  258.      is first checked for an "Escape" (all  done, so get off), and then
  259.      the   drive   character   is  verified   for   a   "legal"   drive
  260.      designator.  The  prompt  starts the main loop,  which  ends after
  261.      all processing  is  done  for  one  diskette.   COVER  then  calls
  262.      GETTTL   (Get   Title),   GETFRE   (Determine   free    space   on
  263.      diskette),  SCAN  (Load  all  directory  entries  into an internal
  264.      stack),  SORT  (Sequence  the  stacked entries), and  PRINT (which
  265.      formats and prints the stacked entries).
  266.  
  267.      When   the   Escape   character   is  sensed,  COVER  resets   the
  268.      "default" drive  to its  value on entry,  conditionally forces out
  269.      one  more "page"  to restore the paper to  the true top  of forms,
  270.      and  then resets the printer  to "power up"  status.   The control
  271.      string  for the  latter  is  at RESPRT so the "different"  printer
  272.      users  may modify that string if required.
  273.  
  274.      GETTTL  is  a  primitive module which solicits a "title"  from the
  275.      user.    37  characters  are  allowed,   and   the   standard  DOS
  276.      function  is   used  to  get   this   string.   Null   titles  are
  277.      permissible.  The  DOS  function is also  used to  get  the system
  278.      date.   DECMAL is a  local  subroutine  that  converts the content
  279.      of  the AL  to  two  decimal  digits  in  the  AH and  AL and then
  280.      stores them in the  area defined  by  the DI register.  This  code
  281.      section also makes  an attempt to get a "label" for the  diskette.
  282.      If the attempt is successful, the title "Label: ", and the  actual
  283.      label are placed in the title line.
  284.  
  285.  
  286. -     Source Code                                                      3
  287.  
  288. -                               COVER UTILITY 
  289.  
  290.  
  291.      GETFRE  computes the "free" space  available on the  diskette  and
  292.      places   the  ASCII  decimal  result  in  the  title  line.   This
  293.      program  is  the reason COVER checked for the DOS  Version.   V2.0
  294.      provides  a  "nice"  function  that  will   give  the  free  space
  295.      directly,  but  does  not allow you to gain addressability to  the
  296.      File Allocation Table (FAT).  V1.x  did not have this feature, but
  297.      did provide addressability to the FAT.  Since this  program was to
  298.      be used in both environments,  this  code has two paths.  The code
  299.      following   the   version  test  is  for  V2.0  (or  later).  Code
  300.      starting  at  the   label  VERS1  is  that  process  necessary  to
  301.      determine  free  space  under  the  older versions  of DOS.   VCOM
  302.      marks the  point  where  the  two  paths  re-join.  If you're only
  303.      running  V2.0,  you can  decrease  the  size  of  the  utility  by
  304.      removing   the  code  from  the  instruction  "JMP  VCOM"  to  the
  305.      instruction  before  that  labeled  VCOM.  Finally,  CONVRT  is  a
  306.      public subroutine that converts the AX/DX content  to  a  max of a
  307.      seven digit  number,  leading  zero  suppressed,  and  places  the
  308.      result at the area pointed to by the DI register.
  309.  
  310.      SCAN  does  the  normal  DOS  function  calls  to  "find"  an  all
  311.      "wild  card" file name.   This  process repeats until  the  entire
  312.      directory has been  scanned.   The result is placed in a stack and
  313.      a  pointer  to  the  start  of the entry is placed  in  a  pointer
  314.      list.  The  format  of  the  stack  entries  is  the file-name.typ
  315.      followed  by a  zero  byte,  and  then  the  four  byte  file size
  316.      field  from  the  directory.  Since  the data  transfer area (DTA)
  317.      has not been  reset  this  module  finds  it input  in the default
  318.      DTA at  80H  in  the program prefix.
  319.  
  320.      SORT  is a simple  "bubble" sort of the stacked  entries,  but  is
  321.      driven  from the  pointer list.   Yes,  I  know  a  shell sort  is
  322.      faster,  but  for a max of 224 entries,  an old  fashioned  bubble
  323.      uses less memory!
  324.  
  325.      PRINT  simply  uses  the  sorted   pointers  to  form  the   final
  326.      output.   The  title  line  has already been formed by  the  prior
  327.      modules.   The  local subroutine PRTENT uses  CONVRT to format the
  328.      file  sizes.   Four  columns  will  "fit" within  the  print  size
  329.      required,  so  PRINT initially computes column length.   An  inner
  330.      and  an outer loop controls the  print process.   The  inner  loop
  331.      prints  one entry each execution,  and is executed  four times per
  332.      line.   The  outer  loop  is  cycled once per entry  in  a  single
  333.      column.
  334.  
  335.      The   source   module  COENDP  includes  no  code.   This   module
  336.      simply  provides  addressability  to the memory above the  program
  337.      code.   V2.0  provides this function  in a much "cleaner"  manner,
  338.      but  since  this  utility  is  to  run  on  either  Version,  this
  339.      subterfuge is necessary.
  340.  
  341.      That's   a   very   quick   "walk  through"  for   the  code,  but
  342.      together   with   the   source   comments,   it   should   provide
  343.      sufficient  information  for any extensions  or modifications  you
  344.      may  choose to make.   Key the source  in,  and assemble the seven
  345.      modules.   The  Link  control  stream  is  also  included  in  the
  346.      listings.   Be  very  sure that  the  module COENDP occurs last in
  347.  
  348.  
  349. -     Source Code                                                      4
  350.  
  351. -                               COVER UTILITY 
  352.  
  353.      the  control stream, as shown  in  the listing.   Otherwise you'll
  354.      be stacking  directory entries over some of the code.
  355.  
  356.      For  those of you  who  are  not  familiar with "COM"  files,  ALL
  357.      segment  registers  are preset by the operating system to the same
  358.      value,  so  although  you see no code  for setting the DS  and  ES
  359.      segment registers,  they contain the same value as  the CS and  SS
  360.      at  program initiation so change is not required.   The  stack  is
  361.      automatically  allocated  at the  "top" of the segment  (64K)  the
  362.      program   is   loaded   to,   so   no   stack   establishment   is
  363.      required.  Finally,  the   established  stack  is  initialized  so
  364.      that a  "NEAR"  return  at  end of program will return  you to DOS
  365.      correctly,  so  long as the CS  register  has  not  been  changed.
  366.      This program  uses the 20H termination call, but could do a simple
  367.      near RET with the same result.
  368.  
  369.      Link  will  provide  console messages  saying  that  there  is  no
  370.      stack segment (that's  right), and that there is one error (that's
  371.      false).   This  response  is normal when you're preparing a  "COM"
  372.      file.   If  you get more errors or other indications, you'd better
  373.      re-check  your  work.  Now  you're  ready   to  run  EXE2BIN,  and
  374.      then   rename  the  resultant   file  (COVER.BIN)  to   COVER.COM.
  375.      That's all it  takes.
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402.  
  403.  
  404.  
  405.  
  406.  
  407.  
  408.  
  409.  
  410.  
  411.  
  412. -     Source Code                                                      5
  413.  
  414. -                               COVER UTILITY 
  415.  
  416.      GE-PATCHINGHF-
  417.  
  418.  
  419.  
  420.      If you have a printer other than  those normally supported, and if
  421.      your  printer  can be set for compressed print, 8 lines/inch,  and
  422.      variable page length, then you  can probably "patch" COVER to suit
  423.      your  printer.  Patching is simple.  Bring up COVER  under  DEBUG,
  424.      by entering:
  425.  
  426.             DEBUG COVER.COM
  427.  
  428.      Now enter a D 100, and debug will display (in  hex) the data found
  429.      at offset 100H in the data segment.  Since COVER  is  a COM  file,
  430.      the code segment  is  the data segment.  You'll notice two 12 byte
  431.      strings at location 103H  and 10FH, followed by a 4 byte string at
  432.      location 11BH.  The  first string  is the control codes  necessary
  433.      to set your printer to the following condition:
  434.  
  435.              Compressed print
  436.              44 Line Page
  437.              8 lines/inch print
  438.  
  439.      Check your printer manual and find out the set of  codes required,
  440.      and then use debug to key them into  the  area beginning at  103H.
  441.      Be sure the string ends  with  a zero  byte  (null),  and  that no
  442.      nulls are required in your command  string.  Your  command  string
  443.      must be contained  within  11 bytes plus the null byte to end  the
  444.      string.
  445.  
  446.      At location  10FH,  you need to code  a  similar  string, but this
  447.      time it is  the control  codes necessary  to cause your printer to
  448.      restore  itself  to your "normal"  settings.  Again,  this  string
  449.      must  terminate with  a  zero  byte.  At  location  11BH, code the
  450.      control  codes necessary to cause your  printer  to  "restore"  or
  451.      advance the form to the next "top of  form".  Typically, this is a
  452.      single byte,  but even so, it must be  followed  by  at  least one
  453.      zero byte.
  454.  
  455.      Having made those changes, simply  enter the W command,  and Debug
  456.      will write  back you  changed file.  Try it  and see if  it works.
  457.      If it  does not,  you'd  better  recheck  your changes  (you  were
  458.      working with a backup, weren't you?), and your printer manual.
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.  
  467.  
  468.  
  469.  
  470.  
  471.  
  472.  
  473.  
  474.  
  475. -     Patching                                                         6
  476.  
  477. -                               COVER UTILITY 
  478.  
  479.      GE-MODIFICATIONSHF-
  480.  
  481.  
  482.  
  483.      The original "COVER" has been modified to  remove a  few  bugs.  A
  484.      correction was  made  to  stop  the  utility  from  going into  an
  485.      endless loop when you  attempted  to  list  a  diskette containing
  486.      zero or one files.
  487.  
  488.      When  V3.0 arrived, I found that the version check was faulty, and
  489.      version  3.0 was  considered to be the equivalent  of  V1.x.  Ugh.
  490.      That has been fixed.
  491.  
  492.      V3.0 also  fixed  a  DOS "bug" that's been around "forever", so it
  493.      now became possible to print the diskette label  on the cover page
  494.      title line, and that provision  was "picked up".  To provide space
  495.      for  this  addition,  the  "title"  was  reduced  from  40  to  37
  496.      characters.
  497.  
  498.      V3.0 supports  high  capacity  diskette drives, which now makes it
  499.      likely  to have  free  space in the million byte or  above ranges.
  500.      Cover didn't like numbers greater than 6 digits, so  that has been
  501.      expanded  to permit  7 digit  numbers.  The  new drive  permits  a
  502.      diskette  to  have  up  to  224  directory  entries  in  the  root
  503.      directory.  That  really doesn't  "fit"  on  the  old  cover page,
  504.      soooooo.....  COVER  will  now  use  its  normal  cover  page  for
  505.      directories containing up to  132  entries.  Over  that,  it  will
  506.      simply  keep  printing until  it  runs  out of  directory entries.
  507.      You'll  have  to fold the  page  to stuff it in the envelop.  Yes,
  508.      COVER is smart enough to get  to the true top of  a physical page,
  509.      before it starts one of the "extra long" cover pages.
  510.  
  511.  
  512.  
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.  
  533.  
  534.  
  535.  
  536.  
  537.  
  538. -     Modifications                                                    7
  539.  
  540. -                               COVER UTILITY 
  541.  
  542.      GE-RIGHTS AND DATAHF-
  543.  
  544.  
  545.  
  546.      Cover has been formally declared "Public  Domain", which gives you
  547.      full  rights  for  use,  copy,  modification,  destruction(?),....
  548.      This version is  also placed in "Public  Domain".  If  you wish to
  549.      be placed on  a mailing list  for  notification of future versions
  550.      (if  any),  and  a moderately friendly  reaction  if  you  turn up
  551.      trouble, the price is $5, to be sent to the address given below:
  552.  
  553.      This program is covered  under no warranty  of  any  kind, and the
  554.      writer  is  not  liable  for  any  damages,  direct  or  indirect,
  555.      suffered  through  its  use, or  through  inability  to  use  this
  556.      program.
  557.                Dan Daetwyler
  558.                Route 5, Box 518A
  559.                Springdale, Arkansas 72764
  560.                501-756-0212
  561.  
  562.  
  563.  
  564.  
  565.  
  566.  
  567.  
  568.  
  569.  
  570.  
  571.  
  572.  
  573.  
  574.  
  575.  
  576.  
  577.  
  578.  
  579.  
  580.  
  581.  
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.  
  589.  
  590.  
  591.  
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598.  
  599.  
  600.  
  601. -     Rights and Data                                                  8 CBHFT
  602.  
  603.  
  604.  
  605.  
  606.  
  607.  
  608.  
  609.  
  610.  
  611.  
  612.  
  613.  
  614.  
  615.  
  616.  
  617.  
  618.  
  619. -     Rig