blog · git · desktop · images · contact
2024-04-17
When I bought OS/2 Warp 4 (again β we threw away our box some ~20 years ago π) in 2020, the seller also included a PC DOS 7 box (which we also threw away back then π). Yay!
One of the first things I did was grab disk images from the floppies. Luckily, they all still worked. Now the thing about those floppies is that all but the first one use IBMβs XDF format, which allows you to put 1.8 MB on one disk, instead of the standard 1.44 MB. In the case of PC DOS 7, it saved about 1-2 floppies.
One βeasyβ way to create image files of those floppies is to boot OS/2
on real hardware, put in the floppies, and use xdfcopy
. I did it under
Warp 4, but Warp 3 should work as well. It can create a disk image by
doing something like xdfcopy a: pcdos7-disk-2.img
.
But of course, almost nothing else can read those disks these days.
Back on Linux, you can mount the resulting images just like any other image. But QEMU, for example, still cannot use them. (Or rather, when PC DOS runs in QEMU and you attach one of those images as a floppy drive, it just freezes.) I do, however, like having retro operating systems installed in QEMU as this allows me to easily launch them without having to put strain on my old hardware, like IDE drives, so getting PC DOS to work in QEMU was something that I had on my TODO list for a while now.
Hereβs how I managed to install it anyway. Itβs not a 100% clean way,
though. (If thereβs a better way, let me know, as long as it doesnβt
involve running some shady untrusted EXE
file from The Internet.)
I could have done the opposite of what I did for the previous blog post, but that would be boring, wouldnβt it?
Start with a clean disk image and boot from the first PC DOS floppy:
qemu-system-x86_64 -enable-kvm -cpu host -m 16 -smp 1 \
-rtc base=localtime \
-drive file=pcdos7.img,if=ide,format=raw \
-drive file=pc-dos-7-1.img,if=floppy,format=raw \
-boot a
Select all packages in the installer, so that we hopefully get as much data from the first floppy as possible (although Iβm not sure if that really matters). At some point, it wants you to insert disk 2:
This wonβt work. Instead, poweroff the VM. When you reboot the VM, you actually have a working installation already, thereβs just a bunch of programs missing. But it does boot. So the next step is to extract those programs from the remaining XDF disks.
The first PC DOS floppy includes a file called FILES.TXT
, which
appears to be a list of files that can be found on the floppies, an
excerpt follows. Theyβre stored in archives and the first floppy
includes the corresponding program UNPACK2
.
FILENAME BUNDLE DISK SIZE DIRECTORY DESCRIPTION
----------------------------------------------------------------------------------------------------
HERC.VID SHELL1 3 6656 \ DOSSHELL: Hercules-Videotreiber
VGA.VID SHELL1 3 6656 \ DOSSHELL: VGA-Videotreiber
EGA.VID SHELL1 3 6144 \ DOSSHELL: EGA-Videotreiber
CGA.VID SHELL1 3 6144 \ DOSSHELL: CGA-Videotreiber
...
As I said, the XDF images can be mounted on a Linux host, so we can do just that and grab all the files. I wrote the following shell script to do this.
#!/bin/sh
set -xe
mphdd=/tmp/fat-exchange-pcdos7-floppy-data.img.mp
mpfloppy=/tmp/floppy-mount
floppybase=/tmp/pcdosfloppies
fat-exchange make pcdos7-floppy-data
fat-exchange mount pcdos7-floppy-data
mkdir -p "$mpfloppy"
for i in 1 2 3 4 5
do
mkdir -p "$mphdd/$i"
sudo mount -o ro "$floppybase"/pc-dos-7-$i.img "$mpfloppy"
cp -v /tmp/floppy-mount/* "$mphdd/$i"
sudo umount "$mpfloppy"
done
(
echo '@echo off'
cat "$mphdd"/1/FILES.TXT | dos2unix |
while read -r filename pack disknum size subdir _
do
if [ "x$filename" = "xFILENAME" ] || test -z "$pack" || [ "x$pack" = "x-" ]
then
continue
fi
echo "a:\\unpack2 d:\\$disknum\\$pack c:\\dos$subdir /C /N:$filename"
done
) | unix2dos >"$mphdd"/inst.bat
# Debug only
cat "$mphdd"/inst.bat
tree "$mphdd"
fat-exchange umount pcdos7-floppy-data
fat-exchange
needs an explanation: Itβs a short script I wrote to help
me manage temporary disk images for exchanging data between my Linux
host and a VM. fat-exchange make
creates such an image and
fat-exchange mount
mounts it under $mphdd
.
The script then does two things: First, it copies all files from all floppies to the exchange drive. The result looks something like this:
/tmp/fat-exchange-pcdos7-floppy-data.img.mp
βββ 1
βΒ Β βββ ATTRIB.EXE
βΒ Β βββ AUTOEXEC.BAT
βΒ Β βββ BLISTLAY.OUT
βΒ Β βββ ...
βΒ Β βββ XDF.COM
βΒ Β βββ XDFCOPY.EXE
βββ 2
βΒ Β βββ DOS2
βΒ Β βββ DOS4
βΒ Β βββ PEN1
βΒ Β βββ SHELL2
βΒ Β βββ STAC1
βΒ Β βββ WUNDEL
βββ 3
βΒ Β βββ AV2
βΒ Β βββ BACKUP2
βΒ Β βββ SHELL1
βΒ Β βββ STAC3
βΒ Β βββ WBACKUP1
βββ 4
βΒ Β βββ DOS3
βΒ Β βββ PCM2
βΒ Β βββ PEN2
βΒ Β βββ PS1
βΒ Β βββ STAC2
βΒ Β βββ WBACKUP2
βββ 5
βΒ Β βββ AV1
βΒ Β βββ BACKUP1
βΒ Β βββ DOS1
βΒ Β βββ REXX
βΒ Β βββ WBACKUP3
Then, it creates inst.bat
. Thatβs a series of UNPACK2
commands based
on FILES.TXT
and it looks like this:
@echo off
a:\unpack2 d:\1\WGRP c:\dos\ /C /N:AVBKUD.GRP
a:\unpack2 d:\1\WGRP c:\dos\ /C /N:BKUD.GRP
...
a:\unpack2 d:\3\SHELL1 c:\dos\ /C /N:HERC.VID
a:\unpack2 d:\3\SHELL1 c:\dos\ /C /N:VGA.VID
...
a:\unpack2 d:\2\DOS4 c:\dos\SYSTEM\ /C /N:VIEW.OVL
a:\unpack2 d:\2\DOS4 c:\dos\SYSTEM\ /C /N:VIEW.LIB
...
a:\unpack2 d:\5\REXX c:\dos\ /C /N:REXX.EXE
a:\unpack2 d:\5\REXX c:\dos\ /C /N:RXWRSCR.RX
a:\unpack2 d:\5\REXX c:\dos\ /C /N:RXCLS.RX
a:\unpack2 d:\5\REXX c:\dos\ /C /N:RXQSYS.RX
a:\unpack2 d:\5\REXX c:\dos\ /C /N:RXSLEEP.RX
...
I can now boot the half-installed PC DOS VM and attach this newly
created disk image as D:
:
qemu-system-x86_64 -enable-kvm -cpu host -m 16 -smp 1 \
-rtc base=localtime \
-drive file=pcdos7.img,if=ide,format=raw \
-drive file=/tmp/fat-exchange-pcdos7-floppy-data.img,if=ide,media=disk,format=raw
Before I can launch inst.bat
, I have to insert the first floppy in
QEMU:
change floppy0 /tmp/pcdosfloppies/pc-dos-7-1.img raw
And now running d:\inst.bat
installs the missing programs.
Whatβs also missing, is CONFIG.SYS
and AUTOEXEC.BAT
. Possibly other
config files as well, but I havenβt noticed anything else yet. Luckily,
those arenβt hard to recreate or copy from another working installation.
I use the following.
CONFIG.SYS
:
FILES=30
BUFFERS=10
COUNTRY=049,850,C:\DOS\COUNTRY.SYS
DOS=HIGH
DEVICE=C:\DOS\HIMEM.SYS
DEVICE=C:\DOS\SETVER.EXE
DEVICE=C:\DOS\POWER.EXE
DEVICE=C:\DOS\DISPLAY.SYS CON=(,,1)
AUTOEXEC.BAT
:
@ECHO OFF
SET PATH=C:\DOS;%PATH%
SET TEMP=C:\DOS
C:\DOS\MODE.COM CON CP PREP=((850) C:\DOS\EGA.CPI)
C:\DOS\MODE.COM CON CP SEL=850
C:\DOS\KEYB.COM GR,,C:\DOS\KEYBOARD.SYS /ID:129
C:\DOS\MOUSE.COM
C:\DOS\DOSKEY.COM
The resulting installation now appears to be working just fine.
β Update 2024-04-18: Whatβs apparently missing is a setup step of DOSSHELL. If you want to use graphical mode, you have to copy the corresponding driver and config files, e.g.:
C:\DOS>copy VGA.GRB DOSSHELL.GRB
C:\DOS>copy VGA.VID DOSSHELL.VID
C:\DOS>copy VGA.INI DOSSHELL.INI
DOSSHELL.INI
already exists but only a rudimentary version of it. It
doesnβt contain program groups yet, nor color schemes.
After these steps, DOSSHELL can now be configured to like this (compare this with the screenshot above):