DataMuseum.dk

Presents historical artifacts from the history of:

CP/M

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about CP/M

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download

⟦bc9288ec1⟧ TextFile

    Length: 25344 (0x6300)
    Types: TextFile
    Names: »HELP«

Derivation

└─⟦ee6c93f63⟧ Bits:30009434 50004973
    └─⟦e5efac989⟧ 
        └─⟦this⟧ »HELP« 

TextFile

Introduction
CP/M Disk File Structure
Install Disk Doctor
Invoking Disk Doctor
Recovering Disks and Files, Wards A,B, and C
Un-erasing Files, Wards D and E
Common Disk Problems and Recovery Procedures
:Introduction
Disk Doctor is comprehensive diskette  recovery  package
comprised of an installation program (INSTALL.COM) and  five
recovery procedures (DOCTOR.COM),  refered  to  as  "Wards,"
each capable of performing a specific recovery task.   Three
general kinds of facilities are provided.  Ward A  can  help
restore the usefulness of disks with malfunctions  in  areas
not assigned to files.  Wards B and C can aid in  recovering
files affected by disk malfunctions.  Wards D and E can  aid
in recovering  files  accidentally  erased.    As  an  added
benefit, Ward A can also be used to certify  new  disks  and
eliminate any bad sectors before they  can  cause  problems.

▶04◀
TWO IMPORTANT WARNINGS 

     If you know or suspect  that  you  have  both  unwanted
erasures and malfunctions on the same disk,  you  must  deal
with all erasures first.  This is  necessary  because  those
procedures  used  to  recover  from  disk  malfunctions  may
overwrite erased files, making  their  recovery  impossible.

     Before  attempting  to  use  any   of   DISK   DOCTOR's
facilities,  you  must  be  certain  that  it  is   properly
installed for each disk format on which you  intend  to  use
it.  DISK DOCTOR comes pre-installed for the type  of  media
on which it was supplied; but if you wish to use it on other
media or densities,  a  careful  reading  of  Chapter  3  is
recommended.  

: CP/M  FILE STRUCTURE 

     This system is hierarchical in structure.   Its  levels
are, in order of decreasing size:    the  disk  itself,  the
file, the extent, the track, the group, and the sector.   It
is one of the most convenient and desirable features of CP/M
that all ordinary data manipulations  may  be  performed  in
terms  of  disks  and  files  alone.    However,  to  better
understand how DISK DOCTOR's Wards perform their tasks  and,
in particular to make good use of Ward B, you  will  need  a
good grasp of all levels of the CP/M  file  structure.    In
this chapter we will describe each level  of  the  hierarchy
starting with the smallest sized structure and  working  up.

     The smallest unit (above the byte--or character) in the
hierarchy is the sector.  A sector is the  minimum  unit  of
disk data accessible by CP/M.  CP/M defines a sector as  128
bytes  (characters).    It  expects  these  sectors  to   be
organized into tracks.  The  track  is  merely  a  means  of
organizing and locating the individual sectors  on  a  disk.

     The unit in which CP/M allocates sectors  to  files  is
the group.  A  group  is  composed  of  a  fixed  number  of
sectors, either 8 or 16 depending on the  implementation  of
CP/M on your system.  Space for the disk directory  is  also
allocated in groups.  

     An extent is, in turn, made up of a variable number  of
groups with the maximum number of groups per extent being  8
or 16 depending on your CP/M  implementation.    (Most  CP/M
systems have a maximum of 128 sectors per extent:  either 16
groups of 8 sectors,  or  8  groups  of  16  sectors.    The
Intertec Superbrain, however, has extents with a maximum  of
16 groups of 16 sectors or 256 sectors per extent.)  A  CP/M
file  is  composed  of  one  or  more  extents;   therefore,
assigning  a  variable  number  of  groups  to   an   extent
facilitates  the  efficient,  dynamic  allocation  of   disk
storage to files.  

     A disk may contain from zero to many files.  Each  disk
