We are going to build a disk image from scratch, format it, install MSDOS 6.22, Windows 3.1, and eventually CIV 2. After this walk through, you will be able to understand how Aemula works and to create custom disk image for your own favorite game.

The session below takes about 1 hour for a DOS veteran. Playing with Aemula requires experience with command line tools. If you never use DOS before, it will take significantly longer for you to accomplish this task.

Before we start, you need to have the following files for this mission:

  1. MSDOS6.22 installation disk images (1,2,3);
  2. Windows 3.11 CD image;
  3. Civ2 CD image.

Create an empty disk image

A disk image is a file that contains all the data for a virtual disk. You must provide at least one disk image for Aemula before it starts.

Here we are going to create a raw disk image. The content in this file is unimportant, but the file size must be chosen carefully.

We are going to use a command line tool dd to make empty files. On linux or Mac OS X, you can use dd right in the terminal, but on Windows, you will need to download dd for Windows from http://www.chrysocome.net.

Create an empty floppy disk image

The smallest block in disk images is sector. A sector is 512 bytes. Sectors are organized in tracks, tracks in cyclinders.

For a 1.44MB floppy disk, there are 80 cyclinders, 2 tracks for each cyclinder, 18 sectors for each track, therefore 2880 sectors in total.

The following command creates an empty floppy disk image "sample.img":

dd if=/dev/zero of=sample.img bs=512 count=2880

Aemula also supports another floppy disk format, which has 21 sectors per track. The number of sectors in this disk is

3360 = 80 * 2* 21,

and the size is 1680KB. Win95 installation disks use this format. However you should not create disk images of this format.

Create an empty hard disk image

Hard disk format supported by Aemula is 63 sectors per track, 16 tracks per cyclinder. The number of sectors in a hard disk image of x MB is

n = x * 1024 * 2.

n must be a multiple of 1008 (sectors per cylinder = 63*16). To save your trouble, here is the table of common sizes:

 MB   |   Sectors
======+==========
  4   |     8,064
  8   |    16,128
 16   |    32,256
 32   |    65,520
 64   |   131,040
100   |   204,624
200   |   409,248
300   |   613,872
400   |   818,496
500   | 1,023,120

To create a hard disk image of 64MB:

dd if=/dev/zero of=test.img bs=512 count=131040

Now we have an disk image file test.img, which contains 131040 sectors, about 63.98MB. Remember that you can not create an exact 64MB image.

Formatting disk image

So far the disk images you've created are filled with zeros, there is no file system on it. You need to create a partition and format it.

First, get a DOS boot disk from bootdisk.com . Unzip the package, find the file 622C.IMG, and copy it to the aemula data directory (/sdcard/aemula on Android, /var/mobile/Documents on iOS). Of course, you also need to copy the empty hard disk test.img to the folder.

Make sure both the boot disk and hard disk image are selected via FD and HD button respectively. Then press Power button, Aemula will now boot from the floppy into

A:>

When you tried to switch to C:, it will show the following error

A:>c:
Invalid drive specification

That is right, because there is nothing on the disk. Next step we are going to create partition on the disk using FDISK command.

A:> fdisk

Just use the default options, and press enter all the way. After it is finished, Aemula will reboot. If it doesn't reboot, then you can press Power button once more, and choose to restart manually.

This time you can switch to c:, but it still shows an error:

Invalid media type reading drive C
Abort, Retry, Fail?

Now switch back to A:, and type

A:> format c:

During the process, it will ask for a volume label, just give it any name you like, in our case, "CIV2" sounds great. Press enter and now test.img is formated with a DOS readable file sytem.

In this guide, we are going to install DOS right away. You can also add files to it on your PC later. To open disk image on Mac OS X, it is a simple double click. On windows, you will need to install third party programs:

Install DOS 6.22

Copy the three disk images to aemula folder.

Select disk 1, and tap on power button. it should boot into the following screen:

Go with default settings. When you're prompted to switch disk, wait until the floppy busy indicator disappears, then tap floppy disk button, and select disk2.img from the disk list.

After the installation complete, make sure no floppy disk is selected, then tap the power button and restart.

Setting up CD driver.

Just use the files from 622c.img.

Copy the cd1.sys to C:\DOS

copy A:\CD1.SYS C:\DOS\CD1.SYS

Add the following line to CONFIG.SYS:

DEVICE=C:\DOS\CD1.SYS /D:tomato

Add the following line to AUTOEXEC.BAT:

C:\DOS\MSCDEX.EXE  /D:tomato /L:D

Install Windows 3.1

Windows 3.1 has a 8 disks edition. You can use them, but you have to switch the floppy disks a lot of times during installation. Remember wait until floppy drive is not busy.

A much simpler way is use CD edition (around 9MB). Make sure it is selected by tapping CD button. After boot into DOS, go to D:, and type "setup" at the command line.

The installation process is very straight forward. Just the default settings.

Now that you have windows running, the first thing you should do is to install sound blaster driver. Aemula implements a sound blaster 2.0. Here the closest we get is 1.5. The driver file is in the installation CD. When a dialog prompts you to provide the file position, you should select the CD drive.

When it asks for port and interrupt number, use the following values:

port     : 220
interrupt: 7

and then restart windows, you will hear a login sound this time.

Install CIV2

There are quite a lot of tools that can help you build an ISO image from a physical CD disc. The ISO image can be quite large, with size around 357MB, so you will need a little bit patience when copying it from PC to your device.

In Aemula, make sure civ2 image is selected, and then power on the machine. After you enter the windows 3.1, use file manager to open CD drive, find the file setup.exe, click it. Installation is simple, just follow the instructions on screen. At the end, it will try to install WinG and VFW. Without them, civ can not start at all.

After that windows will try to restart, and then you will see the civ icons.

Start the game, and adjust cpu to 10MIPS (at which aemula is equivalent to 80486DX 66MHz). The first time it will test graphics.

The start up is a little bit slow, as soon as you get in, it is fairly fast.

There are some optional features that need the CD around. However, you do not have to if space is tight.

In CIV 2, you need to use move a unit in eight directions. Arrow keys take care of four, and the rest are handled by the following keys:

page-up  : north east
page-down: south east
home     : north west
end      : south west

Please refer to the key binding guide.