1
0
Fork 0
mirror of https://github.com/dosbox-staging/dosbox-staging synced 2025-12-04 16:27:29 -05:00
12 Learning DOS programming
John Novak edited this page 2025-07-05 10:21:39 +10:00
This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Learning DOS programming

This page is a collection of tips and learning materials to get started with DOS programming. Finding good DOS-related materials can be tricky on the modern internet; as a general advice, look out for books, magazine articles, and tutorials usually distributed as plain-text files from the '80s and '90s.

Learning at least the fundamentals of DOS programming is not only useful for writing new DOS programs. If you want to troubleshoot, debug, or reverse engineer old DOS programs, you need to be able to read x86 assembly code and be familiar with the BIOS interrupts at the very minimum.

Once you're fluent in x86 assembly, the other big learning area is becoming familiar with the workings of various graphics and audio adapters at the register level. Most DOS games and demos program to the bare metal, without any driver or API between the DOS program and the hardware. In the '90s, various audio middleware started appearing that simplified this task at least on the audio front (e.g., the Miles Sound System), but graphics programming has 99.9% of the time been accomplished by hitting the VGA hardware directly at the lowest possible level.

Learning x86 assembly

Most modern x86 assembly learning materials are not relevant to DOS and are way more complicated than need to be. It's best to use assembly books and tutorials written before 2000.

While you're still a beginner, ignore protected mode completely and just focus on the 8086 stuff. After you've got the basics down, you'll only need to familiarise yourself with the more common 386 instructions and the extended 32-bit registers to understand real-mode programs.

The overwhelming majority of DOS programs only use 386 instruction set at most, and outside of scientific and engineering software and perhaps a few late DOS era flight simulators and Quake, the FPU is not used by DOS programs at all.

Suggested study plan for beginners

  1. One modern tutorial that is quite good—just ignore the 64-bit and protected mode parts: https://www.codeproject.com/articles/45788/the-real-protected-long-mode-assembly-tutorial-for

  2. Read the first two chapters of The 8086/8088 Primer. Free on the author's website: https://stevemorse.org/8086/index.html

  3. Read this very good x86 assembly tutorial: http://textfiles.com/programming/asmtutor.pro

  4. Optionally read chapter 3 of the The 8086/8088 Primer.

  5. Refer to the short instruction descriptions in Help-PC as you work on some assembly code. This guide contains opcodes descriptions and timings up to the 486. https://docs.huihoo.com/help-pc/

Video

Further learning materials