22disk & CP/M diskettes

399 views
Skip to first unread message

Enrico lazzerini

unread,
Dec 23, 2011, 1:43:55 PM12/23/11
to

Hi all,
after i finally resurrected my BIGBOARD and I made ​​the boot of the
operating system CP/M, are struggling with reading old diskettes. Before i
comes out completely my mind in the counting of all parameters to pass to
the program 22disk, someone knows a comprehensive guide on how to decode
the disc formats? I am very close to the identification of parameters, but
frankly it is extremely stressful. I'll try to list where I am keeping in
mind that the format Bigboard 1 has 77 tracks x 26 sectors / track each
with 128byte single-density single-sided.

1) almost every disk CP/M in the first 2 tracks the format is 77 tracks x
26 sectors / track each from 128byte.
2) then starts the data portion that would be double-sided and i need to
remove from this portion the sectors used for the FAT whose number is to be
calculated as a function of the total number of sectors to be managed;
3) i'm able to reconstruct the sequence of sectors on the disk for the
first 2 tracks with the CP/M and for the remain data area;
4) then takes over a parameter which is the allocation unit size that means
how fields are grouped together to determine the parameters DRM
5) the allocation unit size determines all the other parameters BSH, BLM,
DSM
6) Finally, AL0 and AL0 that the 22disk's document did not clarify well to
me.

SO: that it is a bit hard for me...
Is out there anyone who can help me?

Excuse for my poor english.

Enrico -Pisa - Italy

--- Posted via news://freenews.netfront.net/ - Complaints to ne...@netfront.net ---

Ole Christensen

unread,
Dec 23, 2011, 4:53:08 PM12/23/11
to
On 23 Dec 2011 19:43:55 +0100, Enrico lazzerini wrote:
>
> Hi all,
> after i finally resurrected my BIGBOARD and I made ​​the boot of the
> operating system CP/M, are struggling with reading old diskettes.
> Before i
> comes out completely my mind in the counting of all parameters to
> pass to
> the program 22disk, someone knows a comprehensive guide on how to
> decode
> the disc formats? I am very close to the identification of
> parameters, but
> frankly it is extremely stressful. I'll try to list where I am
> keeping in
> mind that the format Bigboard 1 has 77 tracks x 26 sectors / track
> each
> with 128byte single-density single-sided.

This should be "standard CP/M format", (3740 format),...?

and the 1'st entry in 22disk's table, (A1),...:

BEGIN A1 Generic CP/M - SSSD 8"
DENSITY FM ,HIGH CYLINDERS 77 SIDES 1 SECTORS 26,128
SIDE1 0 1,7,13,19,25,5,11,17,23,3,9,15,21,2,8,14,20,26,6,12,18,24,4,10,16,22
BSH 3 BLM 7 EXM 0 DSM 242 DRM 63 AL0 0C0H AL1 0 OFS 2
END

Hope this help,...
<ole>

Enrico lazzerini

unread,
Dec 24, 2011, 4:57:37 AM12/24/11
to
Yes, but is there anyone who would help me to understand how to create
those parameters from information found with anadisk with other kind of
diskettes? How ALL those info are connected between them?
Enrico

Ole Christensen

unread,
Dec 24, 2011, 8:58:18 AM12/24/11
to
for documentation on DPB & DPH please look up those in the CP/M 3
System Guide,... (section 3.3 BIOS Disk Data Structures)
(even if You are using CP/M 2.x most are equal)

<ole>





Enrico lazzerini

unread,
Dec 24, 2011, 1:35:39 PM12/24/11
to
Thanks, you drive me so close to the solution of my problem, but it is very
hard for me. What I need to understand is how many sectors are left for the
directory in order to calculate the remaining part of the track 2 for datas
(to add to the remain part of the sectors of the entire disk) knowing thats
naturally depends on the number of sectors and their capacity.
For example, a disk with:

40 tracks
single Face
9 sectors of 512 bytes each
2 tracks for the operating system
and BLS from 1024Byte
how do you get these values?


BSH 3 =log(1024/128)
BLM 7 =2exp(BSH)-1
EXM 0 =0
DSM 170 = how calculate it?
DRM 63 = how calculate it?
AL0 0C0H = yes it means 11000000b= 2 but how calculate it?
AL1 0 = left 0
OFS 2 OK

