16-bit sector addresses in CP/M 2.2

Chuck Guzis cclist at sydex.com
Thu Feb 7 16:59:32 CST 2008


> Date: Fri, 08 Feb 2008 01:43:37 +1030
> From: Alexis 

> I'm attaching a hard drive to my 8080 computer and there seems to be
> something about the way the sector translation works that's caught my
> attention. Before I go wasting my time trying to figure it out myself I'll
> ask here because there's going to be someone who knows (it's 1:30am and
> I'm feeling a little lazy).

> Another thing is that the total sectors per track in the Disk Parameter
> Block is a 16-bits, not 8-bits.
> 
> Apologies if this has been discussed and I've missed it. (Perhaps
> someone can provide a link if it has been)

I'll confine my answer to CP/M 2.2, since that's probably what you're 
working with.

There's lots of 16-bit arithmetic in CP/M 2.2--in particular, the 128-
byte block number is maintained as a 16-bit value. This limits the 
size of a disk to 65536 128-byte records or 8MB.  Yes, you can have a 
single track with 65535 sectors on it or 65535 tracks with a a single 
sector on each.  In theory, the maximum disk size should be about 1GB 
(DRM=65535 and BSH=7).

Check it out for yourself in the source at: 

http://www.cpm.z80.de/source.html

Note that CP/M 2.2 contains no division routines in its sector and 
track computation--the block-to-track-and-sector translation is 
handled by repetitive subtraction.  There is a little bit of code to 
reduce the burden of this by using the last translated block number 
to compute the next, though I wonder how many cycles are saved in 
practice.

Hope this helps.

Cheers,
Chuck



More information about the cctalk mailing list