is accessed by the system through its assigned  drive  name.
A disk retains its hierarchical structure with the exception
of the drive name when it is removed from the drive.    Thus
it makes sense to talk about a disk containing a file,  even
if the disk is not in a drive (i.e., is not assigned a drive
name).  
▶04◀
FORMAT OF A DIRECTORY ENTRY 

     Thus far, we have described the structure of CP/M  disk
files themselves.  However, for each extent  of  each  file,
there exists, also on  disk,  a  32-byte  field  called  the
directory entry.  All directory entries together make up the
disk directory which usually resides within the first one or
two groups on the disk.   A  directory  entry  fulfills  two
important functions in the CP/M disk file system:  first, it
provides a means of managing the storage allocated to  files
on the disk; and second, it provides the means  of  locating
those same files.  

▶04◀
     Knowledge  of  the  format  of  a  directory  entry  is
potentially useful, since Ward B (in conjunction with CP/M's
DUMP or DDT facilities) can be  used  to  examine  directory
entries (see p.  16), and since sophisticated use of Ward  B
requires their examination.   The  diagram  appearing  below
represents the format of the 32-byte field  of  a  directory
entry.  

      0                      16                    31 
      ø                       ø                     ø 
     øXNøNNøNNøNNøNTøTTøEXøXSøGGøGGøGGøGGøGGøGGøGGøGGø 
 
      N -- byte in filename field 
      T -- byte in file type field 
      E -- extent number 
      S -- extent size in sectors 
      G -- byte in group allocation map field 
      X -- byte of no interest to us 

▶04◀
The group allocation  map  field  contains  a  list  of  the
logical group numbers in the order the groups were  assigned
to the file.  Three formats in  use  (under  different  CP/M
implementations) for this 16-byte field are  represented  in
the three diagrams appearing below (the 'g's stand for group
numbers and the '0's stand for zero bytes --recall that 8080
word format is low order byte, high order byte).  

     16                    31 
      ø                     ø 
     øGGøGGøGGøGGø00ø00ø00ø00ø 
      8  groups/extent,  group  number   stored   per   byte

     16                    31 
      ø                     ø 
     øG0øG0øG0øG0øG0øG0øG0øG0ø 
      8  groups/extent,  group  number   stored   per   word

     16                    31 
      ø                     ø 
     øGGøGGøGGøGGøGGøGGøGGøGGø 
      16  groups/extent,  group  number  stored   per   byte

:  HOW TO INSTALL DISK DOCTOR 

     DISK DOCTOR is composed of two files:   DOCTOR.COM  and
INSTALL.COM.  The first few sectors  of  DOCTOR.COM  contain
information about the disk environment in which  it  expects
to operate.  It is this information that INSTALL.COM  alters
to tailor DOCTOR.COM to a particular new disk format.  To do
this  INSTALL.COM  requires:    that  you  insert   a   disk
containing DOCTOR.COM in drive A and a blank formatted  disk
in a drive which you may specify when prompted (CR  defaults
to B), and that you supply it with  the  proper  values  for
three parameters when you are prompted  to  do  so.    These
parameters are:  

 1.) the lowest physical sector number on a track (either  0
     or 1, most drives start numbering at 1); 

 2.) the number of sectors on a track (in CP/M  version  2.0
     and later STAT <drive name>:DSK:  provides  the  number
     of sectors on a track); 

 3.) the number of tracks on a disk.  


: Invoking Disk Doctor
     DISK  DOCTOR  exists  as  an  executable  command  file
(DOCTOR.COM) on disk.  It does not require any command  line
arguments when invoked.  It currently does  require  a  dual
disk drive system to perform its functions.  There should be
a disk containing DOCTOR.COM in drive A before invoking DISK
DOCTOR.  Once DISK DOCTOR is  loaded  into  memory  and  the
first question answered, that disk can be  removed,  as  the
program resides in memory until exited.  

     First DISK DOCTOR asks you to select one of three  disk
