Changing emu file metadata

Skip to first unread message

Sep 7, 2020, 7:07:26 PM9/7/20
to MFM Discuss
The other day I made the MFM emulator pretend to be a shiny new Maxtor XT1140. I did it by creating a new file full of zeros and then using mfm_util to turn it into an .emu file.

As it happens, the mfm_util program cannot create a new .emu file with the format that our computer requires. Fortunately, I have a utility disk with a low-level formatter. I simply created an .emu file in a different format, did a low-level format with the utility disk, and now the image is ready to go.

Everything is working great. I'm now wondering though if I can update the metadata in the .emu file so that it describes the new format and not the old. Right now the metadata says that the disk is:

--format WD_3B1
--heads 15 --cylinders 918 --sectors 17,0
--header_crc 0xffff,0x1021,16,0 --data_crc  0xffff,0x1021,16,0
--sector_length 512 --track_words 5209

But if you try to run mfm_util against the image, you get grievous errors since that information is out of date. What you need to tell mfm_util instead is

--format MacBottom
--heads 15 --cylinders 918 --sectors 18,0
--header_crc 0x0,0x1021,16,0 --data_crc 0x0,0xa00805,32,5

It looks like the metadata is just text at the top of the .emu file, and I could hack in the new parameters with a binary editor. That feels risky, though. Also, while I know that --sector_length 512 is correct, I'm not sure how to specify --track_words. Is there a right way to change this information?


David Gesswein

Sep 8, 2020, 9:43:43 AM9/8/20
Good to hear it is working well.

You can override with the command line. I have attached code that will copy
an emu file. You can modify it to change the decode_cmdline writen to the new
gcc -o copy_emu copy_emu.c obj/msg.o obj/emu_tran_file.o obj/crc_ecc.o -lm

You can also directly create an unformatted emulator file with
./mfm_emu --initialize --cyl # --head # --drive # --file file.

You can leave track_words off. The header of the emulator file provides
that information.
> --
> You received this message because you are subscribed to the Google Groups "MFM Discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
> To view this discussion on the web visit


Tom Stepleton

Sep 17, 2020, 8:15:43 PM9/17/20
Thanks, David, it seems this program (with modifications to decode_cmdline) has worked! I did have to remove the last argument from the call to emu_file_write_header, however. --Tom

Reply all
Reply to author
0 new messages