Please enable JavaScript to display the menu.
FM TOWNS Resurrection Project
Writing 1.23MB Floppy Disk Image back to actual floppy disk in Windows 10.

ysflight.com

If you want to try what's described below, do it on your own risks.  I won't take any responsibilities for the consequences.

I did it to make sure to have a mean for creating a recovery floppy disk from a disk image for FM TOWNS, but NEC PC-98901 uses the same floppy-disk format.  The same method probably works for re-creating a bootable disk from a disk image for actual PC-9801.

If you are trying to restore Fujitsu FM TOWNS, and if the internal CD drive is already dead, and the backup battery of CMOS settings is already depleted, you are left with only one option to start the unit: booting from a bootable floppy disk.

If you have just acquired a vintage FM TOWNS computer, you may need to create a bootable floppy disk to start with.  It is quite easy to make a bootable floppy disk image using an FM TOWNS emulator called "UNZ".  But the problem is writing the disk image back to the actual floppy disk.

FM TOWNS (like PC 9801) can only boot from a 1.23MB floppy disk.  Let's call it FM TOWNS format.  Don't call it PC-9801 format.  FM TOWNS format disks were used only in Japan.  All other places in the world were using 1.44MB format.  If you use Linux you can easily write a 1.44MB disk image back to an actual floppy by using dd command.  But, a tool for writing 1.23MB disk image back to an actual floppy disk can be found nowhere.  It was a major obstacle to format a 2HD disk in 1.23MB FM TOWNS format and then write a disk image to it.

Lucky to me, I came across two web articles discussing the way to format a floppy disk in 1.23MB format in Windows 10.

https://freesoft.tvbok.com/pc9801/fdd_format_on_windows10.html

http://island.geocities.jp/cklouch//column/pc98bas/win8_3mode_fdd.htm

Actually the article says it fails in Windows 10 in the end.  But what's happening is the command successfully finishes physical formatting, but failing to construct a file allocation table and an empty directory structure.  It doesn't matter if I overwrite entire disk from a disk image.  The disk then becomes valid, and even can be made bootable for FM TOWNS.

Ideally I should be able to do so by typing a few commands in Windows 10.  If there is no such tool, I make it myself.  I wrote a program to write a 1.23MB disk image back to an actual floppy disk.

1.23MB Formatting

1st step is to format a floppy disk into 1.23MB format.  You need to do it in 32-bit version command mode.  Why?  Try from a regular 64-bit command prompt.  Format command doesn't take an option /f:1.23m .  Here is the summary of the steps taken from the above articles.

(1) Start a 32-bit version command mode by typing  C:\Windows\SysWOW64\cmd.exe  in the Start menu.

(2) Insert a floppy disk in drive A and type:

format A: /f:1.23m

My USB floppy disk drive cannot sense media change.  Well, kind of senses randomly.  So, I had to insert a media in the drive, and then plug its USB connector to my PC, but that was only glitch I had so far.

You will see "Failed" in the end.  But, that's fine.  Your floppy is formatted in 1.23MB format.  In the next step, you overwrite all the sectors anyway.

Writing a disk image back to the actual floppy disk

Once your floppy disk is physically formatted, you can transfer a disk image to the actual disk.  First download writeTownsFD.exe from here.  The archive includes an executable and source code.

Then start Admin Console by right clicking CMD and select "Run as Administrator".  Then copy writeTownsFD.exe and a disk image you want to write in the same location (doesn't have to be if you don't mind typing lengthy path name) and type like:

.\writeTownsFD.exe A diskimage.xdf

This program is only for 1.23MB physically-formatted floppy.  I haven't tested with other formats.  I don't know what's going to happen if you do it for 1.44MB, 720KB, or 640KB formatted disk.  Let me emphasize again, it needs to be done in the Admin Console.

If successful, the program will write 0 to 76 tracks and terminates.

Actually once you write a valid disk image, Windows 10 will allow you to read/write files to and from the disk.  Windows XP had a horrible habit of corrupting the floppy boot sector, but Windows 10 doesn't seem to do it.  Nonetheless, I think it is a good idea to take out the floppy disk after writing is done before opening in explorer and write-protect it.  You don't have to copy/delete/move files in 1.23MB floppy disk in Windows Explorer.  You can do it in the disk image with Disk Explorer before writing to disk.

You can, for example, start Towns OS V2.1 and select disk formatting tool and format a disk with "Install Boot Files" options on in the emulator.  Then you can get a bootable floppy image, which then can be written back to an actual floppy disk with this program.

I have confirmed that FM TOWNS 2MX could boot from an emergency boot disk created by this method.  I did it with my IBM USB floppy disk drive.

Technical

When I found there is a way to format a disk in 1.23MB format, I first tried to write-back an image with Win32DiskImager.  However, I could not select A drive as the destination.

Since source code of Win32DiskImager is open, I tried to read it to understand how it can be done.  I followed the way it was opening the drive, but it couldn't get a device ID.  Probably that's why I could not select A drive in Win32DiskImager.

To read raw sectors, I am supposed to open drive and then get device ID and then open a physical device with:

\\.\PHYSICALDRIVEx

where x is the device ID according to MSDN.  I can get this ID for hard drives and SD cards, but not for the USB floppy disk.

I found a command to list all PHYSICALDRIVEs in Stackoverflow:

wmic diskdrive list brief

then realized no PHYSICALDRIVEx is assigned to a USB floppy drive.  Microsoft doesn't seem to care about a floppy drive any more, which is understandable.  Only few people who are maintaining retro PCs for fun use a floppy drive.  Why do they have to care?  (Actually it gives a good reason to us to maintain at least one PC running older version Windows and Linux)

I wondered how Disk Explorer reads sectors.  There should be a way.

After further search, I finally found an information in CodeGuru.  Actually I didn't even need a device ID.  An example was reading sectors from a handle obtained by opening:

\\.\A:

If it can read, it should be able to write.  I tried, and I succeeded.

Actually, the code was extremely easy.  I include source files in the archive.  You can take a look if you are interested.  Since it is that easy, there may be another image-writing tool that can deal with 1.23MB floppy disk.  Simply nobody has tried.  But, to me after spending several hours of searching, I decided it would be quicker to do write my own.

I also tried if I could format, but for formatting I seem to need a device ID.  IOCTL_DISK_FORMAT_TRACKS_EX  didn't succeed.  If someone succeed in programatically formatting a floppy disk into 1.23MB format, it would be a great resource for retro-pc community.  For the time being, we rely on 32-bit format.com.

Comments are welcome.  Send E-Mail to: 

Back to http://www.ysflight.com