[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: DSK format specification



Paul Schlyter <pausch@saaf.se> wrote:
> OK -- a directory entry has the following structure:
>  
>  1 byte     User number, or E5h if it's a free entry
> 11 bytes    Filename + extension: 8+3 characters
>  2 bytes    Extent number of this entry
>  2 bytes    Number of 128-byte records used in last alloc. block
> 16 bytes    Allocation map for this directory entry
[...]
> Number of 128-byte records used in last allocation blocks: the
> CP/M file system defines the file length only in units of
> 128-byte "records" or "logical sectors".  Since an allocation
> block usually contains several 128-byte records, this field
> defines how many records are in use in the last block allocated
> to that file.

The part I couldn't figure out is the part you labeled "number of
128-byte records used".  The values I'm finding don't quite match up
with what you show.

Here's a dump of the first 512 bytes of a typical directory:

000: 00 46 4f 52 4d 41 54 20 20 c3 4f 4d 00 00 00 12  .FORMAT  COM....
010: 02 03 04 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
020: 00 43 4f 50 59 20 20 20 20 c3 4f 4d 00 00 00 08  .COPY    COM....
030: 05 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
040: 00 4d 42 41 53 49 43 20 20 c3 4f 4d 00 00 00 80  .MBASIC  COM....
050: 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15  ................
060: 00 4d 42 41 53 49 43 20 20 c3 4f 4d 01 00 00 40  .MBASIC  COM...@
070: 16 17 18 19 1a 1b 1c 1d 00 00 00 00 00 00 00 00  ................
080: 00 47 42 41 53 49 43 20 20 c3 4f 4d 00 00 00 80  .GBASIC  COM....
090: 1f 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e  . !"#$%&'()*+,-.
0a0: 00 47 42 41 53 49 43 20 20 c3 4f 4d 01 00 00 48  .GBASIC  COM...H
0b0: 2f 30 31 32 33 34 35 36 37 00 00 00 00 00 00 00  /01234567.......
0c0: 00 43 4f 4e 46 49 47 49 4f 42 41 53 00 00 00 3a  .CONFIGIOBAS...:
0d0: 1e 38 39 3a 3b 3c 3d 3e 00 00 00 00 00 00 00 00  .89:;<=>........
0e0: 00 50 49 50 20 20 20 20 20 c3 4f 4d 00 00 00 3a  .PIP     COM...:
0f0: 40 41 42 43 44 45 46 47 00 00 00 00 00 00 00 00  @ABCDEFG........
100: 00 53 54 41 54 20 20 20 20 c3 4f 4d 00 00 00 30  .STAT    COM...0
110: 48 49 4a 4b 4c 4d 00 00 00 00 00 00 00 00 00 00  HIJKLM..........
120: 00 45 44 20 20 20 20 20 20 c3 4f 4d 00 00 00 34  .ED      COM...4
130: 4e 4f 50 51 52 53 54 00 00 00 00 00 00 00 00 00  NOPQRST.........
140: 00 41 53 4d 20 20 20 20 20 c3 4f 4d 00 00 00 40  .ASM     COM...@
150: 55 56 57 58 59 5a 5b 5c 00 00 00 00 00 00 00 00  UVWXYZ[\........
160: 00 44 44 54 20 20 20 20 20 c3 4f 4d 00 00 00 28  .DDT     COM...(
170: 5d 5e 5f 60 61 00 00 00 00 00 00 00 00 00 00 00  ]^_`a...........
180: 00 4c 4f 41 44 20 20 20 20 c3 4f 4d 00 00 00 0e  .LOAD    COM....
190: 62 63 00 00 00 00 00 00 00 00 00 00 00 00 00 00  bc..............
1a0: 00 52 57 31 33 20 20 20 20 c3 4f 4d 00 00 00 12  .RW13    COM....
1b0: 64 65 66 00 00 00 00 00 00 00 00 00 00 00 00 00  def.............
1c0: 00 41 50 44 4f 53 20 20 20 c3 4f 4d 00 00 00 0d  .APDOS   COM....
1d0: 67 68 00 00 00 00 00 00 00 00 00 00 00 00 00 00  gh..............
1e0: 00 53 55 42 4d 49 54 20 20 c3 4f 4d 00 00 00 0a  .SUBMIT  COM....
1f0: 3f 69 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ?i..............

The lazilong posting (elsewhere in this thread) showed:

typedef struct {
    Byte            userNumber;
    Cpm_FileName    name;
    Cpm_FileType    fileType;
    Byte            extentNum;
    RboShort        system;
    Byte            numRecords;
    Cpm_BlockSpec   extent[Cpm_kBlocksPerExtent];
} Cpm_DirEntry;

In which case "system" is pretty much always zero, and "numRecords"
varies from 0x0a to ox80, suggesting that "numRecords" is actually the
total number of 128-byte records in this extent of the file, rather than
the number used in the last allocation block.

-- 
Send mail to fadden@fadden.com (Andy McFadden) - http://www.fadden.com/
CD-Recordable FAQ - http://www.cdrfaq.org/
CiderPress Apple II archive utility for Windows - http://www.faddensoft.com/
Fight Internet Spam - http://spam.abuse.net/spam/ & http://spamcop.net/