Learning DOS Assembly

Reason For Learning DOS Assembly

To program games of course. Developing a 8-bit game for the original 8088 (even though it’s technically a 16-bit processor) is similar to developing a game for other 8-bit computers from the era. The original IBM PC and XT are much cooler systems then I originally thought.

I think mostly they’re cool once you use an Adlib card with them. The sound of the Adlib is nostalgic for me, though not as nostalgic as the Sound Blaster. Either way the cool midi sounds of the Adlib and even the bleeps and boops of the PC speaker in games like Commander Keen and Duke Nukem is a great trip back to the mid to late 80s.

When The 8-Bit Guy came out with Planet X3 it seems totally achievable to learn 8088 assembly myself. Putting out a new CGA game that plays great and looks cool would be TOPS!

Also, learning about how John Carmack developed the original Commander Keen’s scrolling is very interesting to learn.

My thought is to develop a game using Keen’s scrolling, the jump/run physics of Super Mario Bros, and CGA graphics… we’ll have to see how things turn out.

Learning DOS Assembly in 2021

It feels that learning assembly for DOS is the easiest it’s ever been. I could be wrong… I wasn’t learning to code back in the 80s.


With the increase in popularity of developing new games for platforms like the C64, NES, etc books covering the 6502 and C64 have gotten pretty expensive. Seems as if they sometimes cost more then they did new. That’s totally a good thing in my opinion. It means people still care about these platforms and are willing to collect original books and software from back in the day.

On the bright side almost all of the great books from the era are available in PDF, ePub, etc on sites like archive.org where you can check them out for a two week period for free. Also, with a little searching you can usually find a copy to keep.

This is totally fantastic and I love reading about retro computers from authors who wrote about them when they were new. The good thing about learning DOS assembly is that the books are still very reasonably priced. For $5-20 you can buy multiple books to cover everything needed to get started and a whole lot more.

Another awesome thing is the new books that are being written about retro computers/consoles by people who either programmed for them back in the day or have learned to program them more recently. Some great examples are Derek Morris’ Retro Game Dev books and the Learn Multiplatform Assembly Programming with ChibiAkumas!.

I’m sure there are other new books that have come out, or are coming out that teach programming for retro systems, but those are two that I have and read through (well read parts of).

Just a few DOS programming books I've collected recently.


On top of great books about programming DOS there are some awesome channels on YouTube with very knowledgeable people developing new games, fixing bugs with old games, and even reverse engineering old games to learn how they work. Some of my favorites include

There’s a whole lot more, but these are great resources for developing for a wide array of retro computers and consoles. Also, many of these channels have a Patreon community where you can get access to chat servers, forums, early content, etc for a small amount. I subscribe to a couple of channels doing retro content and have learned a lot about both electronics and game development.

VM on Linux Setup

To make this post more than just my views and opinions I’ll walk through my “modern” development environment for working on DOS games in 2021.

For testing on actual retro hardware the Open Source FreeDOS operating system is TOPS! It works great for running old DOS programs and has high compatibility with call kinds of applications. While you can download old versions of assemblers, editors, and other needed utilities there are a whole bunch of Open Source/Free Software versions included with FreeDOS. And the FreeDOS community is really great and friendly.

Developing on an actual Pentium III or 486 is great, but using a modern computer running Linux is also great.

I’ve worked through a couple of assembly books using a Qemu VM running FreeDOS. Another advantage of using a Qemu VM and FreeDOS is the ability to easily install software from floppy images, then copy the directory to real hardware running FreeDOS and using an FTP client/server.

Installing FreeDOS in a Qemu VM

This guide assumes you are using a Linux desktop like Ubuntu, Debian, etc. The commands will be similar on Mac and Windows, but path names may be different.

The first step in setting up FreeDOS in a Qemu VM is to create a hard disk image:

qemu-img create test.hd 2048M

This will create a 2G hard disk image, adjust the 2048M option to a larger or smaller size if you prefer.

Next, download the FreeDOS ISO. With that ready execute:

qemu-system-i386 -hda test.hd -m 64 -cdrom FD13LIVE.ISO 

This will boot the VM from the ISO. Follow the install process the same as normal and at the end you’ll have a nice shiny FreeDOS VM ready to go.

To transfer files to and from the host system without networking and the VM shutdown you can do the following:

sudo modprobe nbd
sudo qemu-nbd -c /dev/nbd0 --read-only test.hd
udisksctl mount -b /dev/nbd0p1

Note: change /var/dos/msdos.disk to the path to your VMs hard drive image file.

On Ubuntu the udisksctl command will mount the VMs hard drive in /media/$USER/$DISKLABEL.

Migrating to DOSBox

Using Vim and other DOS editors inside a Qemu VM is great, but I am very used to using a Linux desktop for development and miss opening more than one application at a time.

To that end, I’ve recently migrated my development environment to DOSBox executing specific binaries compiled with UASM. I guess at some point there was a Linux version of UASM (based on the links on their site), but it may no longer be supported. Not a huge problem because from my testing UASM works fine under WINE.

Here’s my directory layout:

  • src – source assembly files
  • bin – compiled binary files
  • compile.sh – shell script to handle all the UASM options
# Compile a DOS program using UASM and Wine.

wine uasm/uasm64.exe -mz -Fl"lst/$1.lst" -Fo "bin/$1.exe" src/$1.asm

Using compile.sh just tell it the name of the program to compile:

compile.sh test

And next thing you know you’ll have a bin/test.exe compiled from src/test.asm.

I haven’t fully automated compiling and running the program in DOSBox, but it’s a pretty simple matter of configuring DOSBox to mount the project directory in C:\ then running bin\test.exe or whatever the name of your program is.

To automatically mound the folder edit ~/.dosbox/dosbox.conf and add the following in the [autoexec] section:

mount c: /home/adam/work/uasm_learning

Change the directory to your project folder and enjoy.


Well anyway that’s the way I’m making the donuts, so we’ll see how far get. Either way I expect it’ll be a fun time to learn more about assembly, Intel processors, and game development.

Party on!