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 / STARLET / CPMREAD1.ZIP / CPMREAD.DOC < prev    next >
Text File  |  1988-07-08  |  15KB  |  393 lines

  1.  
  2.  
  3.  
  4.  
  5.                    CPMREAD.EXE
  6.                Read diskettes formatted under CP/M
  7.  
  8.  
  9.                   CPMDEFLT.EXE
  10.            Set the default parameters for CPMREAD.EXE
  11.  
  12.  
  13.           Both programs copyright (c) 1988 by Aaron L. Brenner
  14.  
  15.  
  16.  
  17.  
  18.     IBM PC is a trademark of International Business Machines, Inc.
  19.     CP/M is a trademark of Digital Research Inc.
  20.  
  21.     A Little Background
  22.     ===================
  23.  
  24.     A few years ago,  I worked as a programmer for a company that was
  25.     using Z80-based machines running CP/M 2.2 for all of their compu-
  26.     ting.  At  that  time,    I had a true-blue IBM PC at home,  and    I
  27.     thought  that  I might be able to do some of my  coding  work  at
  28.     home. The proverbial fly in the ointment was the fact that all my
  29.     work had to be put on the company's CP/M-format diskettes,  and I
  30.     had  no way (short of buying a commercial package) of going  from
  31.     one format to the other.
  32.  
  33.     My first attempt was a quick-and-oh-so-dirty program that did the
  34.     basic job of reading the CP/M disks on my PC.  It was crude,  but
  35.     it worked.  Some time later, I read a message on a BBS by someone
  36.     having the same problem I had just solved.  Naturally, I uploaded
  37.     the program, and thought no more about it.
  38.  
  39.     A  year  later,  I began getting phone calls from people who  had
  40.     gotten a copy of the program from a BBS,  and were wondering if I
  41.     would  be able to make it work for them.  I told them that  there
  42.     was  little I could do without either the exact specs  for  their
  43.     particular machine,  or at least a CP/M diskette to analyze.  One
  44.     gentleman actually sent me a diskette,    and I was able to hack up
  45.     the  program  so that it was able to read his diskette on my  own
  46.     machine.  But, when I sent him a copy of the program, it wouldn't
  47.     work on his machine. I haven't heard from him since.
  48.  
  49.     Just  a few weeks ago,    a consultant to the company  I    currently
  50.     work for mentioned that he had some interesting software,  but it
  51.     was all on CP/M-format diskettes.  Aha!  I thought, I can hack up
  52.     my old program yet again,  and check out his software.    It turned
  53.     out  that  it  was easier just to apply what I had learned  to    a
  54.     brand-new  program than it was to hack on the old  program.  Over
  55.     the course of the next few weeks, I developed CPMREAD.
  56.  
  57.     I have personally tested CPMREAD with the following CP/M formats:
  58.  
  59.     Sanyo MBC 1100/1150    256 byte sectors,  40 tracks,  8  sectors
  60.                 per track, 3:1 interleave.
  61.  
  62.     EasyData        1024 byte sectors,  40 tracks, 10 sectors
  63.                 per track, 1:1 interleave
  64.  
  65.     Visual 1050        512 byte sectors,  80 tracks,  10 sectors
  66.                 per track, double sided, 1:1 interleave.
  67.  
  68.     CPMREAD  should have no trouble reading ANY soft-sectored format,
  69.     as long as the diskette drive itself is capable of handling it.
  70.  
  71.                      CPMREAD
  72.                      =======
  73.  
  74.     Program Installation
  75.     --------------------
  76.  
  77.     To install CPMREAD & CPMDEFLT, just unARC the files to the direc-
  78.     tory you want. That's all.
  79.  
  80.  
  81.     Program Operation
  82.     -----------------
  83.     Program operation is quite simple. At the DOS prompt, type
  84.  
  85.         CPMREAD
  86.  
  87.     followed by a carriage return. CPMREAD will then prompt you to do
  88.     one of the following:
  89.  
  90.          1.    Press the Escape key.  This will cause CPMREAD to
  91.             terminate, returning you to DOS.
  92.  
  93.          2.    Press  'S'.  This will allow you to Set the  disk
  94.             parameters for your particular system.
  95.  
  96.          3.    Put  the CP/M diskette into the  A:  drive,  then
  97.             press  any other key to begin reading the  disk's
  98.             directory.
  99.  
  100.  
  101.     Setting the disk parameters
  102.     ---------------------------
  103.  
  104.     Pressing  the 'S' key at the opening screen will bring up a  menu
  105.     of options from A to H corresponding to the 8 changeable  parame-
  106.     ters.
  107.  
  108.     A) Physical sector size
  109.         This  represents the number of bytes in each disk sector.
  110.         The  standard PClone diskette controller supports  sector
  111.         sizes  of 128,    256,  512,  and  1024  bytes;  therefore,
  112.         CPMREAD and CPMDEFLT support only these values.
  113.  
  114.     B) Maximum directory entries
  115.         This  is  the  maximum number of 32-byte entries  in  the
  116.         diskette directory. Typically, this is either 64 or 128.
  117.  
  118.     C) Logical records per block
  119.         This  is  the  number of 128-byte records  in  each  CP/M
  120.         block.    For most diskettes,  this value is 16,    which re-
  121.         sults from a 2k block size.
  122.  
  123.     D) Logical records per track
  124.         This  is the number of 128-byte records in each  diskette
  125.         track.
  126.  
  127.     E) Logical records per directory entry
  128.         This  is the number of 128-byte records that can be  han-
  129.         dled by a single directory entry.  For double-sided  dis-
  130.         kettes under 400k in capacity, this value is usually 256.
  131.         For higher capacity diskettes, this value is usually 128.
  132.  
  133.     F) Number of reserved tracks
  134.         This  is the number of tracks reserved for system use  by
  135.         CP/M.
  136.  
  137.     G) Sector interleave
  138.         This is number of diskette sectors to skip to get sequen-
  139.         tial  sectors.    This can vary wildly from one  system  to
  140.         another.
  141.  
  142.     H) Number of sides
  143.         This is the number of readable sides on the diskette.
  144.  
  145.  
  146.     Determining the disk parameters
  147.     -------------------------------
  148.  
  149.     If you are running CP/M 3.0 or later,  the SHOW utility will tell
  150.     you most of what you need to know to run CPMREAD.  At the command
  151.     prompt,
  152.  
  153.         SHOW A:[DRIVE]
  154.  
  155.     will  display all of the necessary parameters except  the  inter-
  156.     leave factor.
  157.  
  158.     If you are running a version of CP/M earlier than 3.0, you have 2
  159.     choices: 1) experiment with CPMREAD, trying as many possibilities
  160.     as  you  can,  until you succeed;  2) be willing to learn  a  few
  161.     things about the innards of CP/M. If you prefer to use trial-and-
  162.     error,    you can skip the rest of this.    On the other hand, if you
  163.     have as little patience as I do,  you might be interested in what
  164.     you can do.
  165.  
  166.     I have provided a simple disk dump utility (DDUMP.COM) to help in
  167.     determining  at least some of the necessary diskette  parameters.
  168.     To  use DDUMP,    just put the CP/M diskette in the A:  drive,  and
  169.     type
  170.  
  171.         DDUMP <n>
  172.  
  173.     where <n> is a number from 0 to 9. This number is the track number
  174.     to dump. Keep in mind that track numbers start at 0.
  175.  
  176.     When DDUMP starts up,  the first thing it does is figure out  the
  177.     sector    size for you,  as well as the number of sectors per track
  178.     and the number of sides.  Once that is accomplished,  DDUMP  will
  179.     then output to a file named CONTENTS.CPM those values followed by
  180.     a  hexadecimal    dump  of the track you specified on  the  command
  181.     line.  The dump will be in the same basic format as DEBUG or  DDT
  182.     (the CP/M equivalent), with heading lines for each sector.  For a
  183.     sample of the output of DDUMP look at the CONTENTS.CPM file  from
  184.     this archive.
  185.  
  186.     The  sample CONTENTS.CPM file is from track 2 of a diskette  for-
  187.     matted    on a Sanyo MBC 1100.  It shows pretty clearly some of the
  188.     disk parameters for that particular machine: 256 byte sectors, 32
  189.     records per track, 2 sides, 3 to 1 interleave, 2 reserved tracks.
  190.     However,  it doesn't show the maximum directory entries,  logical
  191.     records  per block,  or logical records per directory  entry.  To
  192.     figure these out,  you need to analyze the dump a little. Sectors
  193.     that  contain  nothing but bytes of E5 have probably  never  been
  194.     written  to,  and they can be a good guide to both interleave and
  195.     max  directory    entries.  If you see a sector full  of    directory
  196.     entries followed by one or more sectors full of E5, you know what
  197.     the interleave is - 3 to 1 if sector 1 is directory, then sectors
  198.     2  and    3 are E5.  Also,  the directory takes up the  first  data
  199.     block,    so  once you get the interleave down,  you can tell where
  200.     the data blocks begin (and the directory ends).  With  that,  you
  201.     can  figure out both block size and number of directory  entries.
  202.     For example, looking at the sample CONTENTS.CPM, you can see that
  203.     the directory begins in sector 1. Sector 2, however, is obviously
  204.     NOT part of the directory,  as is sector 3.  The directory conti-
  205.     nues in sector 4,  which leads one to believe that the interleave
  206.     is 3 to 1.  Since the directory continues into sectors 7, 10, and
  207.     13,  you  know that at least 5 physical sectors are involved - in
  208.     order,    they are 1,  4,  7, 10, and 13. Sector 13 also contains a
  209.     bunch of E5 bytes, indicating that that is the last USED directo-
  210.     ry sector. By extrapolating from the interleave, you can see that
  211.     the  directory would also take up sectors 16,  3 and 6.  From all
  212.     this,  you  know that the directory takes up at least 8  physical
  213.     sectors,  or 16 logical (128-byte) records, yielding 64 directory
  214.     entries.  For there to be more sectors in the directory, sector 9
  215.     would ALSO have to contain either directory information or all E5
  216.     bytes - it doesn't,  so there has to be a maximum of 64 directory
  217.     entries,  and  an interleave factor of 3.  The    other  parameters
  218.     (block    size and number of records per directory entry) are  best
  219.     taken from educated guesses: if you know the approximate capacity
  220.     if the diskette, you have a good idea of these parameters. If the
  221.     disk can hold up to 400k, the probable values are 256 records per
  222.     directory entry and the block size is 16 records. If the capacity
  223.     of  the diskette is higher,  then you would probably want to  use
  224.     128 records per directory entry.
  225.  
  226.     As you can see,  it ain`t always easy.    But, with a little mental
  227.     effort,  you can do a lot.  And if that always fails,  well,  try
  228.     Zen.
  229.  
  230.     Seriously, if you really can't figure the parameters out, you can
  231.     get in touch with me at the telephone number below. We can proba-
  232.     bly work something out.
  233.  
  234.  
  235.     Copying files
  236.     -------------
  237.  
  238.     Once the parameters are correct and the directory is loaded,  you
  239.     will be presented with something like:
  240.  
  241.  BASCOM.COM    submit.com
  242.  baslib.rel    sysgen.com
  243.  bcload
  244.  brun.com
  245.  cpm.sys
  246.  cref80.com
  247.  dcop.com
  248.  ddt.com
  249.  disintel.com
  250.  ed.com
  251.  fbasic.com
  252.  format.com
  253.  l80.com
  254.  lib80.com
  255.  link.com
  256.  mbasic.com
  257.  obslib.rel
  258.  pip.com
  259.  rmac.com
  260.  stat.com
  261.  
  262. BASCOM.COM (253 records)
  263. [O]utput path: D:\CPM\C\
  264. Copy: [A]ll, [C]urrent, change [D]isks, [M]arked, [U]nmark all, [Q]uit
  265. Arrows move around, spacebar toggles mark
  266.  
  267.     The  screen  display consists of 20 lines of 5    columns  of  file
  268.     names, a line for miscellaneous messages, a line showing the size
  269.     of the currently highlighted file, a line showing the current DOS
  270.     output    path,  and 2 lines listing the program options.  (In  the
  271.     program, the letters between the "[" and "]" are in high-intensi-
  272.     ty video.) The options are:
  273.  
  274.     [O]utput path
  275.         This option allows you to set the path that files will be
  276.         copied to.  If that path doesn't already exist, the prog-
  277.         ram will create it for you.
  278.  
  279.     [A]ll
  280.         This option will copy ALL files from the diskette to  the
  281.         current output path.  During the copy,    you can press the
  282.         Escape key to abort.
  283.  
  284.     [C]urrent
  285.         This  option will copy the currently highlighted file  to
  286.         the current output path.  During the copy,  you can press
  287.         the Escape key to abort.
  288.  
  289.     change [D]isks
  290.         This  option allows you to change diskettes without  exi-
  291.         ting the program. It returns to the opening screen.
  292.  
  293.     [M]arked
  294.         This option will copy those files that have been marked.
  295.  
  296.     [U]nmark all
  297.         This option will remove the marks from any files that are
  298.         marked.
  299.  
  300.     [Q]uit
  301.         This option will exit the program, returning you to DOS.
  302.  
  303.     The  arrow keys will move among the file names,  and the Home and
  304.     End keys will move to the first and last files respectively.
  305.  
  306.     Note:    I have yet to try this program out on a diskette that had
  307.         more than 40 or 50 files.  Consequently, the display rou-
  308.         tines are the least tested parts of the program.  If any-
  309.         one finds a bug in the display,  please let me know about
  310.         it.
  311.  
  312.         There  is also a known problem when reading high-capacity
  313.         disks on 1.2MB diskette drives: sometimes the drive can't
  314.         read them.  From the limited information I've gathered, I
  315.         can't  see how to tell the BIOS to  expect  high-capacity
  316.         diskettes that are not 1.2MB. I don't have a machine with
  317.         those  kind of drives at home,    and I can't do much  with
  318.         the machines at work. If ANYONE out there knows how to do
  319.         this,  PLEASE  TELL ME.  The only way I've found to  read
  320.         these  kind of diskettes is to do some kind of    operation
  321.         with a 1.2MB disk immediately before. Just doing a direc-
  322.         tory seems to make it work.
  323.  
  324.     *****************************************************************
  325.  
  326.                     CPMDEFLT
  327.                     ========
  328.  
  329.     CPMDEFLT is just the 'S'et disk parameters option of CPMREAD made
  330.     into  a separate program.  The difference is that with    CPMDEFLT,
  331.     you can make permanent changes to the disk parameters.
  332.  
  333.  
  334.     Program operation
  335.     -----------------
  336.  
  337.     In its current incarnation, CPMDEFLT requires the executable file
  338.     CPMREAD.EXE for editing.
  339.  
  340.     To start CPMDEFLT, use a command line of the format
  341.  
  342.         CPMDEFLT [<exe file>[.EXE]]
  343.  
  344.     where the file name parameter is optional.  The default file name
  345.     is  CPMREAD.EXE.  You  can even give the file  name  without  the
  346.     extensions.
  347.  
  348.     Once  the  program  is    started,  it  will  behave  exactly  like
  349.     CPMREAD's  "Set parameters" option from the startup  screen;  all
  350.     the options are the same. The only difference is that when you're
  351.     ready  to  exit to DOS,  if you've made any changes you  will  be
  352.     asked if you want to save those changes.
  353.  
  354.     The  disk  parameters you see in CPMDEFLT are those that  CPMREAD
  355.     will  default  to (that's what the DEFLT stands  for).    The  main
  356.     reason    I  wrote this program was to permit  you,  the    user,  to
  357.     easily change the parameters to match the disk that you will most
  358.     often  be reading.  You could do this each time you ran  CPMREAD,
  359.     but I figure that the program should be making your life  easier,
  360.     not harder.
  361.  
  362.     *****************************************************************
  363.  
  364.     In closing
  365.     ==========
  366.  
  367.     I  realize  that this documentation is pretty scant,  but I  hope
  368.     that  the programs are simple enough that you won't have  trouble
  369.     (famous last words,  I know). Besides, programmers are not really
  370.     known for their great documentation,  just their great (?)  prog-
  371.     rams, right?
  372.  
  373.     In  the  event that you DO have a problem,  I can be  reached  at
  374.     (617)689-9749 until July 31,  1988. After that, I don't know; I'm
  375.     going  to  be moving.  If you want to get in touch  with  me,  my
  376.     mailing address on Genie is A.BRENNER,    and I read a lot of the C
  377.     Echo messages, as well as the Programmer's Echo messages.
  378.  
  379.     I have decided to release these programs free of charge, although
  380.     I retain the copyright. The source code is a different matter. If
  381.     anyone    would like a copy of the source code,  I will be happy to
  382.     send  it to them for a small fee of $25(US).  I will  supply  the
  383.     diskette and mailer.
  384.  
  385.     Best of luck.
  386.  
  387.     Aaron Brenner
  388.     7 July 1988
  389.  
  390.     9 Granite St. Apt. # 14
  391.     Methuen, MA 01844
  392.     (Until 31 July 1988)
  393.