• Please review our updated Terms and Rules here

Disk operations, CP/M 2.2 vs CP/M 3

Plasmo

Experienced Member
Joined
Aug 29, 2017
Messages
217
Location
New Mexico, USA
I recently acquired a batch of DiskOnModule (DOM) and upgraded my homebrew Z80 with DOM instead of compact flash. I'm curios about the performance difference between DOM and CF, so I made up three files each a megabyte in size and PIP them from one drive to another drive. With CP/M 2.2, CF took 103 seconds whereas DOM took 93 seconds. So with 3 megabytes read and 3 megabytes write, CF is 58Kbyte/s while DOM is 65Kbyte/s, about 10% improvement; hardly worth the trouble, really.

Since I have CP/M3 on the same homebrew, I thought I tried it as well. I was shocked: PIP copy of 3 megabyte files is 21 seconds with DOM and 37 seconds with CF. That's 285KByte/s with DOM and 162KByte/s with CF. So why is CP/M 3 disk operation so much faster than CP/M 2.2?

I looked into my CP/M2.2 BIOS, I did my own simple block/deblock and read/write files is with INIR and OTIR instruction. I'm inexperience with CP/M and they are simple BIOS routines. In CP/M 3, I didn't have to do blocking/deblocking, read/write files is using the same INIR and OTIR instructions. So the differences are CP/M 3's better file handling and their more efficient block/deblock algorithms. Really? 4.5 times better? That seems incredible.

Bill
 
One huge thing.

You're using CP/M 3, PIP which uses multi-sector I/O calls--which CP/M 2.2 doesn't have. In CP/M 2.2, you do I/O in 128-byte sectors, one at a time, regardless of the actual physical sector size of the medium.

Try using CP/M 2.2 PIP on a CP/M 3 system (it should work) and let us know the results.
 
As Chuck pointed out, the multi-sector count is a major improvement in this area. Can't say whether your CP/M 3 BIOS also lets the BDOS do sector blocking, but if it does then you get an additional advantage (with multi-sector count) as the full-sector I/Os will go directly to the user (PIP) buffer and bypass a lot of junk (extra copying) that's not needed on sequential I/O.
 
Bill

Thanks for the heads up on DOM's. I wasn't aware of them, 5mins later I have one on order, hopefully it will be the quick way for me to back up my aging hard drive

Pete
 
One huge thing.

You're using CP/M 3, PIP which uses multi-sector I/O calls--which CP/M 2.2 doesn't have. In CP/M 2.2, you do I/O in 128-byte sectors, one at a time, regardless of the actual physical sector size of the medium.

Try using CP/M 2.2 PIP on a CP/M 3 system (it should work) and let us know the results.

I ran CP/M2.2's PIP in CP/M3 environment just as you've suggested. It takes 37 seconds to copy 3 megabyte files instead of 24 seconds using CPM3 PIP (the copy time seems to varies from 21-24 seconds, possibly due to wear leveling? 24 seconds seem the more consistent number). If you recall it took 93 seconds to PIP in CP/M2.2 environment, so CPM3 environment did speed up disk access significantly. This is a good way to demonstrate that running CP/M2.2 applications in CP/M 3 environment can also speed it up. Thank you, very interesting!

Doug, In CP/M 3 BIOS I let it do all the blocking & deblocking so perhaps that's why CP/M 3 PIP is faster than CP/M 2.2 PIP running in CP/M 3 environment.

Bill
 
There's also the issue of caching and read-ahead. I recall that Bill Godbout published a CP/M BIOS for one of his systems that read and wrote a track (at 1:1 interleave) at a time; i.e., there was a full track buffer for each drive. It seemed miraculous when it came down to speed.

With CP/M 3 and multi-sector operation, I also believe that it's possible to DMA directly into the user's buffer.
 
Back
Top