Jeffrey W. Shook

unread,
Dec 25, 2011, 1:20:01 AM12/25/11
to
Hello Enrico,

Try studying the DISKDEF.LIB file from the CP/M 2.2 alteration disk. It
is designed to calculate the disk table values given some information
about the layout of the particular floppy disk. Assembling some samples
using MAC would let you see what values are produced for different
settings and studying the macro code would reveal the decisions made to
generate the tables.

Jeffrey W. Shook



Comments from start of DISKDEF.LIB


; CP/M 2.0 disk re-definition library
;
; Copyright (c) 1979
; Digital Research
; Box 579
; Pacific Grove, CA
; 93950
;
; CP/M logical disk drives are defined using the
; macros given below, where the sequence of calls
; is:
;
; disks n
; diskdef parameter-list-0
; diskdef parameter-list-1
; ...
; diskdef parameter-list-n
; endef
;
; where n is the number of logical disk drives attached
; to the CP/M system, and parameter-list-i defines the
; characteristics of the ith drive (i=0,1,...,n-1)
;
; each parameter-list-i takes the form
; dn,fsc,lsc,[skf],bls,dks,dir,cks,ofs,[0]
; where
; dn is the disk number 0,1,...,n-1
; fsc is the first sector number (usually 0 or 1)
; lsc is the last sector number on a track
; skf is optional "skew factor" for sector translate
; bls is the data block size (1024,2048,...,16384)
; dks is the disk size in bls increments (word)
; dir is the number of directory elements (word)
; cks is the number of dir elements to checksum
; ofs is the number of tracks to skip (word)
; [0] is an optional 0 which forces 16K/directory entry
;
; for convenience, the form
; dn,dm
; defines disk dn as having the same characteristics as
; a previously defined disk dm.
;
; a standard four drive CP/M system is defined by
; disks 4
; diskdef 0,1,26,6,1024,243,64,64,2
; dsk set 0
; rept 3
; dsk set dsk+1
; diskdef %dsk,0
; endm
; endef
;
; the value of "begdat" at the end of assembly defines the
; beginning of the uninitialize ram area above the bios,
; while the value of "enddat" defines the next location
; following the end of the data area. the size of this
; area is given by the value of "datsiz" at the end of the
; assembly. note that the allocation vector will be quite
; large if a large disk size is defined with a small block
; size.

s_dub...@yahoo.com

unread,
Dec 26, 2011, 1:13:54 AM12/26/11
to
On Dec 24, 12:35 pm, Enrico lazzerini <enrico.lazzer...@tiscali.it>
wrote:
> --- Posted via news://freenews.netfront.net/ - Complaints to n...@netfront.net ---

According to the CP/M 3 System Guide, 3.3 Bios Data Structures, DSM is
one less than the total number of blocks on the drive. If the block
size is to be 1024 bytes in size then DSM must be less than or equal
to 00FFh.
(So each block number in a Dir FCB disk map is one byte, and a Dir FCB
represents (16) 1k blocks, an 'Extent'.)
If DSM is > 255 then a word size block number is in a Dir FCB disk
map, and a Dir FCB represents (8) 2k..16k blocks.

The product of BLS * (DSM+1) is the total number of bytes the drive
holds and must be within the capacity of the physical disk. It does
not include the reserved operating system tracks.

