home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Misc / CBMDevKit5.dms / CBMDevKit5.adf / DOCS / tooldocs.lha / disked.doc < prev    next >
Encoding:
Text File  |  1993-11-04  |  6.9 KB  |  232 lines

  1. DISKED
  2.  
  3. Format:         DISKED <device>
  4.  
  5. Template:    DISKED "DEVICE/A"
  6.  
  7. Purpose:     To inspect and patch disk blocks.
  8.  
  9. Specification:
  10.  
  11. You can use DISKED to inspect and patch disk blocks; for instance, to
  12. recover information from a corrupt floppy disk.  However, because DISKED
  13. writes directly to the disk, you should use it carefully.
  14.  
  15. Only use DISKED with reference to the layout of an AmigaDOS disk. (For a
  16. description of this layout, refer to The AmigaDOS Manual.)  DISKED
  17. understands the AmigaDOS layout.  For instance, the R (Root Block) command
  18. prints the key of the root block.  The G (Get Block) command followed by the
  19. key number reads the block into memory, and the I (Information) command
  20. prints out the information contained in the first and last locations.  This
  21. information indicates the type of block, the name, the hash links, and so
  22. on.  If you specify a name after an H (Hash) command, DISKED gives you an
  23. offset on a directory page that stores as the first key any headers with
  24. names that has to the name you supplied.  If you then type the number that
  25. DISKED returns followed by a slash (/), DISKED displays the key of that
  26. header page.  You can then read that key with further G commands, and so on.
  27.  
  28. All DISKED commands are single characters, sometimes followed by arguments.
  29. The following is a complete list of the available commands.
  30.  
  31. COMMAND            FUNCTION
  32. B n            Sets logical block number base to n
  33.  
  34. C n            Displays n characters from the current offset
  35.  
  36. G [n]            Gets block n from the disk (default is the current
  37.             block number)
  38.  
  39. H name            Calculates the hash value of the name
  40.  
  41. NOTE: If you specify a name after an H command, DISKED gives you an offset
  42. on a directory page that stores, as the first key, headers with names that
  43. hash to the name you specified. If you then type the number that DISKED
  44. returns followed by a slash (/), DISKED displays the key of that header
  45. page.  You can then read on with further G commands, etc.
  46.  
  47. I            Displays block information
  48.  
  49. K            Checks block checksum (and corrects it if wrong)
  50.  
  51. L [lwb upb]        Locates words that match value under mask (lwb and
  52.             upb restrict the search)
  53.  
  54. M n            Sets mask to n (for L and N commands)
  55.  
  56. N [lwb upb]        Locates words that do not match value under mask
  57.  
  58. P n            Puts block in memory to block n on disk (default is
  59.             the current block number)
  60.  
  61. Q            Quit (do not write to disk)
  62.  
  63. R             Displays block number of root block
  64.  
  65. S char            Sets display style: char = C (characters), S
  66.             (string), O (octal), X (hexadecimal), or D (decimal)
  67.  
  68. T lwb upb        Types range of offsets in block
  69.  
  70. V n            Sets value for L and N commands
  71.  
  72. W            Windup (P & Q)
  73.  
  74. X             Inverts write-protect state
  75.  
  76. Y n            Sets cylinder base to n
  77.  
  78. Z             Zero all words of buffer
  79.  
  80. number            Sets current word offset in block; equals the
  81.             display values set in program
  82.  
  83. ?            Displays current values (number of cylinders,
  84.             blocks per track, number of blocks, block size, etc.)
  85.  
  86. /[n]            Displays word at current offset or updates value to
  87.             n
  88.  
  89. 'chars'            Puts characters at current offset
  90.  
  91. "chars"            Puts string at current offset
  92.  
  93. To indicate octal, start numbers with #; for hexadecimal, start numbers
  94. with #X.  You can also include BCPL language string escapes in strings (*N
  95. and so forth).
  96.  
  97.  
  98. Example 1:
  99.  
  100. Because DISKED can be somewhat difficult to learn, here is a sample session.
  101. You can try this out on a copy of your Workbench disk.  It will go through
  102. the most useful of the DISKED commands.  The block numbers in the sample
  103. session may not match your results exactly.  Therefore, you will need to
  104. fill in the block numbers DISKED displays on your system.
  105.  
  106. NOTE:  In this example, everything after a ";" is a comment and should not
  107. be typed.
  108.  
  109. HARDCOPY v1.0 recorded on 20-Jun-88 19:14:52 to file "ram:temp" To end the
  110. HARDCOPY session and close the file, type HARDCOPY END
  111.  
  112. RAM-DISK:> disked df0:
  113. AmigaDOS Disk Editor version 3.4
  114. Write protect mode set, cylinder base set to 0
  115. # r                ;Find the root block
  116.  Root Block is block 880
  117. # g 880            ;Get the root block
  118.  Block 880 read (cyl 40, sur 0, sec 0)
  119. # i                ;Display info about current block
  120.  Short file
  121.  Header key:       0
  122.  Highest seq num:  0
  123.  Data size:        72
  124.  First data block: 0
  125.  Checksum:         -173384115
  126.  Secondary type:   Root block
  127.  Parent Directory: 0
  128.  Hash Chain:       0
  129.  Filename:         "Workbench 1.3"
  130.  Modified:         Monday 20-Jun-88 18:52:18
  131.  Created:          Monday 20-Jun-88 11:45:57
  132.  Bitmap is Invalid
  133. # hc                ;Get the hash value for the "C:" directory
  134.  Hash value = 14
  135. # 14                ;Go to (longword) offset 14
  136. # /                ;Look at what is at the current offset
  137.  889
  138. # g 889            ;Go to the "C:" directory
  139.  Block 889 read (cyl 40, sur 0, sec 9)
  140. # hEd                ;Look up the hash of "Ed"
  141.  Hash value = 13
  142. # heD                ;Case is ignored for hashing
  143.  Hash value = 13
  144.  
  145. # 13
  146. # /
  147.  910
  148. # g 910
  149.  Block 910 read (cyl 41, sur 0, sec 8)
  150. # i                ;Get the info
  151.  Short file
  152.  Header key:       910
  153.  Highest seq num:  41
  154.  Data size:        0
  155.  First data block: 911
  156.  Checksum:         -59184531
  157.  Secondary type:   File
  158.  Extension block : 0
  159.  Parent Directory: 889
  160.  Hash Chain:       1346
  161.  Filename:         "Ed"
  162.  Created:          Monday 20-Jun-88 10:55:40
  163.  
  164.     ;When two or more names have the same hash value,
  165.     ;they are chained together.  In this case "Hash Chain"
  166.     ;points to the next one in line.
  167.  
  168. # g 1346            ;Go to next in hash chain
  169.  Block 1346 read (cyl 61, sur 0, sec 4)
  170. # i
  171.  Short file
  172.  Header key:       1346
  173.  Highest seq num:  6
  174.  Data size:        0
  175.  First data block: 1347
  176.  Checksum:         435379822
  177.  Secondary type:   File
  178.  Extension block : 0
  179.  Parent Directory: 889
  180.  Hash Chain:       0
  181.  Filename:         "Binddrivers"
  182.  Created:          Monday 20-Jun-88 19:13:34
  183.  
  184. # 82                ;Go to offset 82, where the comment is stored
  185. # sx                ;Set display to hex
  186. # /
  187.  00000000             ;No comment yet!
  188. # /#X01410000        ;Set a comment as the BCPL string "A"
  189. # /
  190.  01410000             ;Check it, looks ok!
  191. # k
  192. *** warning - checksum incorrect
  193. ***         - value in block was -38147475
  194. ***         - corrected to       -59184531
  195.  
  196. # x
  197.  Write protect mode unset
  198. # p
  199.  Block 910 updated (cyl 41, sur 0, sec 8)
  200. # q                ;Quit
  201.  
  202. RAM-DISK:> list df0:c/ed
  203. df0:c/ed                   19564 --p-rwed Today     10:55:40
  204. : A
  205.  
  206.  
  207. Example 2:
  208.  
  209. Consider deleting a file that, due to hardware errors, makes the filing
  210. system restart process fail.
  211.  
  212. 1.Locate the directory page that holds the reference to the file.  Do this
  213. by searching the directory structure from the root block, using the hash
  214. codes.
  215.  
  216. 2.Locate the slot that references the file.  This is either the directory
  217. block or a header block on the same hash chain.  This slot should contain
  218. the key of the file's header block.
  219.  
  220. 3.Set the slot to zero by typing the slot offset, a slash, then zero
  221. (<offset>/0).
  222.  
  223. 4.Correct the checksum with the K command.
  224.  
  225. 5.Disable the write protection of the disk with the X command.
  226.  
  227. 6.Write the update block to the disk with the P command or the W (Windup)
  228. command.
  229.  
  230. The blocks that the file used in error will become available again after the
  231. RESTART process has successfully scanned the disk.
  232.