ZX Microdrive .mdr file Cruncher


The script now works on MDR with a number of sectors less than 254, those produced by emulators such as Fuse.


I put "everything" in a Git Hub project. There is a brief Wiki page too


I've removed a big bug that sometime prevented data to be correctly displayed in the listing: I wasn't always using the first record of a file, producing a misleading listing.

Now it should be fine.


I've added another option "label" to allow changing the "label" of the cartridge. This option requires a complete re-writing of all sector-headers with the new name and correct checksum.

$> perl mdr.pl -l cart.mdr label=NEW_LABEL


Last year I've been in contact with Marcos Cruz and he gave me the idea to write a .mdr manipulator since that format is well known.

Within a few days I managed to code a Perl script that simply examines and manipulates anything within a .mdr file.

The script also is able to read or write .tap files, so it can be used as a good mdr-to-tap or tap-to-mdr utility.

With this script, you are able to :

  • get the catalog and all available info (starting address, length, start-line, used sectors, damaged or free sectors, etc. ).
  • copy, rename, erase a file within a cartridge.
  • remove "autorun" LINE from a program
  • put/get any file from/to a host file to/from a cartridge
  • port files to/from .tap from/to .mdr


$> perl mdr.pl -l cart.mdr noautorun=run
$> perl mdr.pl -l cart.mdr erase=run
$> perl mdr.pl -l cart.mdr rename=sys64 to=SYS64
$> perl mdr.pl -l cart.mdr -p tape=d:/zx/forth/vforth13.tap
$> perl mdr.pl -l cart.mdr put=[file1.txt,file2.txt] to=file1

Since it is a work-in-progress, any feedback is welcome.

The script accepts a "verbose" switch that can be used to completely dump the content of a cartridge. This feature is useful to verify the cartridge integrity of any sector. I used it to hack the checksum of bad-sectors to obtain a fully 254-sectors length cartridge: It is well known that in reality at least one sector is unusable due to the tape-juction and the peculiar way the ZX Microdrive FORMAT "M" command works.