40 - 2 tracks = 38 tracks.
38 trks x 9 physical sectors = 342 physical sectors.
2 physical sectors = one 1k block
342 / 2 = 171 1k blocks, which is less than 255 so EXM = 0 according
to Table 3-5.
Therefore DSM (Disk Size Maximum in BLS's) is 171-1 = 170.

DRM (DiR Maximum) is one less than the total number of 32-byte
directory entries.
There are 32 directory entries per 1k, and the above block size is 1k.
The Allocation Bitmap (AL0,AL1) records how many blocks are devoted to
the directory space.
C000h means 1100 0000 0000 0000b so two 1k blocks are meant for the
directory = 64 dir entries.
So DRM is 64-1 = 63.

More Allocation Blocks could be reserved, up to a full Allocation
Bitmap of all 1's, which is 16 blocks reserved for the directory, for
a maximum of 512 directory entries for a BLS of 1k. These are set in
stone, once decided, in the DPB structure.

The block 0 begins the Directory, so for the above with an Allocation
Bitmap of C000h (that is 2 blocks in length) the Data area begins with
block 2.

BSH is the bit shift value to figure conversion of cpm records per
block size.
BLM is the mask to figure Modulo, or remainder after division,
equaling one less than the number of cp/m records per blocksize. Both
are used to convert a file's cp/m relative record into the proper Dir
FCB disk map position, to find the block number pertaining to the
storage of the relative record.

hth,
Steve

Enrico lazzerini

unread,
Dec 26, 2011, 10:51:53 AM12/26/11
to
Thanks for the explanation. The reason why I'm interested in this topic is
that I recently restored a Ferguson Bigboard I with its CP/M 60K. I'd like
to try different programs that are contained in old CP/M dischettes of
different brands so in different formats. The variables in which I am
finding difficulties are:
1) to determine the block size chosen from the designers in each different
diskette;
2) Identify the value AL0
I can find the sector's sequence, identifying how many sectors were
assigned as 32-byte directory, and any further calculation is dependent on
the size of the block that would seem not to be identified in advance, but
to determinate by different trial (starting from 1024,2048,4096 and 8192).
This leads to go on trial. .

In the previous case :

40 tracks
single Face
9 sectors of 512 bytes each
2 tracks for the operating system
ALL the other values will change using different value of BLS.

How can i do?


Thanks for any helpful hint

Enrico

--- Posted via news://freenews.netfront.net/ - Complaints to ne...@netfront.net ---

Ole Christensen

unread,
Dec 26, 2011, 1:20:30 PM12/26/11
to
Mon 26 Dec 2011 15:51:55 +0000 (UTC), Enrico lazzerini wrote:

> 2) Identify the value AL0
> I can find the sector's sequence, identifying how many sectors were
> assigned as 32-byte directory, and any further calculation is
> dependent on
> the size of the block that would seem not to be identified in
> advance, but
> to determinate by different trial (starting from 1024,2048,4096 and
> 8192).
> This leads to go on trial. .
>
> In the previous case :
>
> 40 tracks
> single Face
> 9 sectors of 512 bytes each
> 2 tracks for the operating system
> ALL the other values will change using different value of BLS.
>
> How can i do?
>

Maybe going back for Jeffrey's idea,...?
mix it with what You learned from Steve,...

The following strip down version of the macro will
give this result:

CPM86X1 DPB REC,SPT,TRK,BLK,DIR,OFF,CKS
0000+2000 DW ??0001 ; 128 BYTE RECORDS PER TRACK
0002+0307 DB ??0002,??0003; BLOCK SHIFT AND MASK
0004+00 DB ??0004 ; EXTENT MASK
0005+9B00 DW ??0005 ; MAXIMUM BLOCK NUMBER
0007+3F00 DW ??0006 ; MAX DIRECTORY ENTRY NUMBER
0009+C000 DB ??0007,??0008; ALLOC VECTOR FOR DIRs
000B+1000 DW ??0009 ; CHECKSUM SIZE
000D+0100 DW OFF ; OFFSET FOR SYSTEM TRACKS

Just "compile" it with mac.com,...
<ole>


dpb macro ?psize,?pspt,?trks,?bls,?ndirs,?off,?ncks
local ?spt,?bsh,?blm,?exm,?dsm,?drm,?al0,?al1,?cks,?psh,?psm
local ?n
;; physical sector mask and physical sector shift
?psh set 0
?n set ?psize/128
?psm set ?n-1
rept 8
?n set ?n/2
if ?n = 0
exitm
endif
?psh set ?psh + 1
endm
?spt set ?pspt*(?psize/128)
?bsh set 3
?n set ?bls/1024
rept 8
?n set ?n/2
if ?n = 0
exitm
endif
?bsh set ?bsh + 1
endm
?blm set ?bls/128-1
?size set (?trks-?off)*?spt
?dsm set ?size/(?bls/128)-1
?exm set ?bls/1024
if ?dsm > 255
if ?bls = 1024
.'Error, can''t have this size disk with 1k block size'
exitm
endif
?exm set ?exm/2
endif
?exm set ?exm-1
?all set 0
?n set (?ndirs*32+?bls-1)/?bls
rept ?n
?all set (?all shr 1) or 8000h
endm
?al0 set high ?all
?al1 set low ?all
?drm set ?ndirs-1
if not nul ?ncks
?cks set ?ncks
else
?cks set ?ndirs/4
endif
dw ?spt ; 128 byte records per track
db ?bsh,?blm ; block shift and mask
db ?exm ; extent mask
dw ?dsm ; maximum block number
dw ?drm ; max directory entry number
db ?al0,?al1 ; alloc vector for directory
dw ?cks ; checksum size
dw ?off ; offset for system tracks
endm

