Writing PC-98 Floppy Images Under Linux

3 minute read Published:

How to write d88 floppy images to actual floppies

I have a PC-9821 laptop computer. This is a Japanese system that’s almost-but-not-quite IBM compatible, with the biggest differences being the graphics and sound system. It’s an interesting system, with a few thousand games that never came out in the west in any way, including the first five Touhou Project games.

Generally, it’s not hard to find software for the system. There’s a huge set on archive.org which contains enough games for you to play until your death.

What is kind of hard is getting the software on there. These are DOS systems, with no support for USB. It is possible to configure networking, but it’s hard. Many people just take out the harddrives (usually CF drives these days) and copy the files over, but the necessary image reading software is only available for Windows, though it runs in Wine.

A somewhat natural way to install most games is to just write the floppy images to a real floppy and install from that. That is made a bit harder by two facts. First, most PC98 disk images aren’t naked images, but instead have headers or compression added. Second, the PC98 uses 2DD 1.2MB disks, while all the disks you have used recently are probably the 2HD 1.44MB disks that the IBM PC uses.

Luckily, it’s not hard to reformat disks to 1.2MB. You will need a usb drive that support this format. In older posts on the net, people say that pretty much all drives support it, but I bought one that didn’t. There’s a list of supported drives here. Mine is a Toshiba PA3109U-1FDD. Sadly, all of those drives are only available used these days. If you want to try your luck with a different drive, I’d suggest looking at the Amazon reviews of it. If people report it to be working with old keyboards or midi devices, it’s probably more likely that it will also support the 2DD format.

Once you have that, you can use a tool called ufiformat to format your floppy to the 2DD format. Here’s a mirror of the code. Just configure and make. You can then format the disk with a line like this:

sudo ./ufiformat /dev/sg1 -f 1232

To actually get a .d88 image on such a floppy disk, you’ll first have to make it into a flat image that you can just dd over. For that, you’ll need the tool d88split. Here’s a mirror for that. It consists of a collection of perl scripts that can convert between some old floppy image formats. While it should easily be possible to modify the scripts (or create a new one) that will produce a flat image directly from the d88, for now, we’ll have to convert it to a Mahalito file first. Here’s all the steps you need to get the final image you need:

# will produce first_output.2hd and first_output.dat
./d882mhlt.pl YOUR_DISK_IMAGE.D88 first_output
# will produce final_output.2hd and final_output.dat
./flatmhlt.pl first_output.2hd final_output

Now, you can finally dd the final image over to your disk.

sudo dd if=final_output.dat of=/dev/sdX bs=64K

And now you have a floppy disk you can use in your PC-98. Install a nice VN and enjoy with a drink of your choice.