operation display options.  To enable this display is useful
only if your console can support a carriage return without a
line  feed.    When  the  program  is  performing  disk  I/O
operations, it will display the track, group, and sector  of
each operation by rewriting  the  same  line  with  updates.
When bad data is encountered a carriage return  and  a  line
feed are executed--leaving  the  guilty  track,  group,  and
sector displayed above the current line.  Choosing the first
option, "S", will result in a full display of all  disk  I/O
operations by sectors.
:  Recovering Disks and Files:  Wards A, B, and C 


     The basic principle underlying Wards A,  B,  and  C  is
that most disk malfunctions  are  simply  the  result  of  a
single sector failing to be read or written properly.   Such
a malfunction will have different effects and  will  require
different remedies depending on whether the  bad  sector  is
within a group assigned to the directory or  to  a  file--or
within a group not presently assigned.  

▶04◀
BAD SECTORS IN GROUPS ASSIGNED TO THE DIRECTORY 

     If there is a single bad sector in the directory  of  a
disk, CP/M will not read the  directory  past  that  sector.
Hence, although some files may still be read,  none  may  be
written.  In most cases, the bad sector will have nothing to
do with the file or files of  interest  to  the  user.    To
placate this protective feature of CP/M, Ward C will copy an
entire disk, replacing all data in any  damaged  sectors  in
the directory with the disk formatting character, 0E5h; thus
allowing the rest of the directory to  be  accessed  through
the usual system commands.  If the bad  sector  does  affect
the directory entry of a  file  of  interest,  then  Ward  B
provides a means of working around  the  system  to  extract
data from the directory and the file.  

▶04◀
BAD SECTORS IN GROUPS ASSIGNED TO FILES 

     If a file contains a single bad sector, CP/M  will  not
read the file beyond that sector  and  the  entire  file  is
rendered useless.  While a sector of bad data in  an  object
file might mean that the  file  is  useless,  a  single  bad
sector in a source or  text  file  would  be  only  a  minor
annoyance if the rest of the file could be recovered.   Ward
C will, as it copies, also  replace  all  data  in  any  bad
sectors that it finds in files  with  ASCII  spaces.    This
allows the user to edit the file and easily repair it.    It
might seem that a file could be recovered down to  a  single
bad byte, but this is not possible because many disk control
systems buffer their read operations (read data  in  blocks)
and most errors cause a loss of sychronization.  
▶04◀
BAD SECTORS IN UNASSIGNED GROUPS 

     If a bad sector appears in an  unassigned  group,  CP/M
will not make use of any of the good sectors above  it,  and
will refuse to close any file that attempts to write to  the
bad sector.  Since each disk storage operation will  attempt
to use the lowest available  group,  the  disk  will  be  as
useless as if it were full.  Ward A  circumvents  this  CP/M
protective  feature  by  means  of  assigning   all   groups
containing bad sectors to a special file intended  never  to
be used again.  
▶04◀
WARD A 

     This Ward is concerned with restoring the usefulness of
a disk rather than recovering data from it.  Like the  other
DISK DOCTOR programs, it uses the most primitive BIOS  hooks
to bypass the automatic CP/M features.   Ward  A  loads  the
directory from the disk containing  the  bad  sector(s)  and
searches for all unassigned groups.  This prevents damage to
the intact files on the disk.    Each  unassigned  group  is
written and read to validate its integrity.  If the  program
locates a bad  sector,  it  will  assign  the  entire  group
containing  it  to  a  special  file  called  MORGUE;   thus
effectively  eliminating  the  bad  group  from  the   disk.
Obviously, you should never use the filename MORGUE  in  any
of your own programs.  Also, unless you want  the  same  bad
groups to return to haunt you, you must NEVER  ERASE  MORGUE
FILES.  (Under CP/M Version 2.0 and later, MORGUE files have
the R/O attribute set to prevent such erasures.) 

     The file type (extension) of a MORGUE file also  serves
