# QEMU/Windows 98

Have legacy software that can't run in Wine or on newer versions of Windows? If you have a Windows 98 installation disc, you can install the operating system to a QEMU virtual machine. The CD should be for generic systems. If you got your copy from an OEM (like HP or Dell), they may not have included drivers that QEMU may need.

## Virtual machine setup

If the CD included a boot floppy, you may need to use it; some CDs were not be designed to boot directly and only contain the materials needed to install the operating system. If you only have an unbootable CD, FreeDOS can be installed first in its place, and it can run the setup. You will want to rip your Windows 98 CD to an ISO image. Assuming it's been named win98.iso and placed in the same folder, it can then be ejected and stored back in its case.
You will need to create the image for the hard drive. This is where you'll install Windows to, and we'll be using QEMU's native qcow2 format. Common sizes are 512 MB (512M) and 1 GB (1G), but anything over 2 GB may prompt the setup to ask about large file system support, which you'll want to allow in that case.
Something interesting to note is that if your host system has enough memory to store the entire image in RAM, the installation and usage can be greatly sped up. On Windows, this can be done with ImDisk Virtual Disk Driver when mounting a raw image file and copying the image to the mounted drive.
If you have a bootable installation disc, the initial command to install Windows may look something like this:
Otherwise, a boot disk image can be presented to the VM as a floppy disk. The following options can be added to instruct the system to boot from it:
* -cdrom allows us to use the ISO image. It's also possible to use virsh to forward a physical drive to a file, but reading the data from the hard drive is usually faster.
* -boot allows us to specify the order to d, which is the CD, or a, which is the first floppy drive. once defines the boot order to use only the first time the system boots, where supported. menu=on enables manually choosing a boot device by pressing Escape.
* -drive allows us to use the hard drive image we just created.
* -enable-kvm turns on hardware acceleration in x86 using the kernel VM. KVM causes problems on Windows hosts when shutting down the guest and can even prevent it from starting in some cases. If this occurs, you can safely remove it from the command.
* -m allocates the guest's RAM. In this case we use 512, but going above it can be dangerous for Windows 9x.
* -device allows us to add a device driver, in this case, the Creative SoundBlaster 16 sound card (sb16) to get audio. Standard Windows 98 discs ship with drivers for it, and if you haven't used this flag while installing, it would need to scan for it.
* -display allows us to use an alternative display engine rather than GTK+. In this case, we use Simple DirectMedia Layer because it doesn't conflict as much with fullscreen support. You can press Ctrl+Alt+F to enter and exit fullscreen mode and Ctrl+Alt to have QEMU grab or ungrab the keyboard input and invoke the monitor as usual.
Once installation is complete you can boot without the CD, meaning the -cdrom, -boot, and boot disk flags can safely be removed.

## After installation
### Incomplete shutdown

SE may fail to shutdown properly before installing Q239887 update (004756us8.exe), degrading the filesystem.

### VBE 2.0 compliant-driver

Some programs require a higher color depth than the 16 colors provided by Windows 98 by default.
The default graphics card emulated by QEMU supports 32-bit color depth and resolutions through VBE 2.0, but Windows 98 does not provide drivers that support this.
A non-commercially licensed freeware driver can be used.

### DirectX

See this snapshot of a 2006 archive for DirectX downloads.

## External links

* A section from PandoraWiki's guide that covers Windows 98.