MFM Emulator on the Commodore 900

These are my notes on using David Gesswein’s MFM emulator with the Commodore 900.  At present, I do not have it set up to use the emulator on a regular basis but I was able to use it to write out a good hard drive after I had cloned and fixed the original drive.

To read a hard drive and create an extract, emulation and transitions file in one shot:

Login as “debian:temppwd”
cd /opt/mfm/mfm
./setup_mfm_read
./mfm_read --analyze --retries 200,8 --extracted_data_file c900.extract --emulation_file c900.emu --transitions_file c900.tran

NOTE:  The analysis will give you information on your hard drive configuration.  Please make a note of these in case you need to specify some of these parameters for other commands.  I needed it for creating an emulator file from an extract.  It will look like this in the output of the mfm_read:

...
Command line to read disk:

--format Intel_iSBC_214_512B --sectors 17,0 --heads 4 --cylinders 612 
--header_crc 0xffff,0x1021,16,0 --data_crc 0xffffffff,0x140a0445,32,8 
--sector_length 512 --retries 50,4 --drive 1
...

To emulate with a Emulation file:

Login as “debian:temppwd”
cd /opt/mfm/emu
./setup_emu
./mfm_emu --drive 1 --file ../c900fixed.emu --quiet 0

To fix your image on the emulated computer (if you are able to via emulation)

  1. Use the emulated file to emulate the system.
  2. Fix the file system.
  3. Exit the emulator.
  4. Create a new extract file

cd /opt/mfm/mfm
./mfm_util --emulation_file ../c900.emu --extracted_data_file ../c900.extract

To fix your image via other binary tools and then recreate the emulator file:

cd /opt/mfm/mfm
./ext2emu --extracted_data_file c900.extract --emulation_file c900.emu --cylinders 612 --heads 4 --format Intel_iSBC_214_512B --quiet 0

 

Write out image file to a real hard drive:

Initial step:

You need to change the mfm_read-00C0.dts file to do any writing as it is set up for reading to begin with.  What I did was create a copy of the file for reading and a second copy of the modified file for writing and I copy to correct file when reading or writing.  I did this so I knew which file I was working with and when I write to a disk, I run the same procedure.

Do this once:

cd /opt/mfm/mfm
cp mfm_read-00C0.dts mfm_read-00C0.dts.read
cp mfm_read-00C0.dts mfm_read-00C0.dts.write

Modify the mfm_read_00C0.dts.write file:

Comment out this line (add the // to the beginning)

From:

0x190 0x07 // OUT P9_31 = gpio3_14

to

//0x190 0x07 // OUT P9_31 = gpio3_14

Uncommented this line from:

//0x190 0x2d // OUT P9_31 = pr1_pru0_pru_30_0

to

0x190 0x2d // OUT P9_31 = pr1_pru0_pru_30_0

With these two files, you can copy the read or the write file to mfm_read-00C0.dts depending on what you are doing.

To now write a file to a read hard drive:

cd /opt/mfm/mfm
cp mfm_read-00C0.dts.write mfm_read-00C0.dts
./setup_mfm_read
./mfm_write --emulation_file ../c900.emu --quiet 0 --drive 1
cp mfm_read-00C0.dts.read mfm_read-00C0.dts

A couple of notes:

  1. Whenever I try to write to a physical hard drive, my process hangs on the first attempt.  You need to ctrl-z the process and then use kill %1 to kill it.
  2. I write the “read” file back after I do my hard drive writes so I don’t forget and I shutdown the emulator.

shutdown now

or

halt -f

To copy a file from your MFM Emulator to a USB memory stick:

mount /mnt/usbp1

cd /mnt/usbp1

cp c900.emu /mnt
umount /mnt/usbp1

Leave a Reply

Your email address will not be published. Required fields are marked *