; Define 5" 40 Track, 1 side IBM CP/M-86 Format
rec Set 128 ; size of CP/M physical record
sides Set 1
psec Set 8
prec Set 512
blk Set 1024
dir Set 64
cks Set dir/4
off Set 1
trk Set 40*sides
spt Set (prec/rec)*psec
rps Set prec/rec
Cpm86x1 dpb rec,spt,trk,blk,dir,off,cks

s_dub...@yahoo.com

unread,
Dec 26, 2011, 2:01:09 PM12/26/11
to
On Dec 26, 9:51 am, Enrico lazzerini <enrico.lazzer...@tiscali.it>
wrote:
Yes, it's mostly trial and error if you don't know the diskette
parameters. For common computers like the kaypro, you have a better
chance of finding out information, sadly this gets harder with the
passage of time on the one hand, yet easier with the internet
nowadays. Something like ANADISK run on an old PC/XT with 5 1/4
floppies could tell you much about the native diskette format. The
caveat is that if the system used hard sectored diskettes, you won't
have much success (not too common).

It is sort of expected that someone with a home brew computer would
have to develop his own software for it. That is why computer groups
dedicated to particular brands or projects develop a following, to
share in those efforts. While the CP/M core is the same, evrything
about the BIOS is different among brands and models as to disk
controller types, video displays, serial and parallel ports, the chips
that support those and i/o port numbers used, and the like. There is
no standard for these in the CP/M world, just conventions used
according to brands and models.

When you bought commercial software, you bought it tailored for your
make and model.

The only thing you can hope to find on foreign diskette formats is
text files. This could be documentation on a software package, it
could also be a .hex file to generate a software program (hopefully
generic enough for you to use).

> In the previous case :
>
> 40 tracks
> single Face
> 9 sectors of 512 bytes each
> 2 tracks for the operating system
> ALL the other values will change using different value of BLS.
>

Don't forget sector interleave also, some use it some don't, and if
used, what is the interleave?

> How can i do?
>

Something like ANADISK run on an old PC/XT, then 22disk to read the
files, then serial transfer to the bigboard to try.

It may not be enough to have a DPB for a given diskette format, the
bigboard controller maybe can't conform to it, can it?

Steve

> Thanks for any helpful hint
>
> Enrico
>
> --- Posted via news://freenews.netfront.net/ - Complaints to n...@netfront.net ---- Hide quoted text -
>
> - Show quoted text -

Jeffrey W. Shook

unread,
Dec 26, 2011, 11:39:46 PM12/26/11
to
Hello Enrico,
In my previous reply I neglected to mention that since the diskette
format you described does not have 128 byte physical sectors one must
also decipher the blocking mechanism used for the diskette because CP/M
2.2 only deals with 128 byte sectors. The BIOS must extract the correct
128 byte part of physical sector on read and insert the 128 byte logical
sector into the correct location in the physical sector before writing.
This may require reading the physical sector first unless a caching
mechanism is provided. This makes determining how to read the format
even more complicated. The diagram below shows what seems to be the
typical logical to physical translation for 512 byte sectors.

Sectors:

Logical 01 02 03 04 05 06 07 08 09 10 11 12

Physical 01 01 01 01 02 02 02 02 03 03 03 03
Offset-Hex 000 080 100 180 000 080 100 180 000 080 100 180


It appears to me that you are trying to read the disks on a PC using 22
Disk but don't know the name of the format used to write them. But it
is not clear if you know the type of system the disks were written on.
Knowing that would limit the range of possibilities for the disk format.

Jeff

ldkr...@gmail.com

unread,
Mar 14, 2013, 11:15:03 AM3/14/13
to enrico.l...@tiscali.it

