This is an example of a setup for building an MS-DOS game in modern Linux/Mac/Windows with some automation in DOSBox. There's no actual game in this repo but this is a good starting template for a project.
- Install DOSBox
- Run
dist/FIREDUDE.EXE
inside DOSBox
This has only been tested on Linux; this should work on Mac if dosbox
is added to $PATH
.
- Download Turbo C 2.01
- Extract the Turbo C files into
tools/TC
, sotools/TC/TCC.EXE
is present - Download Turbo Assembler 5.0
- Extract
tasm/BIN/TASM.EXE
totools/TASM/TASM.EXE
- Install DOSBox
- Ensure
dosbox
is in your PATH - (Optional) Install EditorConfig plugin - most critically, the
.editorconfig
files enforce line endings in./src
.
./build.sh && ./run.sh
Turbo C uses an old C version and runs on DOS, so ensure that:
- All comments are block comments (
/* ... */
) - All source files (inside
src
) use Windows line endings (CRLF) - All variables are declared at the beginning of scope blocks
If you use inline assembly code, Turbo Assembler won't support the asm { ... }
syntax:
/* Doesn't work! */
void interrupt scan_keyboard(void)
{
asm {
cli
...
sti
}
}
Instead, use the asm
keyword on each line:
/* Works! */
void interrupt scan_keyboard(void)
{
asm cli
...
asm sti
}
Turbo C Version 2.01 Copyright (c) 1987, 1988 Borland International
Syntax is: TCC [ options ] file[s] * = default; -x- = turn switch x off
-1 80186/286 Instructions -A Disable non-ANSI extensions
-B Compile via assembly -C Allow nested comments
-Dxxx Define macro -Exxx Alternate assembler name
-G Generate for speed -Ixxx Include files directory
-K Default char is unsigned -Lxxx Libraries directory
-M Generate link map -N Check stack overflow
-O Optimize jumps -S Produce assembly output
-Uxxx Undefine macro -Z Optimize register usage
-a Generate word alignment -c Compile only
-d Merge duplicate strings -exxx Executable file name
-f * Floating point emulator -f87 8087 floating point
-gN Stop after N warnings -iN Maximum identifier length N
-jN Stop after N errors -k Standard stack frame
-lx Pass option x to linker -mc Compact Model
-mh Huge Model -ml Large Model
-mm Medium Model -ms * Small Model
-mt Tiny Model -nxxx Output file directory
-oxxx Object file name -p Pascal calls
-r * Register variables -u * Underscores on externs
-v Source level debugging -w Enable all warnings
-wxxx Enable warning xxx -w-xxx Disable warning xxx
-y Produce line number info -zxxx Set segment names
These are some excellent resources for MS-DOS development:
Author | Resource |
---|---|
Alex Russell | Alex Russell's Dos Game Programming in C for Beginners |
GameBub | C++ Graphics: MS-DOS Games |
David Brackeen | 256-Color VGA Programming in C |
Dr. William T. Verts | The VGA and 256 Colors |
Ben Lunt | DOS Programming, Undocumented DOS, and DOS Secrets |
Mark Feldman | Programming the Keyboard |
Author | Resource |
---|---|
Betelgeuse LLC | Turbo C Programming Using Turbo C++ Compiler |
Shreeharsha P. | Turbo C Graphics Programming |
Trim Tab | TASM 5 Intel 8086 Turbo Assembler Download |