a purpose.  The first time Ward A is run on a  disk;  if  it
finds bad sectors, it will open a file:  MORGUE.NO1.    Each
time it is rerun on the same disk;  if  it  finds  more  bad
sectors, it will  generate  another  consecutively  numbered
MORGUE file (e.g., MORGUE.NO2).  Thus it is possible to  see
at a glance if a disk has been prone to trouble,  and  avoid
selecting it for critical work.  Sometimes it  is  necessary
to run Ward A on a disk several times in order to cause  all
faulty sectors to fail.  

▶04◀
     The three "do's and don'ts" listed below are  essential
to the effective use of Ward A.  

 1.) It cannot be overemphasized that you must  never  erase
     any MORGUE files.    Erasing  a  MORGUE  simply  undoes
     everything Ward A has done.  

 2.) If there are erased files on a disk which you  wish  to
     recover  by  using  Ward  D,  you  must  do  so  before
     executing Ward A on the disk.  Once it is executed,  no
     erased file can be recovered as all of its groups  will
     be overwritten.  

 3.) Before running Ward A  on  a  disk,  all  temporary  or
     aborted files (such as those with the  extension  .$$$)
     on the disk should be erased.  Some  text  editors  may
     close such files when bad sectors are encountered,  and
     then re-open them later.  This will  cause  Ward  A  to
     miss the troublemaker, since the  group  containing  it
     appears to be assigned to a file.  


▶04◀
     If you select Ward A from DISK DOCTOR's menu, you  will
first be prompted to place your bad disk  in  the  "patient"
drive you previously designated.  You will then be given one
last chance to decide whether you actually want to run  Ward
A or not.  If not, the program returns you  to  "Admitting."

▶04◀
WARD B 

     This Ward allows  you  to  pull  arbitrarily  specified
groups or sectors of data off  of  one  disk  (patient)  and
collect them in a specified file on another disk (recovery).
You can then edit this file, discarding the data that is  of
no value  to  you.    This  is  a  powerful,  though  rather
primitive capability.  To get the maximum  benefit  from  it
requires an informed and thoughtful approach.    You  should
note that, through this Ward, the directory is as accessible
as the files.  If you are searching for the groups  assigned
to a particular file; examining the directory, even if it is
damaged, should provide valuable information.

     If you select Ward B from DISK DOCTOR's menu, you  will
first be prompted to place the bad disk  in  the  previously
specified  "patient"  drive  and  a   good   disk   in   the
corresponding "recovery" drive.  You will then  be  prompted
to specify the collection file on your recovery disk.  After
you have typed your collection filename and hit return,  the
program will ask you whether you wish  to  recover  data  by
group or by sector.  Then according to your choice, data  is
collected into a  buffer  by  specifying  either  hex  group
numbers or hex track and sector numbers when  prompted.    A
bad disk is not required to have a good directory as  it  is
never accessed unless specified for collection.   In  either
collection mode, a carriage return entry will cause the next
logical group or track-sector combination to  be  collected.
When all desired data has been collected, the  file  can  be
closed by typing a period and carriage return (same  as  DDT
Substitute).  If the buffer becomes full, a message will  be
displayed, and the file will be closed  automatically.    In
the case of very long files, several recovery files  may  be
specified, and then concatenated using PIP.  

     Files recovered using Ward B are just  like  any  other
files under CP/M.  Files containing text may be viewed using
the TYPE transient.  With enough patience, text  files  with
directory entries damaged beyond  recovery  can  be  gleaned
from a disk.  Files containing object code may  be  examined
using DDT dump or DUMP transients.    File  directories  may
also be examined by these means.  Much information  that  is
not otherwise visible can be accessed through this  program.
A good example of this is the use of  Ward  B  to  determine
whether  or  not  DISK  DOCTOR  itself  has  been   properly
installed.  

