Close

Reading and Writing CP/M Discs with a PC

A project log for STEbus Z80 and FDC CP/M

CP/M boot ROM and disks, reverse engineered.

keithKeith 12/04/2022 at 01:420 Comments

Hurdles:

Steve has found a way to read the CP/M disks without a CP/M system, by using the Linux command 'dd'

He said:

"It was quite easy in the end, once duff floppy disks were eliminated from the equation. Once I discovered the Linux 'dd' command it all fell into place. Although I explored the Linux 'fdutils' (and they revealed some interesting stuff about how the FDD parameters are stored in the PC BIOS CMOS) it is only the 'dd' command that was needed. Details are here: https://www.linuxscrew.com/linux-dd-read-write-floppy-images
I used the command: 
sudo dd bs=512 count=1440 if=my-image.img of=/dev/fd0
to read a disk, and to write a disk: 
sudo dd bs=512 count=2880 if=my-image.img of=/dev/fd0
I also have disks with TurboPascal, Pascal MT+ and MIXC, so once we both have working systems there will be some options for software development!"

Having got the disk images, it is desirable to read the files. Ghex shows the sources files are mostly in contiguous blocks,  but some are fragmented. Steve reports:

"The tools that I downloaded didn't help so I used Ghex to examine the disk image.
The directory starts at offset 1200 (hex), each entry being 32 bytes in length.
Each entry has a list of the 4096 byte blocks used by the file (at directory entry address + 16).
From this I navigated to the first block and copied from there to the 'END' statement. job done!"

Looks like it would be fairly simple to write a small program to do this automatically.

You will need an old PC with a floppy drive. My PC, which was assembled in 2007 does not, so I need to find an even older machine in my junk pile and get it running Linux.

Discussions