Search RAM for a Value in DOS DEBUG

Materials:
Working complete PC
Blank Diskette
Student Diskette, "New Boot A Ver 2.0+"
Student CD-ROM, "Room 6359"
Objectives:
The student will become familiar with how to use DOS DEBUG to:
load multiple sectors into RAM,
search RAM contents for a value,
calculate which loaded sector holds the value.
Competency:
The student will how to use DEBUG's basic commands for the purposes of data recovery including how to load multiple sectors into RAM, display sector contents on screen, how to search the sectors for a specific expected value and how to calculate which physical sector holds value once found.

    Preparation

  1. In the first exercise, Basic DEBUG commands, the student learned how to clear the DEBUG RAM workspace by filling it with zeros, how to load a physical sector, specifically the floppy diskette's boot sector, into that RAM workspace, and how to display it on screen. Perform these operations first so that the workspace is cleared, the sector has been loaded into it and displayed on screen, then proceed with the following procedures.

  2. Procedures

  3. Load the eight logical sectors starting with logical sector number 16 into RAM. Remember that DEBUG uses ONLY the hexadecimal number system and 16 is 10h:

    -L 100 1 10 8
    -_
    
    
  4. Within this range of sectors it is hoped that the starting sector of the root directory will be found. Since the diskette is bootable, the entry for IO.SYS is located within the root directory and if not the first it should be near to the beginning of the root. The entry will start with the file name IO followed by six padding spaces followed by the second field holding the file extension of SYS. Use the SEARCH command of DEBUG whose syntax is "S startoffset endoffset value" to search the RAM workspace starting at offset 100 but how far into the RAM workspace do the eight sectors reach? 8 X 200h = 1000h + 100h (the starting offset) = 1100h and search this area for "IO      SYS" (that is six spaces):

    -s 100 1100 "IO      SYS"
    242C:0700
    -_
    
    
  5. Since sector 16 starts at 100, then sector 17 starts at 300 and so on. The formula is:

         ((FA - 100h) / 200h) + FS = AS
    where
    FA = Found Address, in this case 0700
    FS = First Sector, in this case sector 16
    AS = Actual Sector, what is sought by the formula
    

  6. Substituting the values into the formula and remember that the operation of "/ 200h" means ignore the decimal fraction, so 0700h - 100h = 600h. Then 600h / 200h = 3h. Add the first sector's logical address to this: 3h + 10h = 13h. This is the logcial sector of the floppy that holds the root directory entry for IO.SYS and is most likely the first sector of the root directory as well. Since a 1.44MB 3 1/2" floppy diskette has a root that can hold a maximum of 224 entries and each entry is 32 bytes in size, then 224 x 32 = 7168 / 512 = 14 =h=> Eh. Now the entire root directory of the floppy can be loaded into RAM:

    -L 100 1 13 E
    -_
          
    
  7. Display the top half of the first sector of the root directory on screen:

    -d 100 1ff
    242C:0100  49 4F 20 20 20 20 20 20-53 59 53 27 00 00 00 00   IO      SYS'....
    242C:0110  00 00 00 00 00 00 C0 B2-97 26 02 00 B6 64 03 00   .........&...d..
    242C:0120  4D 53 44 4F 53 20 20 20-53 59 53 27 00 00 00 00   MSDOS   SYS'....
    242C:0130  00 00 00 00 00 00 C0 B2-97 26 B5 01 09 00 00 00   .........&......
    242C:0140  43 4F 4D 4D 41 4E 44 20-43 4F 4D 20 00 00 00 00   COMMAND COM ....
    242C:0150  00 00 00 00 00 00 C0 B2-97 26 B6 01 C2 6E 01 00   .........&...n..
    242C:0160  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................
    242C:0170  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................
    242C:0180  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................
    242C:0190  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................
    242C:01A0  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................
    242C:01B0  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................
    242C:01C0  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................
    242C:01D0  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................
    242C:01E0  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................
    242C:01F0  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................
    -_
    
    
  8. This concludes the basic exercises with the floppy.

Back to Page Top

Copyright©2000-2006 Brian Robinson ALL RIGHTS RESERVED