Enrico,
Here is a Document I used for the CP/M Definitions I created. Maybe it will
fill in the details...........

Larry


Some Helpful Hints on Developing a Disk Definition from Scratch

If possible, run programs on the CP/M system to help get the necessary information for building a new definition. The following files may be transferred by RS-232C if a Terminal Program is available.

1. CPMADR.COM - Finds addresses used by the CP/M system.

2. DPB.COM - Finds Disk Parameter Block information.
DPB.BAS - Same, but runs under MBASIC.

3. PROBE.COM - Probes CP/M System and Drive for information.
Note: The previous four programs may not locate and
display accurate information for some CP/M systems.

4. SKEW.COM - Finds disk SKEW information.

5. Execute the following "STAT" commands on system in question.
Note: "Control P" will allow a hardcopy of the information.

STAT DEV: - Displays current DEVICE information.
STAT VAL: - Displays current STATUS information.
STAT USR: - Displays current USR information.
STAT A*.* $S - Displays detailed file information.
STAT DSK: - Gives some detailed disk information for logged drive.
STAT A: DSK: - Gives some detailed disk information for A:.
STAT B: DSK: - Gives some detailed disk information for B:.

If you have a functional CP/M system, you can use DDT to find the Disk Parameter Block and the
information is stored there for each drive.

1. Log the drive you wish to locate the DPB data for. I will use A; for this example
2. Run DDT and enter the code below:
DDT
-f0100,0200,00
-A0100
0100 mvi c,1f
0102 call 5
0105 rst 7
0106 <Carriage Return>
-d0100
0100 0e1fcd0500FF
-g0100
*105
-x
The contents of register HL is the address of Drive A: DPB. If you display that address (mine was
F5E3) you will see F5E3: 2400040F0154007F00C00020000200.




RPT = 0024 = The number of 128 byte records per track.
BSH = 04 = The block shift count.
BLM = 0F = The block mask.
EXM = 01 = The extent mask.
DSM = 0054 = Disk storage maximum (the largest block number).
DRM = 007F = Directory maximum (the largest directory entry).
DAB = 000C= Directory Allocation Block AL0: = 00 & AL1: = 0C
CKS = 00020 = Directory check size.
OFF = 0002 = Track offset (number of reserved tracks).


SPT: Number of sectors per track. May differ from RPT if physical sectors
are other than
128 bytes in size.


SSZ: Sector size code:
0 = 128 bytes per sector

1 = 256 bytes per sector

2 = 512 bytes per sector

3 = 1024 bytes per sector


NTK: Number of tracks (35, 40, 77, or 80). The number of tracks can be determined by formatting
a Floppy, or with Anadisk. Anadisk will also tell you the sector size and SKEW.



Quite frequently, the only information available when developing a definition for 22DISK is a
diskette with a few files and nothing more.

Here's a guide on what to do if you'd like to try working up a definition yourself:

1. Get a copy of Sydex's ANADISK. This utility will furnish far more information than will any
other program. A typical disk definition follows:

BEGIN AMP4 Ampro - DSDD 96 tpi 5.25"
DENSITY MFM,LOW
CYLINDERS 80 SIDES 2 SECTORS 5,1024 SKEW 2
SIDE1 0 17,18,19,20,21
SIDE2 1 17,18,19,20,21
ORDER SIDES
BSH 4 BLM 15 EXM 0 DSM 394 DRM 255 AL0 0F0H AL1 0 OFS 2
END


New definitions require the following information:

DENSITY xx,xx
CYLINDERS xx
SIDES xx
SECTORS x,xxxx
SKEW x
SIDE1 0 x,x1,x2,x3, , ,xn
SIDE2 x x,x1,x2,x3, , ,xn
ORDER x
BSH x
BLM x
EXM x
DSM x
DRM x
AL0 x
AL1 x
OFS x (or SOFS x)
COMPLEMENT (unlikely)

2. Run ANADISK on the diskette in SECTOR EDIT mode with the display set for "HEX".
Note that the interleave (or SKEW) is given, as well as the number, size and addresses of
sectors. You now have data for: DENSITY, CYLINDERS, SIDES, SKEW SIDE1 and SIDE2.