▶04◀
WARD C 

     This Ward is your main resource for  dealing  with  bad
sectors in files and directories.  It can best be thought of
as a very tolerant disk copying routine.  Ward C copies each
good sector, in sequence, just as it finds it; but each  bad
sector is filled with characters which function  as  blanks.
In the  case  of  directories,  the  blank  disk  formatting
character, 0E5h is used.  Bad sectors in  files  are  filled
with ASCII spaces.  This will solve most problems  involving
accessing files.  The only access problem it cannot solve is
that of an important file with a  damaged  directory  entry.
Files with directory entries unaffected by bad  sectors  can
be accessed and manipulated in all  the  ways  CP/M  usually
allows.  They can thus be examined and any  damaged  sectors
repaired to the extent possible.  

     One disadvantage of Ward C is that it is slow.  To copy
a disk using this program can take up to an  hour  depending
on the drive and the number of bad sectors encountered.   It
will more commonly take about ten minutes.   This  routine's
slowness results from its circumvention of  the  usual  CP/M
file handling utilities.  

:  Un-erasing Files:  Wards D and E 

     Files may be erased in error either  directly  by  user
command (ERA) or indirectly as a result of a program's  file
handling.  Wards D and E will  allow  the  user  to  recover
completely from both  kinds  of  errors  provided  that  the
groups originally assigned to the erased files have not been
reallocated to other  files.    If  some  groups  have  been
reallocated,  it  may  still  be  possible  to  salvage  the
remaining groups in the file through skillful use of Ward B.
If no disk write operations have been  performed  since  the
erasure, then the erased file will  always  be  recoverable.

     Wards D and E rely on the fact that CP/M, in  its  file
management, does the minimum amount of processing necessary.
Hence, CP/M's erasing process involves  a  few  flag-setting
operations rather than any overwriting of a file's  assigned
groups or directory entries.  This allows files with  groups
not yet reallocated  (and  thus  overwritten)  to  be  fully
recovered  by  re-setting  those  flags  to  their  original
values.  

     If you know the exact name of the erased file, you  can
go directly to Ward D to recover it.  If you do not know the
name, Ward E provides a directory  of  all  the  recoverable
erased files (as well as all the active files), by  extents,
on a disk.  

▶04◀
WARD D 

     This  Ward  performs  its  functions  by  reading   the
directory of a  disk  and  then  rewriting  it,  with  minor
changes, back to the same disk.  The program operates in two
modes:  as an erased file recovery routine and  as  a  fast,
but dangerous directory repair routine.

     The primary use of Ward D is to recover  erased  files.
After you enter the program, you will be asked to place  the
disk with the  erased  file  in  the  previously  designated
patient drive, give the unambigous filename  of  the  erased
file, and hit return.    The  program  will  then  read  the
directory of the disk and search for the specified file.  It
will indicate if it has found the file and, if so, will then
proceed to check whether any active  file  has  cannibalized
the groups of the desired file.  If any of the groups appear
in the directory entry of an active file, the  program  will
inform you that the file is not recoverable.  If not it will
un-erase the file.  If only a few groups have been  lost  to
active files, then it may be worthwhile to  use  Ward  B  to
recover  the  groups  remaining.    (NOTE:    If  many  disk
operations have been carried out since the erasure, there is
a chance that groups have been used  by  a  file  which  has
itself been subsequently erased.  If so, Ward D may not warn
you that  the  reactivated  file  is  essentially  useless.)

▶04◀
     Ward D can recover multiple extent files, but  only  if
the following conditions are satisfied:  

 1.) all groups in all extents are unallocated, 

 2.) all extents are in ascending order, 

 3.) no extents are missing.  
     
If any one of these conditions is not met, Ward D  will  not
recover the file.  Ward B is then  the  appropriate  remedy.
(NOTE:  You must rename any active file of the same name  as
the erased file you wish to  recover,  prior  to  attempting
recovery.  Erasing the namesake would  only  result  in  its
being un-erased.) 

