• Please review our updated Terms and Rules here

CP/M 2.2 with 2 drives of different sizes

Twospruces

Veteran Member
Joined
Dec 9, 2009
Messages
787
Location
Canada
I'm contemplating how to modify CP/M 2.2 to work with an A: and B: of different sizes. From what I have seen so far, it looks like the Disk Parameter Table is common for all drives.

Was there ever a version of CP/M 2.2 that had support for different drives being used at the same time?

Getting some source code that I could look at would be helpful. Trying to decide if the effort is going to be worth the result.

thanks
 
Support for heterogeneous drive types was extremely common. The more flexible systems could recognize a particular format automatically and configure themselves properly at re-log (Ctrl-C). I developed an 8" diskette driver for Applicard (Apple 2 coprocessor board) that could handle (4) different formats automagically.
 
As others mentioned, this has been done extensively throughout the CP/M world. The implementations range from simple to wildly complex, from elegant to... not so elegant. Probably the first place to look is the CP/M alteration guide, reading up on the DPH and DPB and associated structures. That is what you'll need to get "right" to make this work. Once you understand those structures, I think a solution for your existing BIOS will present itself - or at least start to come into focus.
 
I would mention again the book by Andy Johnson-Laird, 'The Programmers CP/M Handbook', which contains a detailed and highly annotated BIOS example. This BIOS allows for 4 floppy drives, 2 @ 5.25" and 2 @ 8", but looking at the code it could be 4 different.

The book can be found as a PDF on-line, and the full source code for the BIOS (fig 8-10) can also be downloaded as a text item.

Geoff
 
The more flexible systems could recognize a particular format automatically and configure themselves properly at re-log (Ctrl-C).
How did they do it? Just reading the directory and if the read succeeds and appears to contain valid data, assume the correct format was found?
 
How did they do it? Just reading the directory and if the read succeeds and appears to contain valid data, assume the correct format was found?

Typically, they had some well-defined structure in their system (boot) tracks, such as a special header in sector 0 (first sector on disk). I've not heard of any that tried to read the directory, although maybe some did that. Interpreting "valid" directory entries is not as easy as it might sound.

And the point about re-log is referencing how CP/M tries to handle disk changes (floppy, removable media). Warm boot will flag all drives as "logged out", and this information is passed to the BIOS when selecting a drive, so the BIOS can determine if it needs to check for new media (test the format). Fixed media like harddrives only needed to be checked at cold boot, if they contain that information. There was a mechanism for BIOSes to detect media change and signal the BDOS, in the DPH, but that usually required specialized hardware that most vendors did not implement. The general procedure was that the user pressed Ctrl-C at the command prompt after changing disks, but it is possible for programs to log-out drives as well.
 
Last edited:
Further to the above, the Amstrad PCW computers using CP/M+ implement this, and the process is documented. The disk format process inserts a 16 byte XDPB into the first sector, and this is read by the system and the DPB can be updated automatically. This covers all the variations of the format that might normally be encountered. I might swap between 180k SS, 360k DS and 720k DS and not notice anything happening, it's all automatic.

See: http://www.seasip.info/Cpm/amsform.html

Geoff
 
Typically, they had some well-defined structure in their system (boot) tracks, such as a special header in sector 0 (first sector on disk). I've not heard of any that tried to read the directory, although maybe some did that. Interpreting "valid" directory entries is not as easy as it might sound.
That's why I was confused. Of course, if you can rely on format-specific magic data on the disk, auto-detection becomes easy.

The disk format process inserts a 16 byte XDPB into the first sector, and this is read by the system and the DPB can be updated automatically.
If only Digital Research had made the layout information a mandatory part of the file system...
 
...
If only Digital Research had made the layout information a mandatory part of the file system...

Yeah, there was a lot more they could have done to guide the vendors, but they were more hands-off about the BIOS implementation.
 
DPH & DPB tables are in the BIOS, which is specific to the manufacturer. It was common for many vendors to take short cuts and save TPA by only implementing a single drive type. There is a DBH for each drive and a DPB for each drive type. DPBs were some time dynamically populated.

Research Machines BIOS implemented multiple drive types. It had an intelligent disk controller board that would auto detect the format of the disk media format and the drive capability.

First set of tests were for drive capability:
The first test was 8" vs 5.25" determined by which pin Index pulses were on and their timing (300 or 360 RPM).
The second test was to home the disk then attempt to step to track 43 If this failed then it was a 40T (48 TPI drive).
The 3rd test was more of a check, home the disk and attempt to step to track 80, If this failed it confirmed that it was a 77 track 8" drive.
Else it was assumed to be an 80T 96 TPI drive. (RM system were prior to HD drives so were either FM IBM3740 based single density format or MFM IBM34 based double density format.

Second set of tests were for media format:
RM supported the following media:
8" 1SSD FM IBM3740 Single density (128 byte sector, 26 spt, 77 tracks, 1 reserved) nominal 250kb
8" 1SDD MFM IBM34 like Double density (256 byte sector, 26 spt, 77 tracks, 1 reserved) nominal 500kb

5.25" 1SSD FM IBM3740 like single density 40T (128 byte sector, 16 spt, 40 tracks, 3 reserved) nominal 80kb
5.25" 1SSD FM IBM3740 like single density psuedo 40T (double stepped on 96 TPI drive => psuedo 48 TPI) (128 byte sector, 16 spt, 40 tracks, 3 reserved) nominal 80kb

5.25" 1SDD MFM IBM34 like double density 40T (512 byte sector, 9 spt, 40 tracks, 3 reserved) nominal 160kb
5.25" 1SDD MFM IBM34 like double density psuedo 40T (double stepped on 96 TPI drive => psuedo 48 TPI) (512 byte sector, 9 spt, 40 tracks, 3 reserved) nominal 160 kb

5.25" 1SQD MFM IBM34 like double density 80T (96 TPI) (512 byte sector, 9 spt, 80 tracks, 3 reserved) nominal 320kb

RM 8 bit CP/M systems were no longer in production when 1.44 and 1.2 Mb disks became fashionable.

Track 0 on all RM disks was FM single density.

Peter
 
A point to remember:

When CP/M 1.4 came out there were only 8" drives in common use.

When CP/M 2.2 came out controllers were becoming available with support for FM single density and MFM double density. In the early stages the 40T 5.25" drive became available.

Later refinements added double sided drives, 80T (96TPI) drives, and later still came the HD formats 1.2 Mb.

Arround this time CP/M 3 came out together with the availability of 3.5" drives (initially 720k then HD format 1.44 Mb) to replace 5.25" drives. IBM had released the IBM PC with 160K 5.25" floppy disks then 320k (double sided) and a change of format to 360k (9 spt replacing the 8 spt). Then came the IBM AT with 1.2 Mb HD 5.25" drives.

It is easy to look back with 20/20 hind sight and suggest that DR should have done more to define multiple disk format support. But by now Gary Kildall had already left IBM waiting whilst he was out flying!

Peter
 
All after the very first RM drives were double sided but each side was treated as a separate drive for compatibilty with older systems.

Thus a dual drive (2 physical) system appeared to have 4 logical drives: A:, B:, C:, D: - with A: & C: being on unit 0 and B: & D: on unit 1.

Peter
 
With the Kaypro 4/83 the double sided disks have (physical) sector numbers from 0-9 on side A and 10-19 on side B, it does seem to recognize singlesided disks as long as there is nothing on the other side.
 
Back
Top