home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / cpm / dskutl / diskbug.dqc / DISKBUG.DOC
Encoding:
Text File  |  1985-02-10  |  15.0 KB  |  463 lines

  1.         -DISKBUG- Diskette Debugger for CP/M 8" Single Density Disks Page 1
  2.  
  3.  
  4.  
  5.                   Note  that  you  may do anything  you  want  with  this 
  6.              program except sell it. Give it away to anyone who wants it, 
  7.              and drop me a message with any bugs, suggestions etc. at the 
  8.              NECS CBBS or thereabouts.
  9.  
  10.                   By   Tom Jennings
  11.                        221 W. Springfield St.
  12.                        Boston MA 02118
  13.  
  14.                   DISKBUG is a CP/M 1.4, 2.0, 2.2 or PDOS 1.17-up utility 
  15.              that  provides read/write access to any sector or sectors of 
  16.              an  IBM 3741 format diskette.  See a later section  for  use 
  17.              with  other  formats.  DISKBUG  was originally  a  hack  for 
  18.              installing  a  bootable CP/M system to a diskette,  but  has 
  19.              grown  somewhat,  so  have patience with  the  poor  command 
  20.              structure.
  21.  
  22.                   There are three logical entities in DISKBUG: the sector 
  23.              oriented  commands,  the  file oriented  commands,  and  the 
  24.              buffer.  
  25.  
  26.              BUFFER:
  27.                   All  data is transferred through  the  buffer,  whether 
  28.              to/from sectors or files. Data can be moved from one or more 
  29.              sectors to a normal CP/M disk file,  or vice versa.  Data in 
  30.              the buffer can be displayed or modified manually, similar to 
  31.              DDT.
  32.  
  33.              SECTOR COMMANDS:
  34.                   The  sector  oriented commands are all done via  direct 
  35.              BIOS calls in CP/M,  or by system calls under PDOS.  One  or 
  36.              more  sectors can be read at a time,  and multiple reads  or 
  37.              writes  can extend over a track boundary;  for example,  you 
  38.              can read two sequential sectors, starting at the last sector 
  39.              in a track.
  40.  
  41.                   See the end of this manual for tips on using DISKBUG on 
  42.              other diskette formats.
  43.  
  44.              FILE COMMANDS:
  45.                   DISKBUG has a two file oriented commands.  These read a 
  46.              disk  file into the buffer,  or write the buffer to  a  CP/M 
  47.              disk  file.  Under PDOS,  the full filename spec can be used 
  48.              (i.e.  FILE.NAME[99]  )  Character case conversion  is  done 
  49.              automatically.
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.                                         1
  62.  
  63.  
  64.  
  65.  
  66.  
  67.         -DISKBUG- Diskette Debugger for CP/M 8" Single Density Disks Page 2
  68.  
  69.  
  70.  
  71.                                   DISKBUG OPERATION
  72.  
  73.                   DISKBUG  is  just a CP/M utility,  run  in  the  normal 
  74.              manner.  It uses only 8080 opcodes, so will run on anything. 
  75.              (Well,  anything we care about. Shows my narrow CPM-8080-Z80 
  76.              point  of view) It is not particularly fast,  but who  cares 
  77.              anyways. It does not use any command line arguments.
  78.  
  79.                   All  commands  are  quit  low  level,   which  I  found 
  80.              appropriate for my uses,  such as system  installation,  un-
  81.              erasing  files,  copying  files from Intel ISIS  and  PDP-11 
  82.              diskettes.
  83.  
  84.                   One note on the buffer. It is assumed you have a fairly 
  85.              large memory,  like 48K or so. The buffer is fixed at 32K in 
  86.              length,  and almost no commands do any checking on  reaching 
  87.              the  end  of it,  so it is possible to destroy  your  system 
  88.              memory if you try. In practice, I have had no problems.
  89.  
  90.                   Buffer  management  is minimal.  All  commands  (except 
  91.              display buffer and change buffer) operate from the bottom of 
  92.              the buffer up.
  93.  
  94.                   The  command  prompt  always  displays  the  number  of 
  95.              (decimal) bytes in the buffer.  All number typed to  DISKBUG 
  96.              are in hex.
  97.  
  98.                   See the end of the manual for some examples.
  99.  
  100.                   A  hopefully  complete description of the  command  set 
  101.              follows, with a list of features, bugs and side effects.
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.                                         2
  128.  
  129.  
  130.  
  131.  
  132.  
  133.         -DISKBUG- Diskette Debugger for CP/M 8" Single Density Disks Page 3
  134.  
  135.  
  136.  
  137.                                  DISKBUG COMMAND SET
  138.  
  139.              X         Select the disk to use,
  140.              R         Read sectors into the buffer,
  141.              W         Write the buffer to sectors,
  142.              G         Get a CP/M disk file,
  143.              P         Put the buffer to a CP/M disk file,
  144.              D         Display buffer contents,
  145.              C         Change buffer contents,
  146.              Q         Quit back to CP/M.
  147.  
  148.  
  149.              X    -Select a disk drive.
  150.  
  151.                   This  command  must  be  performed  before  any  sector 
  152.              command will operate. The disk selected will be used for all 
  153.              upcoming  R or W commands.  Note that this is independent of 
  154.              the  disk  used  by  the  G  and  P  commands;   see   those 
  155.              descriptions for details.
  156.  
  157.              R    -Read one or more sectors to the buffer.
  158.  
  159.                   You are prompted for the starting track and sector, and 
  160.              number of sectors.  All values are in hex.  Sectors are read 
  161.              sequentially (assuming a standard diskette) into the buffer, 
  162.              starting  at the bottom of the buffer.  Note that you cannot 
  163.              append to data already in the buffer;  it gets  overwritten. 
  164.              (If you need to,  you'll have to P it out to a diskfile, and 
  165.              append it later manually.)
  166.  
  167.                   Note  that  no checking is done on the amount  of  data 
  168.              read;  if  you  specify  more than  128  sectors,  you  will 
  169.              probably bash something.
  170.  
  171.              W    -Write buffer data out to one or more sectors.
  172.  
  173.                   As in the R command,  you are prompted for the starting 
  174.              track and sector, and number of sectors. To be safe, it asks 
  175.              "Write  to  disk <x>:?" before actually  writing,  therefore 
  176.              allowing you to abort.
  177.  
  178.                   Only  the  specified  number  of  sectors  is  written, 
  179.              regardless of how much data is in the buffer. (even none!) 
  180.  
  181.              G    -Get a diskfile, put it in the buffer.
  182.  
  183.                   This reads the specified disk file and puts it into the 
  184.              buffer,  starting  at the bottom of the buffer.  The  entire 
  185.              file  is  read  until end of file.  Note that you  can  (and 
  186.              probably should!) specify a disk other than the one selected 
  187.              by  the X command.  File names are specified as  per  normal 
  188.              operating system specs:  X:FILE.NAM, or with the user number 
  189.              if PDOS. All characters are converted to upper case.
  190.  
  191.  
  192.  
  193.                                         3
  194.  
  195.  
  196.  
  197.  
  198.  
  199.         -DISKBUG- Diskette Debugger for CP/M 8" Single Density Disks Page 4
  200.  
  201.  
  202.              P    -Put the buffer contents to a diskfile.
  203.  
  204.                   All  data  within  the buffer is written to  the  disk. 
  205.              NEVER  'P'  to the same disk as selected by the  X  command, 
  206.              unless you were merely reading from it.  Filenames are  full 
  207.              legal names, as described above. The number of bytes written 
  208.              out is the same as listed at the prompt.
  209.  
  210.              D    -Display buffer contents.
  211.  
  212.                   D  prompts  you  for a  buffer  starting  address,  and 
  213.              displays  256  bytes in hex and ASCII.  This address is  the 
  214.              offset  from  the start of the buffer,  and runs from  0  to 
  215.              7f00.   Unfortunately,  you  have  to  maintain  the  buffer 
  216.              address/sector numbers yourself.  For example,  if you  have 
  217.              read  4 sectors from track 0 sector 10,  sector 10 is in the 
  218.              buffer at 0 to 7f, sector 11 at 80 to ff, etc.
  219.  
  220.                   You  may type CR only at the address prompt to  display 
  221.              the next sequential 256 bytes instead of the next address.
  222.  
  223.              C    -Change buffer contents.
  224.  
  225.                   This command is patterned after Digital Research's  DDT 
  226.              'S'  command.   After  entering  the  address,  the  current 
  227.              contents are displayed,  and you can enter new ones. Type an 
  228.              illegal  hex  number to quit.  CAUTION:  Unlike  DDT's  'S', 
  229.              typing  CR  only  as  new contents will  wreck  the  current 
  230.              contents,  not leave it.  You MUST retype the same value  if 
  231.              you want to leave it alone.
  232.  
  233.              Q    -Quit back to the operating system.
  234.  
  235.                   Pretty  much self explanatory.  Does absolutely nothing 
  236.              to the X'd disk, the buffer, or any diskfiles.
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.                                         4
  260.  
  261.  
  262.  
  263.  
  264.  
  265.         -DISKBUG- Diskette Debugger for CP/M 8" Single Density Disks Page 5
  266.  
  267.  
  268.  
  269.                    NOTE ON OPERATING ON OTHER TYPE DISKETTE FORMATS
  270.  
  271.                   Although  DISKBUG  is meant for use  only  on  standard 
  272.              eight inch single density disks,  you can use it on any type 
  273.              diskette  if  you DO NOT attempt to perform multiple  sector 
  274.              I/O  the would make DISKBUG think it should  change  tracks, 
  275.              and  make certain concessions.  Track size is currently hard 
  276.              coded to 26 sectors per track.  (Someday I'll finish DISKBUG 
  277.              so it reads the CP/M disk descriptor block...)
  278.  
  279.                   When a sector write is done,  a "write allocated"  type 
  280.              write is done.  If you write to a diskette that has physical 
  281.              sectors  larger  than  128  bytes,  before  you  remove  the 
  282.              diskette  make  sure  you perform some operation  that  will 
  283.              ensure  the sector actually gets written;  reading a  sector 
  284.              will do.
  285.  
  286.                                        EXAMPLES
  287.  
  288.                   Here are some simple examples to show various things.
  289.  
  290.                    READ THE CP/M SYSTEM TRACKS, DUMP TO A DISK FILE
  291.  
  292.                   This  is one of the simplest things to do.  Select  the 
  293.              disk  to  read,  say A:,  using the X  command.  Do  an  'R' 
  294.              command,  and  read the first two tracks to the  buffer.  At 
  295.              this  point,  you might poke around with the 'D' command  to 
  296.              see  what's  there.   To  write  it  to  a  diskfile,   say, 
  297.              TRACK2.BIN, so you can look at it with DDT or something, use 
  298.              the 'P' command.  In this case,  you can 'P' it to disk  A:, 
  299.              since you only read it.
  300.  
  301.              (0 bytes in buffer) pick one: X
  302.              Disk: A
  303.  
  304.              (0 bytes in buffer) pick one: R
  305.              Track: 2
  306.              Sector: 1
  307.              # sectors: 1A
  308.              Disk IO complete
  309.  
  310.              (3322 bytes in buffer) pick one: D
  311.              Starting address: 0
  312.  
  313.              0000: 31 80 00 44 1a 7c 55 66 77 88 aa 55 4f 3e 1a 3c 1__D_|Ufw__UO>_<
  314.              0010: 41 42 43 44 45 31 32 33 34 35 61 62 63 64 65 66 ABCDE12345abcdef
  315.              .... etc
  316.  
  317.              (3322 bytes in buffer) pick one: P
  318.              File to write to: A:TRACK2.BIN
  319.  
  320.              (3322 bytes in buffer) pick one: Q
  321.              A>
  322.  
  323.  
  324.  
  325.                                         5
  326.  
  327.  
  328.  
  329.  
  330.  
  331.         -DISKBUG- Diskette Debugger for CP/M 8" Single Density Disks Page 6
  332.  
  333.  
  334.  
  335.  
  336.                      WRITING A DISKFILE OUT TO THE SYSTEM TRACKS
  337.  
  338.                   This  was  the  original  use  of  DISKBUG.   Read  the 
  339.              diskfile,  say SYSTEM.COM,  to tracks 0 and 1.  Note that in 
  340.              this  example  the disk file is larger than the size of  the 
  341.              two tracks,  like you SAVEd too many blocks.  However,  only 
  342.              the desired 6144 bytes will be written out.
  343.  
  344.              (0 bytes in buffer) pick one: G
  345.              File to read: A:SYSTEM.COM
  346.              Buffer contains 8192 bytes         (I should delete this msg...)
  347.  
  348.              (8192 bytes in buffer) pick one: X
  349.              Disk: B
  350.  
  351.              (8192 bytes in buffer) pick one: W
  352.              Track: 0
  353.              Sector: 1
  354.              # sectors 33                       (did I add right?)
  355.              Write to disk A:? Y
  356.              Disk IO complete
  357.  
  358.              (8192 bytes in buffer) pick one:
  359.  
  360.                                UNDELETE A CP/M DISKFILE
  361.  
  362.                   First,  read track 2 into the buffer (r,2,1,1a) Use the 
  363.              'D'  command to look for the directory entry  (below).  Once 
  364.              found,  use the 'C' command to change the ET byte from E5 to 
  365.              the desired user number (0 will do) If the file was over 16K 
  366.              bytes,  don't  forget the other extents (same  filename,  EX 
  367.              byte  1,2,3...  for each extent) In order to update the disk 
  368.              directory, write the entire track back (w,2,1,1a) 
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.                                         6
  392.  
  393.  
  394.  
  395.  
  396.  
  397.         -DISKBUG- Diskette Debugger for CP/M 8" Single Density Disks Page 7
  398.  
  399.  
  400.                                  BUGS AND "FEATURES"
  401.  
  402.                   This  first  one is not a bug,  but an  undesired  side 
  403.              effect  of fiddling with the BIOS without the  BDOS  knowing 
  404.              it.  Bad  things  can  happen when you  change  the  default 
  405.              disk,  and you aren't careful to specify the disk when using 
  406.              the 'P' or 'G' commands. 
  407.  
  408.                   There  is  possibly  a bug in the  disk  select  stuff, 
  409.              however. I couldn't get it to repeat, but I thought I should 
  410.              mention it anyways.  After performing sector reads or writes 
  411.              to a disk, a file access, such as 'G' or 'P' may look on the 
  412.              wrong  disk.  Fortunately,  this happened only with the  'G' 
  413.              command  ("Can't find FILE.NAM") and was not destructive.  I 
  414.              really should add a DISK SELECT command via a BDOS call.
  415.  
  416.                   The number and filename parsers aren't too smart.  They 
  417.              will not report errors such as illegal hex numbers, or blank 
  418.              filenames. Be careful here.
  419.  
  420.                   If  you read a file greater than 32K  bytes,  you  will 
  421.              probably munch something.
  422.  
  423.                   In the 'C' command, typing CR in response to the prompt 
  424.              for a new value will not leave that location alone, but will 
  425.              change it to some random value.
  426.  
  427.                   If  you  write an empty buffer to a diskfile,  it  will 
  428.              create a file with one (garbage) byte in it.
  429.  
  430.                                ---- End of Manual ----
  431.  
  432.  
  433.  
  434.  
  435.  
  436.  
  437.  
  438.  
  439.  
  440.  
  441.  
  442.  
  443.  
  444.  
  445.  
  446.  
  447.  
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.                                         7
  458.  
  459.  
  460.  
  461.  
  462.  
  463.