3. Locate the directory on the diskette. Almost invariably, it starts on the first sector of a track.
If for some reason it can't be found on the first sector of a track, try using the SEARCH feature
to find a "FILE" name that exists on the disk. The number of tracks or sectors up the point
where the directory begins will give the figure for OFS or SOFS. The directory stands out
because it shows file names every 32 bytes, or every other line on the ANADISK display.

Directory was located at Cylinder 0, Side 0, Sector 2:

0000 00 32 32 44 49 53 4b 20 20 44 4f 43 00 00 00 80 .22DISK DOC....
0010 02 00 03 00 04 00 05 00 06 00 07 00 08 00 09 00 ................
0020 00 32 32 44 49 53 4b 20 20 44 4f 43 01 00 00 80 .22DISK DOC....
0030 0a 00 0b 00 0c 00 0d 00 0e 00 0f 00 10 00 11 00 ................
0040 00 32 32 44 49 53 4b 20 20 44 4f 43 02 00 00 80 .22DISK DOC....
0050 12 00 13 00 14 00 15 00 16 00 17 00 18 00 19 00 ................
0060 00 32 32 44 49 53 4b 20 20 44 4f 43 03 00 00 80 .22DISK DOC....
0070 1a 00 1b 00 1c 00 1d 00 1e 00 1f 00 20 00 21 00 ............ .!.
0080 00 32 32 44 49 53 4b 20 20 44 4f 43 04 00 00 08 .22DISK DOC....
0090 22 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 "...............
00a0 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 ................
00b0 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 ................
00c0 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 ................
00d0 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 ................
00e0 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 ................
00f0 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 ................





0100 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 ................
0110 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 ................
0120 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 ................
0130 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 ................
0140 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 ................
0150 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 ................
0160 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 ................
0170 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 ................
0180 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 ................
0190 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 ................
01a0 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 ................
01b0 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 ................
01c0 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 ................
01d0 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 ................
01e0 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 ................
01f0 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 ................

Fig 1

Directory continues on Cylinder 0, Side 0, Sector 3:

0000 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 ................
0010 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 ................
0020 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 ................
0030 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 ................
0040 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 ................
0050 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 ................
0060 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 ................
0070 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 ................
0080 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 ................
0090 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 ................
00a0 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 ................
00b0 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 ................
00c0 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 ................
00d0 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 ................
00e0 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 ................
00f0 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 ................
0100 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 ................
0110 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 ................
0120 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 ................
0130 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 ................
0140 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 ................
0150 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 ................
0160 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 ................
0170 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 ................
0180 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 ................
0190 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 ................
01a0 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 ................
01b0 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 ................
01c0 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 ................
01d0 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 ................
01e0 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 ................
01f0 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 e5 ................

Fig 2




4. Examine the first directory entry. The second 16 bytes (the second line of the entry) gives a list
of allocation unit numbers (AUN) belonging to the file. The first one of these will tell how many
allocation units have been reserved to hold the directory. Thus, if the first allocation byte is 02,
two allocation units have been allocated to the directory. Another thing to note is whether the
allocation unit number appears to be an 8 bit or 16 bit quantity. For example, if an entry has the
following form:

00 50 49 50 20 20 20 20 20 43 4F 4D 00 00 00 10 .PIP COM....
04 00 05 00 06 00 00 00 00 00 00 00 00 00 00 00 ................

the allocation unit designators are 4, 5 and 6 and are 16 bit quantities. On the other hand, the
following item:

00 50 49 50 20 20 20 20 20 43 4F 4D 00 00 00 10 .PIP COM....
04 05 06 00 00 00 00 00 00 00 00 00 00 00 00 00 ................

shows the same allocation units, but as 8 bit quantities. If 16 bit quantities are involved, more
than 255 allocation nits are defined for the diskette, if an 8 bit quantity, less than 256 units.
This serves as a check for later computations. In any case, the first allocation number of the
first directory entry gives the number of bits to be set in AL0 and AL1.

Allocation Unit Number (AUN)
02 AL0 11000000B Al1 0
04 AL0 11110000B Al1 0



The following information shows a detailed breakdown of all the information in the the first and
second directory entries.

