SHOBLOCK.DOC -------------- from Horn Engineering Associates 13 October 1985 ------------------------------------------------------------------------ SHOBLOCK is the property of Horn Engineering Associates. It is released to the public domain for free use by anyone but it may not be be sold, either in itself or as a part of any collection of programs, without the express permission of Horn Engineering Associates. ------------------------------------------------------------------------ NOTE -------- A version of this program called TRACKSEC was previously released. That program is now obsolete and the name has been changed to SHOBLOCK to be more descriptive of functions that have been added. ------------------------------------------------------------------------ SHOBLOCK is a diskette utility that is intended to be an aid to the repair or recovery of file information from a damaged diskette. Even though it has not been tested on a hard disk, it is believed that it will produce accurate information. Let us suppose that, by use of a utility such as DISK DOCTOR, FBAD, or CERTIFY, it has been determined that a specified track, sector, or allocation block on a diskette is defective. What you really want to know is how much damage has been done to the disk files and whether or not these files can be easily re- covered. The damage might be to the directory tracks, in which case it might not be possible even to log the disk on for examination. SHOBLOCK might or might not permit logging for this purpose. If not, you might have to resort to other utilities, which frequently offer tedious methods of recovery. If SHOBLOCK permits a diskette with a bad sector in the direc- tory tracks to be logged on, it will report that the directory tracks can not be read. Usually, bad sectors will be located in diskette areas where file information is stored. If the diskette is known to have one or more specific bad sectors or blocks, SHOBLOCK can be used to report the file names that are affected. All other files can be copied to other media in any normal way, probably without BDOS read errors. SHOBLOCK only furnishes information. It will make no attempt to repair or recover bad sectors. It might be useful to understand the track, sector, and block numbering and structure conventions in CP/M. Each track will contain a specific number of physical sectors, depending upon the diskette format. For example, a standard SSSD 8-inch diskette is formatted to contain 26 physical sectors on each track. For any format, all of the structure information for each type of drive on-line is maintained in a Disk Parameter Block (DPB) within the system. SHOBLOCK extracts information from the DPB for its purposes. It is not necessary for the user to know the specific diskette format structure. The directory structure on the diskette is such that each file entry maintains a list of allocation blocks that are assigned for use by that file. Allocation blocks are made up of a specified number of sectors. For example, the standard 8-inch SSSD diskette is formatted such that 16 sectors are allocated to each allocation block. When a file is larger than can be described by the maximum number of allocation blocks in a directory entry, additional directory entries are created, using the same file name but flagged in the order in which they are assigned. These additional entries are called extents. They are transparent to the user, who expects each file to be represented by a single directory name. An important note here is that complete allocation blocks are assigned to directory entries. Individual sectors are not. This means that if a single sector is found to be bad, it might not be possible to recover any of the sectors that are assigned to the same block. For example, some utilities have the ability to lock-out "sectors" that are detected to be bad. What they actually do is lock-out any complete block that contains a bad sector. The important operational feature of SHOBLOCK is that you may enter TRACK and SECTOR numbers if you know them and the asso- ciated BLOCK number will be displayed. Alternately, you may enter a BLOCK number and the associated TRACK and SECTOR numbers will be displayed. In either case, the name of the file, if any, that is associated with the BLOCK number will be displayed. If you get lucky with a bad diskette, you will find that the BLOCK that contains a bad sector is not allocated to a currently active file. If this is the case, all files may be copied to other media without any BDOS read errors. An attempt might be made to reformat the bad diskette for further use. If so, the diskette should be tested before re-use, using a utility such as VERIFY. The numbering conventions of tracks and sectors are a source of confusion in the use of many diskette utilities. CP/M deals with track numbers starting with track 0, and logical sector numbers for a given track starting with sector 0. Logical sectors are assigned to blocks in numerical order. These sequential logical sector numbers do not usually correspond to the physical order of sectors on a track. There is usually a sector skew arrangement that skips physical sectors between sequential logical sector numbers. By convention, physical sectors are numbered starting with 1. The sector skew is a specific pattern that is maintained in the the BIOS for each type of drive. The purpose is to minimize disk access time. If you are using a diskette utility that makes no distinction between logical and physical sectors, you can only guess that if the number choices start with 0 you might be dealing in logical sectors. If they start with 1 you might be dealing in physical sectors. SHOBLOCK makes a distinction between logical and physical sectors. It offers a choice when your numbers are entered and it displays both. SHOBLOCK is completely menu driven. On entry, you will have an opportunity to exit if you wish. Otherwise, the various menus will ask for TRACK, SECTOR, or BLOCK number inputs, either in decimal or hexadecimal form. When all information is entered, the desired output data will be displayed and the entry menu will re-appear for additional input. A companion utility to SHOBLOCK is called SHOWLOC (currently SHOLOC20). This utility permits you to enter a file name and it will display all the TRACKS, SECTORS, and BLOCKS that are allocated to that file. If you are in posession of our predecessor of SHOBLOCK, called TRACKSEC, it is recommended that it be discarded. It provided sector number entries only as logical sectors, without distinction, and they were erroneously numbered starting with 1. If the use of that program caused you any problems, we offer our sincere apologies.