Memotech Floppy tool

Updated 2014-08-20 to tidy up and rename image files.

MFLOPPY is a tool for reading, verifying and writing Memotech type 03 and type 07 floppy disks on a Linux system. It creates or reads a disk image file, which contains the bytes found on the floppy disk, in the same order that they appear on the disk.

All Memotech disks, even those written on MTX BASIC systems with the SDX and the ROM which provides USER commands to access the disk, use a CP/M 2.2 filesystem. As a result, with appropriate disk definitions, cpmtools can be used to manipulate the disk image file.

This code is modelled on (ie: uses the same IOCTL calls as) fdutils, so should work with regular FDC based floppy drives (not LS120 or USB drives).

Media density

Most 3.5" floppy disks on sale today are high density and bear the HD mark on the top right of the disk. High density floppies also have a hole on the bottom right hand side (opposite the write protect hole on the bottom left hand side).

The floppy drives in SDX systems are double density capable, but they are not high density capable. The floppy drives in an SDX system will write to floppies double density, regardless of whether they are double or high density.

Drives in modern PCs are high density capable. You will therefore need to cover the hole on the bottom right of a high density floppy with opaque tape, so that the PC drive knows to access it double density.

Usage

The usage :-

# ./mfloppy
usage: mfloppy read|verify|write|write+verify /dev/fdX file.mfloppy

By convention, the disk image files representing Memotech floppy disks are shown here with .mfloppy-TT file extension, where TT is the type code.

Formatting media

MFLOPPY is not capable of formatting Memotech floppies.

I recommend formatting on the Memotech system. If using FDX, use FORMAT.COM. If using SDX, use FRMSDX.COM.

If you have fdutils, you can try formatting on Linux. To format to Memotech type 07 format use :-

# ./superformat /dev/fd0 cyl=80 head=2 sect=16 ssize=256 dtr=2 tpi=96 dd

To format to Memotech type 03 use :-

# ./superformat /dev/fd0 cyl=40 head=2 sect=16 ssize=256 dtr=2 tpi=96 dd stretch=1

Not sure if its my setup or not, but I seem to have fewer disk errors if I format on the Memotech system.

Checking media

If you are running CP/M (on FDX or SDX) I recommend you use the Memotech RCHECK.COM to check for disk errors. Good reads show as :, soft (recovered) read errors show as 9 (1 retry needed) down to 1 (9 retries needed) and hard (unrecovered) read errors show as 0s.

Reading Memotech floppy disks on Linux

On the Linux system, as root :-

# ./mfloppy read /dev/fd0 games.mfloppy-07
type 07 (D/S, D/D, 80 track, 640KB) floppy detected
track 10 head 1 sector 7 read after 12 tries
track 10 head 1 sector 8 could not be read read after 100 tries

MFLOPPY retries reads that fail. If quite a few tries are required, it warns you of this. If the data cannot be read after 100 tries, it gives up on that sector and warns you of this. The unreadable sectors will contain 0xdd bytes. It then proceeds to the next sector.

The bad track, head and sector values reported are the physical values (not the logical CP/M view).

On my system, it takes around 1 minute 40 seconds to process a type 07 floppy.

Verifying Memotech floppy disks on Linux

You can verify that a disk contains the same content as a file using :-

# ./mfloppy verify /dev/fd0 games.mfloppy-07

If you get could not be verified messages, it is because the media can't be read, or it can and its not the same as in the file.

Writing Memotech floppy disks on Linux

MFLOPPY does not format a floppy for use in a Memotech system, and so you need to start with an existing formatted Memotech floppy. Start by reading an image of an existing Memotech floppy disk as above. Then manipulate the image using cpmtools. Then write the revised image back to the floppy disk.

On the Linux system, as root :-

# ./mfloppy write /dev/fd0 games.mfloppy-07
type 07 (D/S, D/D, 80 track, 640KB) floppy detected
track 0 head 0 sector 11 written after 4 attempts

Writing and verifying Memotech floppy disks on Linux

To write a floppy then check its content, you can use :-

# ./mfloppy write  /dev/fd0 games.mfloppy-07
# ./mfloppy verify /dev/fd0 games.mfloppy-07

However, with this approach, if you find disk error(s), your only recourse is to write the whole disk again.

As an alternative, you can :-

# ./mfloppy write+verify /dev/fd0 games.mfloppy-07

After writing each sector, it reads it back and checks it. This has the advantage that sometimes temporary glitches in the media (eg: those due to dust), get rewritten there and then.

This causes lots of missed revolutions and takes over 10 minutes (rather than the 3 minutes 20 seconds of the first approach).

Using cpmtools

First you need to teach cpmtools about Memotech type 03 and type 07 disks. Take the contents of the diskdefs file supplied with MFLOPPY and append them to /usr/share/cpmtools/diskdefs. This defines memotech-type03 and memotech-type07 CP/M disk definitions.

Then you can list files :-

# cpmls -f memotech-type07 -d games.mfloppy-07 
STARTUP  COM : STAT     COM : SUB      COM : SYSCOPY  COM
SCH      COM : SDIR     COM : FRMSDX   COM : SIDISC   COM
ALPHA    COM : ANGLE    COM : ASTROPAC COM : BUCK     COM
DEFENDER COM : NEMO     COM : OBLOIDS  COM : ORBCPM   COM
ENTER    COM : QUASAR   COM : F        COM : REV      COM
FORMAT   COM : SMG      COM : SMG2M    COM : STAR     COM
TURBO    COM : PIP      COM : RCHECK   COM : COPY     COM
CONFIG   COM

And copy in new files :-

# cpmcp -f memotech-type07 games.mfloppy-07 /work/ak/mtx/memu/games/TV.COM 0:

Sample images

MFLOPPY comes with some sample floppy disk images :-

Filename TypeSystem SizeComments
sys59.mfloppy-07 07 59K SDX CP/M System Master
sys54.mfloppy-07 07 54K SDX CP/M System Master
andy_sys.mfloppy-0707 59K Andys CP/M System Master, with NewWord, M80, L80, ZSID, VDEB

Typically on FDX, type 03 5.25" disks were used, with a 54K system size. On SDX type 03 or type 07 3.5" disks were used, with a 59K system size.

Credits

I credit the following, in no particular order...

Alain Knaff, the author of fdutils, and in particular, the description of how to identify an unknown disk, which I used to investigate some Memotech floppies.

Michael Haardt, the author of cpmtools, which are used to manipulate CP/M filesystems.

The authors of the CP/M boot ROM and CONFIG.COM for writing readable code.

Download

MFLOPPY can be downloaded from http://www.nyangau.org/mfloppy/mfloppy.zip.

Copying of this program is encouraged, as it is fully public domain. Even the source code is included in the package. It was created on the authors time and equipment. Caveat Emptor.

The author of MFLOPPY and this documentation is Andy Key (email andy.z.key@googlemail.com).

{{{ Andy