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 / ENTERPRS / CPM / UTILS / A / DU-TUTOR.ART < prev    next >
Text File  |  2000-06-30  |  35KB  |  937 lines

  1.  
  2.                      A Reference Guide to DU
  3.                          (Disk Utility)
  4.  
  5. An  "Impatient User's Guide" to DU (Disk Utility),  a famous disk 
  6. fixer from the public domain libraries.
  7.  
  8. Prepared  for The User's Guide Magazine,  Vol.1,  No.4 June  1983 
  9. (pages  53-63) by Kelly Smith (TUG Contributing Editor) from  the 
  10. original program and documentation by Ward Christensen,  prolific 
  11. contributor to the world of public domain CP/M software.
  12.  
  13. For more information on this article and others like it,  contact 
  14. The User's Guide to CP/M Systems & Software,  Box 3050, Stanford, 
  15. VA 94305, (415) 851-7352.  TUG is published every two months, $18 
  16. US, $24 outside US (add $10 for first class delivery anywhere).
  17.  
  18.                           Introduction
  19.  
  20. DU  is a comprehensive "disk diddler" utility that allows a  user 
  21. to  examine  and modify ANY portion of a CP/M-80 (Version 2.0  or 
  22. greater) disk at the "byte level".  An "On-Line Help" facility is 
  23. included  (just press the '?' key followed by RETURN) should  you 
  24. forget  the  extensive  command set  (typically  single  keyboard 
  25. entries, terminated with a RETURN key). 
  26.  
  27. A  word  of caution to the novice user...it is possible to  DU  a 
  28. disk to death!   That is,  casual modification of portions of the 
  29. CP/M-80  operating  system data tracks is usually destructive  to 
  30. the proper operation of the "copy" of CP/M on the modified  disk.  
  31.  
  32. Use particular care when writing your modifications back to disk!
  33.  
  34. DU  is  an invaluable tool for recovery of "bombed  directories", 
  35. modification  of  CP/M "run time" parameters,  or even  making  a 
  36. "backup"  of your disk directory and preserving it someplace  "in 
  37. reserve" on your disk...the possibilities are NOT LIMITED by DU!
  38.  
  39. The  best part is that it was provided FREE to the public  domain 
  40. (may be freely used and given away) by Ward Christensen, and even 
  41. includes  source  code  for  your  detailed  examination   and/or 
  42. customization (when customizing public domain software, your "on-
  43. your-own" however...don't expect "hand-holding" from the original 
  44. author when you "write on their wall"!).
  45.  
  46. So  before you go out and BUY a functionally  identical  software 
  47. package (Gads!  I would love to name names!!!), take a look at DU 
  48. first.  You wont't find a better program for the money!
  49.  
  50. Thank you again Ward,  for yet another major contribution to  the 
  51. CP/M  software user community!   So without further ado,  here is 
  52. your User's Guide to DU (poetic!):
  53.  
  54.  
  55.                               Index
  56.  
  57. 1.0 Installation.
  58.  
  59. 2.0 Usage.
  60.  
  61.      2.1 Commands, by Function (Quick Reference).
  62.  
  63.      2.2 Alphabetic Command Summary.
  64.  
  65. 3.0 Usage Notes.
  66.  
  67.      3.1 Multiple Commands.
  68.  
  69.      3.2 Dump Commands.
  70.  
  71.      3.3 Logging in Disk.
  72.  
  73.      3.4 Sector Buffers.
  74.  
  75. 4.0 Interpreting CP/M Directory Data.
  76.  
  77.      4.1 Single Density.
  78.  
  79.      4.2 Double Density.
  80.  
  81. 5.0 DU Usage Examples
  82.  
  83.      5.1 Erased Program Recovery
  84.  
  85.      5.2 Modifying a Disk for "Program Autoload"
  86.  
  87.      5.3 Finding and Modifying Program Data Quickly
  88.  
  89.      5.4 A "Poor Man's" Disk Test
  90.  
  91.  
  92. 1.0 Installation
  93.  
  94. DU  (Disk Utility),  Versions 7.0 and later,  are designed to  be 
  95. installed  with  a minimum of trouble.   In fact,  in almost  all 
  96. cases,  no changes to the source file should be necessary to  get 
  97. DU "up and running".   Yes!  8080 source code is available if you 
  98. want  it from various RCPM systems as well as directley from  the 
  99. CP/M  User's Group library (or you may contact the CPMUG care of: 
  100. Lifeboat Associates, 1651 Third Avenue, New York. N.Y. 10028).  
  101.  
  102. The only requirement for usage of DU, is that you must be running 
  103. in  a CP/M-80 Operating System environment of "vintage"  2.0  (or 
  104. greater).  This  is  because  DU uses the  disk  parameter  block 
  105. incorporated in the latest releases of Digital Research's CP/M-80 
  106. to  determine the characteristics of the disk  environment.  Note 
  107. also,  that  earlier versions of DU supported only the standard 8 
  108. inch  "distribution  standard" IBM 3740  type  diskette,  running 
  109. CP/M-80  version 1.4 and in some cases did not work  for  certain 
  110. "non-standard" versions of CP/M-80 (i.e., CDOS from Cromemco, and 
  111. some implementations of CP/M-80 from Lifeboat Associates). 
  112.  
  113. The only parameter that you might need to change, will be the CPU 
  114. clock  speed flag at address 103H (when DU is loaded into  system 
  115. memory).   Leave  this  byte  zero if you have  a  2  MHz  clock.  
  116. "Patch"  it  non-zero (change the address content to 0FFH) for  4 
  117. MHz (refer to your Digital Research DDT (Dynamic Debugging  Tool) 
  118. documentation  if you are unfamilier with modification of program 
  119. files,  and "patching" techniques).   This is only needed for the 
  120. "Z"  (sleep)  command.   An  alternative is just  to  use  larger 
  121. numbers when running DU with a computer system clock rate of 4MHz 
  122. or greater.
  123.  
  124.  
  125. 2.0 Usage
  126.  
  127. An  initial command string may optionally be placed as an operand 
  128. of the DU command at the CP/M system user command level, i.e.:
  129.  
  130.                 A>DU G0;D;G2;=OK<D><A><1A>;D<cr>
  131.  
  132. For  example,  if you want to only 'MAP' the disk and then  exit, 
  133. you would enter at your console keyboard:
  134.  
  135.                           A>DU M;X<cr>
  136.  
  137. The  DU  program  would  then respond  with  the  diskette  'MAP' 
  138. (actually a display of the diskette Group Allocations),  as shown 
  139. in  the  following  example  'MAP'  of  a  Compupro  8/16  System 
  140. diskette:
  141.  
  142. DISK UTILITY ver 7.7
  143. Universal Version
  144.  
  145. Type ? for help
  146. Type X to exit
  147. 0004-0005  00 COPY    .COM 00 : 0006-000D  00 WS      .COM 00 
  148. 000E-0010  00 DDT     .COM 00 : 0011-0018  00 FMTMEM  .COM 00 
  149. 0019-001A  00 FORMAT  .COM 00 : 001B-001B  00 CONV    .COM 00 
  150. 001C-001C  00 CRCK    .COM 00 : 001D-001D  00 CROSSREF.COM 00 
  151. 001E-001E  00 D       .COM 00 : 001F-0021  00 DU      .TXT 00 
  152. 0022-0025  00 PIP     .COM 00 : 0026-0026  00 XDIR    .COM 00 
  153. 0027-0027  00 FILE-XT2.COM 00 : 0028-002E  00 RMAC    .COM 00 
  154. 002F-0033  00 LINK    .COM 00 : 0034-0034  00 EXEC    .COM 00 
  155. 0035-0035  00 SYSGEN  .COM 00 : 0036-0036  00 FMAP    .COM 00 
  156. ~                                                           ~
  157. |  The  diskette 'MAP' shown here is "edited" for brevity!  |
  158. ~                                                           ~
  159. | .-- Group Allocation Number                               |
  160. ~ |           .-- Filename                                  ~
  161. | |           |        .-- Filetype                         |
  162. ~ |           |        |    .-- Extent Number               ~
  163. | |           |        |    |               .-- User Number |
  164. ~ |           |        |    |               |               ~
  165. 020F-020F  00 PBIOS   .ASM 03 : 0210-0216  01 ALIENS  .COM 00 
  166. 0217-0218  00 PBIOS   .ASM 03 : 0219-0219  00 MOVCPM  .COM 00 
  167. 021A-021A  00 MNTR    .DOC 00 : 021B-021C  00 PRNT    .DOC 00 
  168. 021D-0220  00 REQ'D-SW.DOC 00 : 0221-0228  00 SW-DEF  .TXT 00 
  169. 0229-0230  00 SW-DEF  .TXT 01 : 0231-0238  00 SW-DEF  .TXT 02 
  170. 0239-023E  00 MOVCPM  .COM 00 : 023F-0241  00 FORMAT  .ASM 00 
  171. 0242-0242  00 FORMAT  .ASM 01 : 0243-0247     ++FREE++        
  172. 0248-024B  00 PBIOS   .ASM 04 : 024C-0253  00 SETATR  .ASM 00 
  173. 0254-0254  00 PBIOS   .ASM 04 : 0255-0257     ++FREE++        
  174.  
  175. G=0000:00, T=4, S=1, PS=0
  176.  
  177. A>
  178.  
  179.  
  180. Once  DU  is running,  it will display the character ':'  as  the 
  181. command  level prompt,  and expects single-letter  commands  much 
  182. like  DDT.   For ease of use,  multiple commands may be placed on 
  183. one  line,  separated by ';'.   In addition,  a given command  or 
  184. string  of commands may be repeated,  either indefinitely  (until 
  185. Control-C  (shown from now on as '^C') is pressed),  or  a  given 
  186. number of times.
  187.  
  188. To  avoid  an  accidental ^C from dropping out  of  DU,  only  an 
  189. explicit 'X' command will exit DU.
  190.  
  191.  
  192. 2.1 Commands, by Function (Quick Reference)
  193.  
  194. Help: 
  195.     ?    Request help. Example:
  196.  
  197.                 :?<cr>
  198.                 Operands in brackets [...] are optional
  199.                 Numeric values: 'n' are decimal, 'x' hex
  200.  
  201.                 +[n]   step in [n] sectors;
  202.                 -[n]   step out [n] sectors
  203.                 #      print disk parameters for curr drive.
  204.                 =xxx   search for ASCII xxx from curr sector.
  205.                        Caution: upper/lower case matters.
  206.                        Use <xx> for hex:
  207.                        To find "IN 0" use: =<db><0>     or
  208.                        "(tab)H,0(CR)(LF)" use: =<9>H,0<D><A>
  209.                 <      save current sector into mem. buff.
  210.                 >      restore saved sector
  211.                 ?      give help
  212.                 A[ff,tt] ASCII dump
  213.  
  214.                 (Type any char. to continue)<cr>
  215.  
  216.                 C      Change:
  217.                 CHaddr,byte,byte... (hex)
  218.                 or   CAaddr,data...  (Ascii)
  219.                 <xx> Allowed for imbedded hex.
  220.                 or   CHfrom-thru,byte  e.g. ch0-7f,e5
  221.                 or   CAfrom-thru,byte
  222.                 D[ff,tt] Dump (hex+ASCII)
  223.                 Fn.t   Find file
  224.                 Gnn    CP/M Allocation Group nn
  225.                 H[ff,tt]       hex dump
  226.                 L      Log in drive
  227.                 Lx     Log in drive x
  228.                 M[nn]  Map [from group nn]
  229.  
  230.                 (Type any char. to continue)<cr>
  231.  
  232.                 N      New disk
  233.                 P      Toggle printer switch
  234.                 Q      Quiet mode (no msgs)
  235.                 R      Read current sector
  236.                 Snn    Sector nn
  237.                 Tnn    Track nn
  238.                 Unn    Set User nn for Find command (CP/M-2 only)
  239.                 V[nn]  View [nn] ASCII sectors
  240.                 W      Write current sector
  241.                 X      Exit program
  242.                 Y      Yank current sector into sequential memory
  243.                 Z[nn]  Sleep [nn tenths]
  244.                 /[nn]  Repeat [nn (decimal) times]
  245.  
  246.                 (Type any char. to continue)<cr>
  247.  
  248.                 Cancel a function with C or Ctl-C.
  249.                 Suspend output with S or Ctl-S.
  250.                 Separate commands with ";".
  251.                        Example: g0
  252.                        +;d;z#20;/
  253.                        would step in, dump, sleep 2 sec, 
  254.                        and repeat until control-c typed.
  255.                 All "nn" usage except "/", "T", and "S" are
  256.                        HEX.  Use #nn for decimal.
  257.  
  258.                 See DU.DOC for complete examples.
  259.  
  260.  
  261. Positioning:
  262.  
  263. Keeping  "track"  (literally!)  of where your are on  a  disk  is 
  264. indicated by a terse display (e.g.,  G=009C:04, T=43, S=5, PS=4).  
  265.  
  266. To  best  illustrate the display (and most importantly,  what  it 
  267. means), just enter the following command:
  268.  
  269. :+;/<cr> <-- advance to the next sector and repeat forever...
  270.  
  271. And  the  Group,  Track,  Logical  Sector,  and  Physical  sector 
  272. "assignments"  will  incrementally be displayed for  your  entire 
  273. disk  continuously  (use  ^C to quit).   The  "meaning"  (and  an 
  274. example display), is as follows:
  275.  
  276.      .-- Group Allocation Number
  277.      |  .-- Sector Block Number (always 128 bytes)     
  278.      |  |     .-- Physical Track     
  279.      |  |     |    .-- Logical Sector
  280.      |  |     |    |     .-- Physical Sector  
  281.      |  |     |    |     |
  282. G=009C:01, T=43, S=2, PS=1
  283. G=009C:02, T=43, S=3, PS=2
  284. G=009C:03, T=43, S=4, PS=3
  285. G=009C:04, T=43, S=5, PS=4
  286. G=009C:05, T=43, S=6, PS=5
  287. G=009C:06, T=43, S=7, PS=6
  288. G=009C:07, T=43, S=8, PS=7
  289. G=009C:08, T=43, S=9, PS=24
  290. G=009C:09, T=43, S=10, PS=25
  291. G=009C:0A, T=43, S=11, PS=26
  292. G=009C:0B, T=43, S=12, PS=27
  293. G=009C:0C, T=43, S=13, PS=28
  294. G=009C:0D, T=43, S=14, PS=29
  295. G=009C:0E, T=43, S=15, PS=30
  296. G=009C:0F, T=43, S=16, PS=31 <-- end of 2K Group Number 009C
  297. G=009D:00, T=43, S=17, PS=48 <-- a new Group Allocation number starts
  298. G=009D:01, T=43, S=18, PS=49     after Sector Block Number 16 (0F HEX)
  299. ~                          ~     (but may be different for YOUR DISK!)
  300. |     etc., etc., etc.,    |
  301.  
  302.  
  303. Positioning therefore,  is done by Group (Gnn),  Track (Tnn),  or 
  304. Sector (Snn) movement commands as follows:
  305.  
  306.     Gnn    By allocation group.  Example:
  307.  
  308.                 :g0<cr>
  309.                 G=0000:00, T=4, S=1, PS=0
  310.  
  311.     Tnn    By track.
  312.  
  313.     Snn    By sector.
  314.  
  315.     +nn    Move ahead nn sectors.
  316.  
  317.     -nn    Move back nn sectors.
  318.  
  319.  
  320. I/O:
  321.  
  322.     R    Reads sector.
  323.  
  324.     W    Writes sector.
  325.  
  326.     <    Puts current sector "away" into a buffer.
  327.  
  328.     >    Recalls previously saved sector.
  329.  
  330.  
  331. Displaying:
  332.  
  333.     G    Shows current group, track, sector.
  334.  
  335.     M    Maps the disk (file group allocations).
  336.            or,
  337.     Mxx    Map starting at group xx
  338.  
  339.     D    Dump the sector (Hexadecimal and ASCII display).
  340.  
  341.     A    Dump sector in ASCII.
  342.  
  343.     H    Dump sector in hexadecimal.
  344.  
  345.     Vnn    Views (like CP/M TYPE) nn sectors.
  346.  
  347.     #    Shows disk parameters, also the number of sectors
  348.         stacked and used via '<<' and '>>'. Example:
  349.  
  350.                 :#<cr>
  351.                 Disk Information:
  352.                 Tracks:         154
  353.                 Sec/trk:        64
  354.                 Grpsize:        16 (sectors per group)
  355.                 Tot grps:       599
  356.                 Dir entries:    256
  357.                 Sys tracks:     4
  358.  
  359.  
  360. Changing:
  361.  
  362.     CHnn,val Change data in hexadecimal.
  363.  
  364.     CAnn,val Change data in ASCII ( with <xx> escape to hexadecimal).
  365.  
  366.     N    Insert new disk.
  367.  
  368.     Unn    Change user directory number to nn.
  369.  
  370.  
  371. Searching:
  372.  
  373.     Fname    Find a file in the directory.
  374.  
  375.     F    Find next occurrence (extent) of same name.
  376.  
  377.     =aaaa    Scan for aaaa (in ASCII) from current sector on.
  378.  
  379.  
  380. Miscellaneous:
  381.  
  382.     Znn    Sleep (nn tenths of a second) such as to allow
  383.         viewing data before it scrolls off.
  384.  
  385.     Lx    Log in disk x.
  386.  
  387.     P    Turn on/off printer output toggle.
  388.  
  389.     Q    Before any command does it "quietly".
  390.  
  391.     X    Exit to CP/M.
  392.  
  393.     /nn    Repeat previous command nn times (indefinitely if nn omitted).
  394.  
  395. 2.2 Alphabetic Command Summary
  396.  
  397.  
  398.     #    Prints the disk parameters.
  399.  
  400.     +    Advance 1 sector (if below track 2,
  401.         this advances to next numerical, if
  402.         2 or greater, advances based on CP/M's normal
  403.         sector scrambling algorithm, i.e. so '+'
  404.         will get the next logical sector of the file).
  405.  
  406.     -    Backs up 1 logical sector.
  407.  
  408.         Note + and - may take an amount:
  409.         for example, +15 steps in 15 sectors.
  410.  
  411.     /    Repeats entire command.  Defaults to "forever".
  412.            or,
  413.     /nn    nn may be 2 to 65,535.
  414.  
  415.     <    Saves current sector in a save buffer, and
  416.         also resets buffer pointer used by '<<' and '>>'.
  417.  
  418.     <<    Saves current sector, bumps memory pointer.
  419.         Thus subsequent '<<' saves "next" buffer in
  420.         memory.  Use '<' to reset, or '>>' to
  421.         sequentially retrieve the buffers, such as to
  422.         move several sectors from one place on disk
  423.         to another, or to another disk, or just to
  424.         memory (stored at 2000H where DDT can be used 
  425.         to subsequently access them).
  426.  
  427.     =string    Ascii search, starting at current
  428.         sector. <xx> hex may be imbedded,
  429.         or used alone:  To find "IN 0FEH":
  430.         =<db><fe><cr>
  431.  
  432.         Note: ignores bit 7 unless <xx> is used.
  433.  
  434.         Since ";" is a command delimiter, you
  435.         have to use <3B> to search for a ";".
  436.         
  437.         Also, since "<" is a hex-escape character,
  438.         use << to means a single "<".
  439.  
  440.         Also note that the special symbol "@" contains
  441.         the displacement at which the match occurred.
  442.         It may thus be subsequently used in a 'C'
  443.         command, as in:
  444.  
  445.             =LIX;CA@,LXI;W<cr>
  446.  
  447.         would search for the string LIX, change
  448.         it to an LXI, and write it back.
  449.  
  450.  
  451.     >    Gets saved buffer.  '<' and '>' may be used
  452.         to move a sector to another place.
  453.  
  454.     >>    Restore "oldest" unrestored sector saved
  455.         by '<<' command.  This command may be
  456.         "buried" in the middle of an infinite
  457.         repeat '/', because it will stop operating
  458.         when there are no more sectors in the buffer.
  459.  
  460.     ?    Gives command summary.
  461.  
  462.     A    Dump sector, ASCII only.
  463.  
  464.     CHaddr,val,val,val... change hexadecimal in sector.
  465.  
  466.     CAaddr,char string... change ASCII in sector. '<xx>'
  467.                  may be hex imbedded in the ASCII: ca0,OK<d><a><1a>
  468.  
  469.         Note: use 'W' to write changes to disk. The 'C'
  470.                 "echoes" overlaid data for verification.
  471.  
  472.     CHaddr-addr,byte
  473.           or,
  474.     CAaddr-addr,byte    Repeats a change.
  475.  
  476.     D    Dump sector, hexadecimal and ASCII.
  477.  
  478.     Fname    print directory for file "name",
  479.         then positions to it's directory
  480.         sector.
  481.  
  482.     F    Find next occurrence of name in the directory.
  483.  
  484.     Gnn    Position to group nn and read.
  485.  
  486.     G    Shows current position.
  487.  
  488.     H    Dump sector, hexadecimal only.
  489.  
  490.     L    Re-logs in the current disk. You may pull
  491.         out a disk, put in a new, and "L" just
  492.         to log it in. (See "LOGGING IN DISK" in NOTES
  493.         below)
  494.  
  495.     Lx    Logs in disk 'x', such as: LB<cr>
  496.  
  497.     M    Dumps a map of the group allocations
  498.         for files.
  499.           or,
  500.     Mn    Shows which file is allocated to
  501.         group "n".
  502.  
  503.  
  504.     N    Resets CP/M via the BDOS.  This may
  505.         make it possible under some implementations
  506.         of CP/M to change the disk format (e.g., density,
  507.         sides, etc).
  508.  
  509.     P    Toggle printer switch on/off.
  510.  
  511.     Q    Quiet: Preceeding any command, suppresses console
  512.         output.
  513.  
  514.     R    Reads the sector currently positioned to
  515.         into memory.  Note: 'R' (Read) is implicit in
  516.         the 'G', '+', and '-' commands, but NOT in the
  517.         'S' and 'T' commands.
  518.  
  519.     Snn    Position to sector nn, and read.
  520.  
  521.     Tnn    Seek to track nn (no read).
  522.  
  523.     Ux    Logs user 'x' for next F command. Displays the character
  524.         '?' error if not CP/M-80 version 2.0 (or greater).
  525.  
  526.     V    Views the current sector (assumes ASCII data).
  527.  
  528.     Vnn    Views nn sectors.
  529.  
  530.     W    Write back the current sector. Note: may
  531.         not be used after an F command, as CP/M was
  532.         used to find the file in the directory.
  533.  
  534.     X    Exit back to CP/M (Must press return).
  535.  
  536.     Z    Sleep - causes the program to pause, such
  537.         as to look at a dump.  'Z' is 1 second.  Znn
  538.         is nn tenths of a second on a 2 MHz 8080 CPU.
  539.  
  540.  
  541. 3.0 Usage Notes
  542.  
  543. 3.1 Multiple Commands: May be separated by ";"
  544.  
  545. Example:  the following commands will erase the B: disk directory 
  546.           to all E5's:
  547.  
  548.     lb<cr>        "Log-in" (select) the 'B:' drive.
  549.     g0<cr>        Position to the start of the directory.
  550.     ch0-7f,e5<cr>    Fill with the value 'E5' hexadecimal.
  551.     <<cr>        Save the sector
  552.     >;w;+;/16<cr>    Restore, write, next repeat 16 times.
  553.  
  554. This could be shortened to:
  555.  
  556.     lb;g0;ch0-7f,e5;<<cr>
  557.     >;w;+;/16<cr>
  558.  
  559.  
  560. 3.2 Dump Commands - All dump commands (D, A, H) may be optionally 
  561. followed by a starting and ending address:
  562.  
  563.     D0,7F<cr>    ...is the same as just D<cr>
  564.     D3,5<cr>
  565.     A20,3F<cr>
  566.  
  567. 3.3  Logging in Disk - Some problems may arise when  "logging-in" 
  568. diskettes with "mixed-density" (i.e., Track 00 is single density, 
  569. and  the directory tracks are double density,  ala IBM System  34 
  570. type disks).   A solution is to log in a disk which is OK, and is 
  571. of  the  same  density as the disk that you want to  examine  and 
  572. alter, then put in the new disk WITHOUT logging it in.
  573.  
  574. However,  you  are now opening yourself up to  possible  problems 
  575. because  of the buffering of physical sectors in the  BIOS.   The 
  576. best  technique,  (but not guaranteed),  would be to seek to  the 
  577. unused inner tracks of the first disk,  do the read,  THEN change 
  578. disks.   That way if it writes anything, you won't have destroyed 
  579. anything...assuming  the disk is not  completely  full.   Another 
  580. technique,  assuming  the  second  disk does not contain  a  CP/M 
  581. system,  would be to seek to Track 1, then do the read there, and 
  582. then change disks to the new one.
  583.  
  584.  
  585. 3.4  Sector  Buffers  (The '<<' and '>>' commands)  - Up  to  255 
  586. sectors (only because its a 1 byte counter) may be saved by '<<'.  
  587. ANY TIME '<' is executed, the buffers are "thrown away". One '>>' 
  588. to fetch a saved buffer and make it available for writing, may be 
  589. issued for each previous '<<'.   The 'M' (directory map)  command 
  590. uses  an  area  of memory for a  buffer.   To  minimize  problems 
  591. (caveat  programmer),  the MAP buffer is placed a the END of  the 
  592. CURRENTLY HIGHEST USED '<<' buffer.  On small systems, where many 
  593. buffers  have been saved via '<<',  the 'M' command might  report 
  594. that  it ran out of memory.   Executing '<' or '>>' a  sufficient 
  595. number  of times for it to tell you there are no more sectors  in 
  596. the  buffer,  will then make room available in memory at a  lower 
  597. address.  Then 'M' may be used for "mapping" the directory.
  598.  
  599.  
  600. 4.0 Interpreting CP/M Directory Data
  601.  
  602. 4.1 Single Density
  603.  
  604. The  following  explains the format of a CP/M directory entry  as 
  605. shown by DU,  using either the 'F' (find file) command,  or  just 
  606. doing  'D' (dump) of the directory sectors,  which are located in 
  607. groups 0 and 1 on a single density disk.
  608.  
  609. Sample result of 'fSID.COM' (find 'SID.COM') command:
  610.  
  611. 40  00534944 20202020  20434F4D 0000003A  *.SID     COM...:*
  612. 50  33343536 3738393A  00000000 00000000  *3456789:........*
  613.  
  614. First line -
  615.  
  616. 40  00534944 20202020  20434F4D 0000003A  *.SID     COM...:*
  617. ||  |||                      |  ||    ||    |         |
  618. ||  ||^----HEX File Name-----^  ||    ||    ^File Name^
  619. ||  ||                          ||    ||     in ASCII
  620. ||  ||                   Extent-^^    ||
  621. ||  ||                                ||
  622. ||  ||           File Size in Sectors-^^
  623. ||  ||
  624. ||  ^^-00 = File Active (other values (e.g., 03 = User Number 3)
  625. ||     E5 = File Erased
  626. ^^-Displacement of the "line" (16 entries/line) in the directory sector
  627.  
  628. Note:  for  the  newcomer  to  "CP/M  jargon",  a  file  'extent' 
  629. (actually the extension of a file) indicates to the CP/M BDOS the 
  630. number of 16 thousand (16K) consecutive bytes contained within  a 
  631. file.   Extents are numbered from 0 to 31. One extent may contain 
  632. 1,  2,  4,  4,  8 or 16 blocks (a block,  is a basic unit of disk 
  633. space allocation,  and may be 1K,  2K,  4K, 8K or 16K consecutive 
  634. bytes).   These blocks then are assigned group numbers (a "group" 
  635. is  a  group of disk sectors),  and are allocated dynamically  to 
  636. accomodate the required disk space on a disk,  as used by a given 
  637. file  (Group  0  is ALWAYS the start  of  the  directory  group).  
  638. Therefore, a file "name" might appear in the director a number of 
  639. times  ,  depending  on  the  number of  extensions  required  to 
  640. accomodate  the  files size (refer to the sample  disk  "MAP"  in 
  641. section   2.0   Usage...the   file   PBIOS.ASM   shows   multiple 
  642. extents)...Whew! With that out of the way then, I hope this makes 
  643. sense:
  644.  
  645. Second line -
  646.  
  647. 50  33343536 3738393A  00000000 00000000  *3456789:........*
  648.     |                       |   |
  649.     |                       |   ^- The allocation groups
  650.     ^-----Allocation Group Numbers-----^      that just happened
  651.                           to be printable!
  652.  
  653. 4.2 Double Density
  654.  
  655. The following is a sample of  SID.COM running on a double density 
  656. system:
  657.  
  658. :fSID.COM<cr> <-- Find 'SID.COM' on the disk...
  659. 00  00534944 20202020  20434F4D 0000003A  *.SID     COM...:*
  660. 10  38003900 3A003B00  00000000 00000000  *8.9.:.;.........*
  661. G=0000:00, T=2, S=1, PS=0
  662.  
  663. The  primary  difference is that the groups now occupy  2  bytes, 
  664. i.e.  "38  00",  "39 00",  etc.   This follows the INTEL and CP/M 
  665. convention  of putting 16 bit values  high-byte-first.   Thus  it 
  666. means group 0038, 0039, etc.
  667.  
  668. Note that in double density,  each group stood for 2K, not 1K, so 
  669. there were half as many groups for the same file.
  670.  
  671. Be  VERY careful when patching a directory under double  density.  
  672. I once made the mistake of putting, for example:
  673.  
  674.     ch10,38,39,3a,3b...
  675.  
  676. When  I went to read this file,  it tried to access  group  3938, 
  677. with  resultant  angry exclamations from the disk stepper  as  it 
  678. attempted to go south to Peoria for the data.
  679.  
  680. 5.0 DU Usage Examples
  681.  
  682. 5.1 Erased Program Recovery
  683.  
  684. Let's  suppose that you have just put on the "final  touches"  to 
  685. your  latest'n'greates  program to market as your new "let's  get 
  686. poor  quick" scheme...you (of course) have NEVER made  a  back-up 
  687. copy  after  having  put in 10^16 (that 10 to  the  16th  power!) 
  688. weekends of time into it. So you proudly examine the directory of 
  689. your pride-and-joy:
  690.  
  691. A0>dir b:
  692.  
  693. B: BIZ-INIT BAS : BIZ-CALC BAS : BIZ-CHRT BAS : BIZ-WIZ  TXT
  694. B: BIZ-WIZ  BAS
  695.  
  696. Yep...All  there,   and...(ring,   ring...its  the  #%&"*+  phone 
  697. again!).  O.K. be back in a few minutes and get a printer listing 
  698. for posterity...(tick, tick...minutes turn to hours...):
  699.  
  700. Ah yes,  lets see where was I?  Oh yes, that guy called an wanted 
  701. to  modem over his latest version of FOOBAR...Fine,  better  make 
  702. some room on this "scratch disk" in the B: drive...so we:
  703.  
  704. A>era b:*.* <-- lets just get rid of whatever junk is there...
  705. ALL (Y/N)?y <-- sure,  if  I can't remember whats there, can't be important!
  706.  
  707. A0>dir b: <-- and just to be sure...
  708.  
  709. NO FILE <-- Yep! No files left...but...AAaarrgghh! The wrong $&+#* disk!!!
  710.  
  711.  
  712.                       What do you do,... what do you do???
  713.  
  714. Do you...D You....Dee U.....ahh Hah! DU!!! Disk Utility to the rescue!
  715.  
  716. I  just  KNEW something clever would (eventually) emerge from  my 
  717. beer-fogged brain to save my ASCII (err, ahh)...so here I go!
  718.  
  719. A0>du<cr>
  720.  
  721.  
  722. DISK UTILITY ver 7.7
  723. Universal Version
  724.  
  725. Type ? for help
  726. Type X to exit
  727.  
  728. :lb<cr> <-- "log" disk B: (forest reclamation project!)
  729.  
  730. :g0;d<cr> <-- Go to Group 0 (always the directory group) and Dump:
  731. G=00:00, T=2, S=1, PS=1
  732. 00  E542495A 2D494E49  54424153 0000001C  *eBIZ-INITBAS....*
  733. 10  02030405 00000000  00000000 00000000  *................*
  734. 20  E542495A 2D43414C  43424153 00000050  *eBIZ-CALCBAS...P*
  735. 30  06070809 0A0B0C0D  0E0F0000 00000000  *................*
  736. 40  E542495A 2D434852  54424153 00000019  *eBIZ-CHRTBAS....*
  737. 50  10111213 00000000  00000000 00000000  *................*
  738. 60  E542495A 2D57495A  20545854 00000029  *eBIZ-WIZ TXT...)*
  739. 70  14151617 18190000  00000000 00000000  *................*
  740.  
  741. Hmmm...my   files  alright  with  funny  little  "e's"  in  front 
  742. of'em...lets also look at the next directory sector:
  743.  
  744. :+;d<cr> <-- advance +1 sector and Dump it also:
  745. G=00:01, T=2, S=2, PS=7
  746. 00  E542495A 2D57495A  20424153 00000080  *eBIZ-WIZ BAS....*
  747. 10  1A1B1C1D 1E1F2021  22232425 26272829  *...... !"#$%&'()*
  748. 20  E542495A 2D57495A  20424153 0100006B  *eBIZ-WIZ BAS...k*
  749. 30  2A2B2C2D 2E2F3031  32333435 36370000  **+,-./01234567..*
  750. 40  E5E5E5E5 E5E5E5E5  E5E5E5E5 E5E5E5E5  *eeeeeeeeeeeeeeee*
  751. 50  E5E5E5E5 E5E5E5E5  E5E5E5E5 E5E5E5E5  *eeeeeeeeeeeeeeee*
  752. 60  E5E5E5E5 E5E5E5E5  E5E5E5E5 E5E5E5E5  *eeeeeeeeeeeeeeee*
  753. 70  E5E5E5E5 E5E5E5E5  E5E5E5E5 E5E5E5E5  *eeeeeeeeeeeeeeee*
  754.  
  755. Well,  its  all  sitting there (sort'a!) in the  directory...lets 
  756. backup  one sector,  and start fixing things up to recover  those 
  757. erased files:
  758.  
  759. :-<cr> <-- minus 1 sector...
  760. G=00:00, T=2, S=1, PS=1
  761.  
  762. :ch0,0;ch20,0;ch40,0;ch60,0<cr> <-- CHange all "E5's" to zeros:
  763. E5E5E5E5 <-- the "E5's" (erased file flags) evaporate before our very eyes!
  764. :d<cr> <-- Dump it just to check...
  765. 00  0042495A 2D494E49  54424153 0000001C  *.BIZ-INITBAS....*
  766. 10  02030405 00000000  00000000 00000000  *................*
  767. 20  0042495A 2D43414C  43424153 00000050  *.BIZ-CALCBAS...P*
  768. 30  06070809 0A0B0C0D  0E0F0000 00000000  *................*
  769. 40  0042495A 2D434852  54424153 00000019  *.BIZ-CHRTBAS....*
  770. 50  10111213 00000000  00000000 00000000  *................*
  771. 60  0042495A 2D57495A  20545854 00000029  *.BIZ-WIZ TXT...)*
  772. 70  14151617 18190000  00000000 00000000  *................*
  773.  
  774. :w<cr> <--Write this directory sector back to the disk:
  775.  
  776. :+<cr> <-- advance to the next directory sector:
  777. G=00:01, T=2, S=2, PS=7
  778.  
  779. :d<cr> <-- Dump it also, to be sure...
  780. 00  E542495A 2D57495A  20424153 00000080  *eBIZ-WIZ BAS....*
  781. 10  1A1B1C1D 1E1F2021  22232425 26272829  *...... !"#$%&'()*
  782. 20  E542495A 2D57495A  20424153 0100006B  *eBIZ-WIZ BAS...k*
  783. 30  2A2B2C2D 2E2F3031  32333435 36370000  **+,-./01234567..*
  784. 40  E5E5E5E5 E5E5E5E5  E5E5E5E5 E5E5E5E5  *eeeeeeeeeeeeeeee*
  785. 50  E5E5E5E5 E5E5E5E5  E5E5E5E5 E5E5E5E5  *eeeeeeeeeeeeeeee*
  786. 60  E5E5E5E5 E5E5E5E5  E5E5E5E5 E5E5E5E5  *eeeeeeeeeeeeeeee*
  787. 70  E5E5E5E5 E5E5E5E5  E5E5E5E5 E5E5E5E5  *eeeeeeeeeeeeeeee*
  788.  
  789. :ch0,0;ch20,0<cr> <-- just CHange for the two directory entries...
  790. E5E5
  791.  
  792. :d<cr> <-- why "valley girls" take 2 birth control pills (to be sure, fer'sure!)
  793. 00  0042495A 2D57495A  20424153 00000080  *.BIZ-WIZ BAS....*
  794. 10  1A1B1C1D 1E1F2021  22232425 26272829  *...... !"#$%&'()*
  795. 20  0042495A 2D57495A  20424153 0100006B  *.BIZ-WIZ BAS...k*
  796. 30  2A2B2C2D 2E2F3031  32333435 36370000  **+,-./01234567..*
  797. 40  E5E5E5E5 E5E5E5E5  E5E5E5E5 E5E5E5E5  *eeeeeeeeeeeeeeee*
  798. 50  E5E5E5E5 E5E5E5E5  E5E5E5E5 E5E5E5E5  *eeeeeeeeeeeeeeee*
  799. 60  E5E5E5E5 E5E5E5E5  E5E5E5E5 E5E5E5E5  *eeeeeeeeeeeeeeee*
  800. 70  E5E5E5E5 E5E5E5E5  E5E5E5E5 E5E5E5E5  *eeeeeeeeeeeeeeee*
  801.  
  802. :w<cr> <-- Write this directory sector as well, before we quit!
  803.  
  804. :x<cr> <-- eXit to CP/M-80...
  805.  
  806. A0>dir b:<cr> <-- and as if by magic...
  807.  
  808. B: BIZ-INIT BAS : BIZ-CALC BAS : BIZ-CHRT BAS : BIZ-WIZ  TXT
  809. B: BIZ-WIZ  BAS
  810. A0>...It's all done with mirrors!
  811.  
  812. 5.2 Modifying a disk for "Program Autoload"
  813.  
  814. By  modifying  a portion of the CP/M operating  system,  you  can 
  815. force it load automatically and execute a command file.  This can 
  816. be  particularly useful if you want to set-up some fancy  printer 
  817. initialization,  modify some serial port Baud rate or data format 
  818. parameters,  etc.  To  enter  an  "autoload" filename to  a  CP/M 
  819. diskette:
  820.  
  821. :t2;s1;d<cr> <-- position to Track 2, Sector 1, and Dump...
  822.  T=2, S=1, PS=0      (NOTE: this is representative of my disk only!)
  823.  T=2, S=1, PS=0
  824. 00  C35CDDC3 58DD7F00  20202020 20202020  *C\]CX]..        *
  825. 10  20202020 20202020  434F5059 52494748  *        COPYRIGH*
  826. 20  54202843 29203139  37392C20 44494749  *T (C) 1979, DIGI*
  827. 30  54414C20 52455345  41524348 20200000  *TAL RESEARCH  ..*
  828. 40  00000000 00000000  00000000 00000000  *................*
  829. 50  00000000 00000000  00000000 00000000  *................*
  830. 60  00000000 00000000  00000000 00000000  *................*
  831. 70  00000000 00000000  00000000 00000000  *................*
  832.           
  833. :ca8,SIGNON<0><cr> <-- Change ASCII, address 8 to 'SIGNON' and '0'.
  834.                  
  835. :ch7,6<cr> <-- Change Hex, address 7 to a value of 6 (length byte)
  836. 00            <-- what the value "was" prior to the change
  837. :d<cr>     <-- Dump the disk sector for display
  838. 00  C35CDDC3 58DD7F06  5349474E 4F4E0020  *C\]CX]..SIGNON. *
  839. 10  20202020 20202020  434F5059 52494748  *        COPYRIGH*
  840. 20  54202843 29203139  37392C20 44494749  *T (C) 1979, DIGI*
  841. 30  54414C20 52455345  41524348 20200000  *TAL RESEARCH  ..*
  842. 40  00000000 00000000  00000000 00000000  *................*
  843. 50  00000000 00000000  00000000 00000000  *................*
  844. 60  00000000 00000000  00000000 00000000  *................*
  845. 70  00000000 00000000  00000000 00000000  *................*
  846.           
  847. :w<cr> <-- Write the disk sector.
  848. :x<cr> <-- eXit to CP/M.
  849.  
  850. You  could  now  "cold  boot"  this  CP/M-80  system  disk,   and           
  851. it   would   "autoload"   by   running   the   'SIGNON'   program           
  852. (whatever that is!) prior to doing anything else.
  853.  
  854. 5.3 Finding and Modifying Program Data Quickly
  855.  
  856. This example show how to find a filename in the  directory,  then 
  857. locate  the data within the file for subsequent modification  (in 
  858. this case just to change a version number in the source code...we 
  859. could (I suppose) have used (barf...) 'ED'!):
  860.  
  861. :fSYSTOSYS.ASM<cr> <-- Find the program 'SYSTOSYS.ASM'
  862. 20  00535953 544F5359  5341534D 00000080  *.SYSTOSYSASM....*
  863. 30  0E010F01 10011401  15011601 4F015001  *............O.P.*
  864. G=0000:00, T=4, S=1, PS=0
  865.  
  866. :g10e<cr> <-- Go to Group '10E' (see it above at address 30 and 31? Also,
  867. G=010E:00, T=71, S=33, PS=32         remember to enter 2K groups "bas-akwards" 
  868.                                      from what you see. In this case NOT E01!)
  869. :d<cr> <-- Dump it...
  870. 00  3B202020 20202020  20202020 20202020  *;               *
  871. 10  436F6D70 7570726F  20382F31 3620436F  *Compupro 8/16 Co*
  872. 20  6D706174 69626C65  20535953 544F5359  *mpatible SYSTOSY*
  873. 30  53205665 7273696F  6E20312E 340D0A3B  *S Version 1.4..;*
  874. 40  20202020 20202020  20202020 20202043  *               C*
  875. 50  6F707972 69676874  20284329 20313938  *opyright (C) 198*
  876. 60  312C2031 3938322C  20313938 33206279  *1, 1982, 1983 by*
  877. 70  204B656C 6C792053  6D697468 0D0A3B0D  * Kelly Smith..;.*
  878.  
  879. :ca3c,5<cr> <-- I want to change from version 1.4 to 1.5:
  880. 4
  881. :d<cr> <-- what sound does the Lone Rangers horse make? (Dump'ta'da'Dump'ta'da...)
  882. 00  3B202020 20202020  20202020 20202020  *;               *
  883. 10  436F6D70 7570726F  20382F31 3620436F  *Compupro 8/16 Co*
  884. 20  6D706174 69626C65  20535953 544F5359  *mpatible SYSTOSY*
  885. 30  53205665 7273696F  6E20312E 350D0A3B  *S Version 1.5..;*
  886. 40  20202020 20202020  20202020 20202043  *               C*
  887. 50  6F707972 69676874  20284329 20313938  *opyright (C) 198*
  888. 60  312C2031 3938322C  20313938 33206279  *1, 1982, 1983 by*
  889. 70  204B656C 6C792053  6D697468 0D0A3B0D  * Kelly Smith..;.*
  890.  
  891. :w<cr> <-- Write it...
  892.  
  893. :x<cr> <-- Do with me what you will (just don't leave me unsatisfied!)
  894.  
  895. A>Ahhhhh...thats better!
  896.  
  897. 5.4 A "Poor Man's" Disk Test
  898.  
  899. DU  can also function in the capacity of a "Poor Man's" disk test 
  900. by  performing simple sequential write/read/seek  functions  with 
  901. user specified data patterns.   Here in very simple form,  is a 4 
  902. sector  non-destructive  read-only/seek  test.  Any   susbsequent 
  903. errors would be trapped by the CP/M BDOS and stop the "test" with 
  904. whatever error message was appropriate (e.g.,  BDOS Err on B: BAD 
  905. SECTOR):
  906.  
  907. :t20;s1<cr>
  908. G=0040:00, T=20, S=1, PS=0
  909.  
  910. :+;+;+;+;-;-;-;-;/<cr> <-- read forward 4 sector,
  911. G=0040:01, T=20, S=2, PS=1     read backward 4 sectors,
  912. G=0040:02, T=20, S=3, PS=2     repeat 'ad nauseum' (actually until ^C)
  913. G=0040:03, T=20, S=4, PS=3
  914. G=0040:04, T=20, S=5, PS=4
  915. G=0040:03, T=20, S=4, PS=3
  916. G=0040:02, T=20, S=3, PS=2
  917. G=0040:01, T=20, S=2, PS=1
  918. G=0040:00, T=20, S=1, PS=0
  919. G=0040:01, T=20, S=2, PS=1
  920. G=0040:02, T=20, S=3, PS=2
  921. G=0040:03, T=20, S=4, PS=3
  922. G=0040:04, T=20, S=5, PS=4
  923. G=0040:03, T=20, S=4, PS=3
  924. ~                        ~
  925. | days or weeks later... |
  926. ~                        ~
  927. G=0040:03, T=20, S=4, PS=3
  928. G=0040:02, T=20, S=3, PS=2
  929. G=0040:01, T=20, S=2, PS=1
  930. G=0040:00, T=20, S=1, PS=0
  931. G=0040:01, <-- interrupted with ^C from the keyboard.
  932. :
  933.  
  934. By  using  your imagination,  you can come-up with a  variety  of 
  935. usefull applications for DU...Have fun!
  936. 
  937. G=0040:02, T=20