======================= DOS Directory Structure ======================= idallen@ncf.ca ------------------------------ Output of the DOS DIR command: ------------------------------ Volume in drive A is IAN ALLEN Volume Serial Number is 0FF0-4249 Directory for A:/ T1-20330 WPD 37976 04-05-2000 8:19 t1-20330.wpd DIRECT~1 04-13-2000 10:31 directory PROJECT3 TXT 1569 04-03-2000 6:46 project3.txt TOTAL ASM 4908 04-03-2000 7:16 total.asm GETSHOW ASM 5493 04-03-2000 10:15 getshow.asm MERCURY TXT 0 04-13-2000 10:37 mercury.txt EARTH TXT 0 04-13-2000 10:37 earth.txt 8 files 53 291 bytes 1 401 856 bytes free ------------------------------------------------------- DEBUG output for the same (root) directory on the disk: ------------------------------------------------------- Note the Volume Label and deleted files: 1585:2600 49 41 4E 20 41 4C 4C 45-4E 20 20 28 00 00 00 00 IAN ALLEN (.... 1585:2610 00 00 00 00 00 00 83 44-EA 22 00 00 00 00 00 00 .......D."...... 1585:2620 41 74 00 31 00 2D 00 32-00 30 00 0F 00 0C 33 00 At.1.-.2.0....3. 1585:2630 33 00 30 00 2E 00 77 00-70 00 00 00 64 00 00 00 3.0...w.p...d... 1585:2640 54 31 2D 32 30 33 33 30-57 50 44 20 00 6A F3 42 T1-20330WPD .j.B 1585:2650 85 28 85 28 00 00 77 42-85 28 B1 00 58 94 00 00 .(.(..wB.(..X... 1585:2660 41 64 00 69 00 72 00 65-00 63 00 0F 00 6F 74 00 Ad.i.r.e.c...ot. 1585:2670 6F 00 72 00 79 00 00 00-FF FF 00 00 FF FF FF FF o.r.y........... 1585:2680 44 49 52 45 43 54 7E 31-20 20 20 10 00 47 FC 53 DIRECT~1 ..G.S 1585:2690 8D 28 8D 28 00 00 FD 53-8D 28 4D 00 00 00 00 00 .(.(...S.(M..... 1585:26A0 41 70 00 72 00 6F 00 6A-00 65 00 0F 00 48 63 00 Ap.r.o.j.e...Hc. 1585:26B0 74 00 33 00 2E 00 74 00-78 00 00 00 74 00 00 00 t.3...t.x...t... 1585:26C0 50 52 4F 4A 45 43 54 33-54 58 54 20 00 8A D7 42 PROJECT3TXT ...B 1585:26D0 85 28 85 28 00 00 D9 35-83 28 98 00 21 06 00 00 .(.(...5.(..!... 1585:26E0 41 74 00 6F 00 74 00 61-00 6C 00 0F 00 11 2E 00 At.o.t.a.l...... 1585:26F0 61 00 73 00 6D 00 00 00-FF FF 00 00 FF FF FF FF a.s.m........... 1585:2700 54 4F 54 41 4C 20 20 20-41 53 4D 20 00 A7 D8 42 TOTAL ASM ...B 1585:2710 85 28 85 28 00 00 17 3A-83 28 9C 00 2C 13 00 00 .(.(...:.(..,... 1585:2720 41 67 00 65 00 74 00 73-00 68 00 0F 00 A7 6F 00 Ag.e.t.s.h....o. 1585:2730 77 00 2E 00 61 00 73 00-6D 00 00 00 00 00 FF FF w...a.s.m....... 1585:2740 47 45 54 53 48 4F 57 20-41 53 4D 20 00 49 D9 42 GETSHOW ASM .I.B 1585:2750 85 28 85 28 00 00 E3 51-83 28 A6 00 75 15 00 00 .(.(...Q.(..u... 1585:2760 41 6D 00 65 00 72 00 63-00 75 00 0F 00 64 72 00 Am.e.r.c.u...dr. 1585:2770 79 00 2E 00 74 00 78 00-74 00 00 00 00 00 FF FF y...t.x.t....... 1585:2780 4D 45 52 43 55 52 59 20-54 58 54 20 00 55 B4 54 MERCURY TXT .U.T 1585:2790 8D 28 8D 28 00 00 B5 54-8D 28 00 00 00 00 00 00 .(.(...T.(...... 1585:27A0 E5 76 00 65 00 6E 00 75-00 73 00 0F 00 CA 2E 00 .v.e.n.u.s...... 1585:27B0 74 00 78 00 74 00 00 00-FF FF 00 00 FF FF FF FF t.x.t........... 1585:27C0 E5 45 4E 55 53 20 20 20-54 58 54 20 00 A5 B4 54 .ENUS TXT ...T 1585:27D0 8D 28 8D 28 00 00 B5 54-8D 28 AB 00 78 56 00 00 .(.(...T.(...... 1585:27E0 41 65 00 61 00 72 00 74-00 68 00 0F 00 A5 2E 00 Ae.a.r.t.h...... 1585:27F0 74 00 78 00 74 00 00 00-FF FF 00 00 FF FF FF FF t.x.t........... 1585:2800 45 41 52 54 48 20 20 20-54 58 54 20 00 B9 B4 54 EARTH TXT ...T 1585:2810 8D 28 8D 28 00 00 B5 54-8D 28 00 00 00 00 00 00 .(.(...T.(...... 1585:2820 E5 6D 00 61 00 72 00 73-00 2E 00 0F 00 C4 74 00 .m.a.r.s......t. 1585:2830 78 00 74 00 00 00 FF FF-FF FF 00 00 FF FF FF FF x.t............. 1585:2840 E5 41 52 53 20 20 20 20-54 58 54 20 00 1A B5 54 .ARS TXT ...T 1585:2850 8D 28 8D 28 00 00 B6 54-8D 28 F0 01 34 12 00 00 .(.(...T.(...... 1585:2860 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ 1588:2870 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ 1585:2880 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ 1585:2890 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ ========== Exercises: ========== 1) List the attributes of all entries that are not ordinary files. 2) Find the DOS names of all deleted entries in this directory. 3) List the sizes and starting clusters of all the ordinary files. 4) Using information about the disk geometry from the following BOOT block DEBUG dump, give the absolute sector of the first sector of every non-empty file: C:\>DEBUG -L 0 0 0 1 -D 0 1585:0000 EB 45 90 2B 4A 59 73 35-49 48 43 00 02 01 01 00 1585:0010 02 E0 00 40 0B F0 09 00-12 00 02 00 00 00 00 00 ... ======== Answers: ======== 1) IAN ALLEN Volume Label, Archive Needed DIRECT~1 SubDirectory 2) VENUS.TXT MARS.TXT 3) T1-20330WPD 00009458h 00B1h PROJECT3TXT 00000621h 0098h TOTAL ASM 0000132Ch 009Ch GETSHOW ASM 00001575h 00A6h MERCURY TXT 00000000h 0000h (empty file) .ENUS TXT 00005678h 00ABh EARTH TXT 00000000h 0000h (empty file) .ARS TXT 00001234h 01F0h 4) Formula to calculate an Absolute Sector number: = start of data clusters + (C# - 2) * cluster size Start of data clusters (start of Cluster #2): = sectors in Cluster #0 + sectors in Cluster #1 Size of Cluster #0 = 1 sector (boot block) Size of Cluster #1 = N copies of FAT plus ROOT directory Sectors used for copies of FAT: Copies of FAT = 2h Sectors in each FAT = 9h PRODUCT = 12h (18 decimal) sectors Sectors used for ROOT directory: = (number of entries * size of each entry) / bytes per sector Entries in ROOT directory = E0h (224 decimal) Size (in bytes) of each entry = 20h (32 decimal) Bytes per sector = 200h (512 decimal) Sectors in ROOT directory = (number of entries * size of each entry) / bytes per sector = (E0h * 20h) / 200h = Eh (14 decimal) Size of Cluster #1 = N copies of FAT plus ROOT directory = 2h * 9h + Eh = 20h (32 decimal) Start of data clusters (start of Cluster #2) = sectors in Cluster #0 + sectors in Cluster #1 = 1h + 20h = 21h Formula to calculate any Absolute Sector number for this disk = start of data clusters + (C# - 2) * cluster size = 21h + (C# - 2) * 1h Using the formula: T1-20330WPD 00B1h -> 21 + ( B1 - 2) * 1 = D0h PROJECT3TXT 0098h -> 21 + ( 98 - 2) * 1 = B7h TOTAL ASM 009Ch -> 21 + ( 9C - 2) * 1 = BBh GETSHOW ASM 00A6h -> 21 + ( A6 - 2) * 1 = C5h .ENUS TXT 00ABh -> 21 + ( AB - 2) * 1 = CAh .ARS TXT 01F0h -> 21 + (1F0 - 2) * 1 = 20Fh