▶04◀
WARD E 

     This is a  specialized  directory  program.    It  will
display all the files on a disk; with the erased, apparently
recoverable  files   enclosed   in   parentheses:      e.g.,
(MUGWUMP.TXT).  As in Ward D, the appearance of  a  file  as
recoverable does not guarantee that it has not been  damaged
by a file which has in turn been erased.   This  program  is
very useful in searching disks for a recoverable version  of
a lost file.  Ward D would  then  be  used  to  attempt  the
recovery, as Ward E only reads the directory  and  does  not
modify it in any way.  It requires that you place  the  disk
to be searched in the designated patient drive and give your
consent for the program to proceed.  

     In order for a file to be recovered, it must show up in
all its extents during Ward E, and the extents  must  be  in
ascending order.  If, for example,  extent  00  is  missing,
Ward D will not attempt to recover extent  01  of  the  same
filename.  If extent 01 preceeded extent 00 in  the  Ward  E
display, WARD D would not attempt to recover  either  extent
because that version of extent 01  must  have  been  from  a
different generation of  the  file  (CP/M  always  puts  the
extents in ascending order).  Ward B can be  used  to  piece
together such fragmented files if necessary.  

:  Common Disk Problems and Recommended Recovery Procedures 

_____________________________________________________________ 
I.    File(s) accidentally   ø  Invoke DISK DOCTOR (p. 10), 
        erased, filename(s)  ø  go to Ward D (p. 19).  If 
        known.               ø  portions of erased file(s) 
                             ø  have been reallocated, you 
                             ø  can go to Ward B (p. 16) to 
                             ø  salvage the remaining groups. 
-----------------------------ø------------------------------- 
II.   File(s) accidentally   ø  Invoke DISK DOCTOR (p. 10), 
        erased, filename(s)  ø  go to Ward E (p. 19). Disk 
        unknown              ø  directory with filename(s) of 
                             ø  recoverable erased file(s) 
                             ø  in parentheses will be dis- 
                             ø  played. Continue as in I 
                             ø  above. 
-----------------------------ø------------------------------- 
▶04◀
III.  All existing files are ø  Invoke DISK DOCTOR (p. 10), 
        intact, but attemp-  ø  go to Ward A (p. 15).  æThis 
        ting to create a new ø  same procedure may also be 
        file results in CP/M ø  used to screen new disks and 
        error message--BDOS  ø  eliminate malfunctioning 
        ERR ON d:BAD SECTOR. ø  groups from further use.å 
-----------------------------ø------------------------------- 
IV.   An attempt to access   ø  Invoke DISK DOCTOR (p. 10), 
        an existing file re- ø  go to Ward C (p. 18). The de- 
        sults in CP/M error  ø  sired file should be acces- 
        message--BDOS ERR ON ø  sible on the disk copy gene- 
        d:BAD SECTOR, but    ø  rated by Ward C, although 
        file directory is    ø  data in any bad sectors will 
        still accessible.    ø  be replaced by ASCII spaces. 
-----------------------------ø------------------------------- 
V.    Any attempt to access  ø  Invoke DISK DOCTOR (p. 10), 
        directory (such as   ø  go to Ward C (p. 18). If the 
        entering DIR) re-    ø  desired file still cannot be 
        sults in CP/M error  ø  accessed on the disk copy 
        message--BDOS ERR ON ø  generated by Ward C, go to 
        d:BAD SECTOR.        ø  Ward B (p. 16) to salvage 
                             ø  what data you can from the 
                             ø  original disk or the copy. 
-----------------------------ø------------------------------- 
TO THE USER:  As the creator of a program cannot always con- 
ceive of all uses to which it may be put;  if you discover 
other ways to use DISK DOCTOR to your advantage, please call 
or write us at SuperSoft to tell us about it. 
«eof»