00 - Valid file (E5 for Erased File)
32 32 44 49 53 4b 20 20 44 4f 43 - File name 22DISK DOC (11 bytes)
00 - Extent (used for large files)
00 - S1 (Digital Research Reserved)
00 - S2 (Digital Research Reserved)
80 - Number of records in this extent
02 00 03 00 04 00 05 00 06 00 07 00 08 00 09 00 - allocation units

Note: 02 is the first AUN.

00 - (Continuation of above file)
32 32 44 49 53 4b 20 20 44 4f 43 - File name 22DISK DOC (11 bytes)
01 - Extent (used for large files)
00 - S1 (Digital Research Reserved)
00 - S2 (Digital Research Reserved)
80 - Number of records used
0a 00 0b 00 0c 00 0d 00 0e 00 0f 00 10 00 11 00 - allocation units

Note: Unused allocation units will be 00.






5. Starting with the first directory sector, advance the sector (and track, if necessary) until you
find the data belonging to the first file. Unused directory entries are almost always filled out
with a pattern of E5's. The number of sectors dedicated to the directory will give an indication
of both the number of directory entries and the allocation unit size.


First Program located at Cylinder 0, Side 1, Sector 2:
NOTE: (This was the 9th sector displayed, so 8 are reserved for directory)

0000 0d 0a 0d 0a 0d 0a 0d 0a 0d 0a 0d 0a 20 20 20 20 ............
0010 20 20 53 79 64 65 78 0d 0a 0d 0a 0d 0a 0d 0a 0d Sydex.........
0020 0a 0d 0a 0d 0a 0d 0a 0d 0a 0d 0a 0d 0a 0d 0a 0d ................
0030 0a 0d 0a 0d 0a 0d 0a 0d 0a 0d 0a 0d 0a 0d 0a 20 ...............
0040 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0050 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0060 20 20 20 20 20 32 32 44 49 53 4b 0d 0a 0d 0a 0d 22DISK.....
0070 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
0080 20 20 20 20 20 41 20 43 50 2f 4d 2d 74 6f 2d 44 A CP/M-to-D
0090 4f 53 20 44 69 73 6b 65 74 74 65 20 49 6e 74 65 OS Diskette Inte
00a0 72 63 68 61 6e 67 65 20 55 74 69 6c 69 74 79 0d rchange Utility.
00b0 0a 0d 0a 0d 0a 0d 0a 0d 0a 0d 0a 0d 0a 0d 0a 0d ................
00c0 0a 0d 0a 0d 0a 0d 0a 0d 0a 0d 0a 0d 0a 0d 0a 0d ................
00d0 0a 0d 0a 0d 0a 0d 0a 0d 0a 0d 0a 0d 0a 0d 0a 20 ...............
00e0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
00f0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0100 20 20 20 20 20 20 20 20 20 20 20 20 20 53 79 64 Syd
0110 65 78 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 ex..
0120 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0130 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0140 20 20 31 35 33 20 4e 6f 72 74 68 20 4d 75 72 70 153 North Murp
0150 68 79 20 41 76 65 2e 0d 0a 20 20 20 20 20 20 20 hy Ave...
0160 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0170 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0180 20 20 20 20 20 20 20 53 75 6e 6e 79 76 61 6c 65 Sunnyvale
0190 2c 20 43 41 20 20 39 34 30 38 36 0d 0a 20 20 20 , CA 94086..
01a0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
01b0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
01c0 20 20 20 20 20 20 20 20 20 20 20 28 34 30 38 29 (408)
01d0 20 37 33 39 2d 34 38 36 36 0d 0a 0d 0a 0d 0a 0d 739-4866.......
01e0 0a 0c 0d 0a 0d 0a 0d 0a 0d 0a 0d 0a 0d 0a 0d 0a ................
01f0 0d 0a 0d 0a 0d 0a 0d 0a 20 20 20 20 20 20 20 20 ........

Fig 3


Suppose that a our hypothetical diskette shows 8 sectors of 512 bytes allocated to the directory.
Since a directory entry is 32 bytes long, the number of directory entries possible for this format is:

16 entries/sector X 8 sectors = 128 entries total
or
((Sector Size in Bytes/32) X Sectors to DIR) -1 = DRM






Thus, DRM is one less than this or 127. Since we know that these 8 sectors represent 2 allocation
units or 4,096 bytes, the Allocation Unit Size (AUS) is:

4,096 / 2 = 2,048 bytes
or
((Sector Size in Bytes) X Sectors to DIR) / AUN = AUS

Given this, we can use the following table to compute the values for BSH and BLM:


+------------+---------+----------+
| Unit Size | BSH | BLM |
+------------+---------+----------+
| 1,024 | 3 | 7 | +----------+
| 2,048 | 4 | 15 | ------+ This one |
| 4,096 | 5 | 31 | +----------+
| 8,192 | 6 | 63 |
| 16,384 | 7 | 127 |
+------------+---------+----------+


7. We still need a value for EXM and DSM. DSM is simply the total number of allocation units
on the diskette, not counting the system OFS area. Let's assume that our diskette has an offset
of 2 tracks and is single-sided with 40 cylinders with 8 sectors per track. The value of DSM
is then:

((40 cylinders X 1 side) - 2 tracks) X 8 sectors X 512 bytes) =
155,648 bytes / 2,048 = 76 Allocation units, total

To get EXM, we then use the following table:

+------------+-----------+-----------+
| Unit Size | DSM < 256 | DSM > 255 |
+------------+-----------+-----------+
| 1,024 | 0 | na |
| 2,048 | 1 | 0 |
| 4,096 | 3 | 1 |
| 8,192 | 7 | 3 |
| 16,384 | 15 | 7 |
+------------+-----------+-----------+


8. That's almost the complete picture, but for the SIDE1 and SIDE2 sector ordering. This is the
hardest to determine of any of the parameters. Find a readable text file on the diskette and
piece the text back together by observing how words break across sector boundaries. After a
bit, a pattern in the ordering will become apparent, such as:

1, 3, 5, 7, 2, 4, 6, 8






9. The ORDER value can be determined on double-sided diskettes by observing whether file
data appears to move from one track to the next on the same side (CYLINDERS), or appears to
go from one side to the other and then advance to the next cylinder (SIDES).

10. COMPLEMENT is rare. Generally, if a diskette appears to be formatted with values of 1A
instead of E5, the data on the diskette is complemented.

11. Last resort for information will require a memory dump from F200 hex through FFFF to
provide all the DBP information as hex bytes. It will be necessary to dig through 3584 (E00)
bytes of data to locate the DPB information. Most systems follow the layout shown below.


(Hex values starting in memory at Fxxx)
RPT: (word) total # of logical 128-byte sectors/track
BSH: (byte) data allocation block shift factor,
determined by data block allocation size
1k=3 2k=4 4k=5 8k=6 16k=7
BLM: (byte) data allocation block mask (2**[BSH-1])
1k=7 2k=15 4k=31 8k=63 16k=127
EXM: (byte) extent mask, determined by the data block
allocation size and the number of disk blocks
1k=0 2k=1 4k=3 8k=7 16k=15 if DSM < 256
1k=n 2k=0 4k=1 8k=3 16k=7 if DSM > 256
DSM: (word) disk size in blocks-1; determines the total
storage capacity of the disk size
DRM: (word) directory size-1; determines the total number
directory entries that can be stored on this
drive. DRM: = ((# dir entries) / 4) -1
AL0: (byte) alloc0 (1100 0000) 2 blocks/dir
(1000 0000) 1 block/dir
AL1: (byte) alloc1 (0000 0000)
Note that AL0: and AL1: are taken together
as a single sixteen-bit mask for the number
of blocks of directory allocation.
(1100 0000 0000 0000) 2 blocks/dir
(1000 0000 0000 0000) 1 block/dir
CKS: (word) directory check vector size
fixed media: CKS = 0
removable media: CKS = (DRM + 1)/4
OFF/SOFF: (word) # of reserved system tracks or sectors (offset)
at the beginning of the (logical) disk.
Usually the directory begins at the first
sector of the track defined by this number.






By formatting a disk the number of tracks can be determined, which will give the first byte to
look for. The SPT will be followed by 00 and the value for BSH and BLM will be the third and
fourth bytes.

BSH and BLM will be one of the following Hex values:

BSH 3 or 4 or 5 or 6 or 7
BLM 7 or 0F or 1F or 3F or 7F

The above information should be fairly easily to locate.


Reply all
Reply to author
Forward
0 new messages