This project aims to be a template for the following:
- Setting up the tweaked VGA Mode 13 known as Mode X that allows for a 320x240 display with square pixels under DOS
- Routines for quickly blitting bitmap images from main memory to VRAM
- Smooth hardware scrolling across an infinite-sized map
- Open Watcom C/C++ Version 2.0 (Windows or Linux)
- DOS-based environment (MS-DOS, FreeDOS, DOSBox) to run the builds
- DOS/32 or DOS4GW 32-bit DOS extender
- Make a
.env
file in the root of the project by duplicating the.env-example
file - Point the paths in
.env
to those corresponding to your system (OpenWatcom, NASM, DOSBox, etc.) - Place a copy of your 32-bit DOS extender of choice (
dos32a.exe
ordos4gw.exe
) in the root directory of the project - Update the
DOS_EXTENDER
variable in the.env
file with your 32-bit DOS extender of choice accordingly (dos32a
ordos4gw
) - Run
make
to build
- Run
make run
to run the built program against the defined DOSBox install - To run directly in DOSBox, simply mount the
build
directory and runscroll
mount G /local/path/to/project/build
G:
- IBM Compatible PC running DOS (MS-DOS, FreeDOS, etc.)
- 32-bit x86 CPU (80386SX 40 MHz or better)
- 4MB RAM
- 16-bit ISA VGA video card (Tseng Labs ET4000AX or better)
- Keyboard
- 80486DX or Pentium CPU (66 MHz or better)
- 8MB RAM
- VESA Local Bus (VLB) or PCI VGA video card
If you have a USB to Serial adapter and Null Modem serial cable, you can use Kermit to easily transfer files between your development machine and your real DOS hardware.
- Ensure your DOS machine is powered down first before trying to connect the Null Modem serial cable to it
- Set up your USB to Serial adapter on your development machine
- Under Linux, you'll have to add yourself to the group that owns whatever device your adapter maps to before you can use the device as a non-root user
- NOTE: this procedure may vary depending on your distro
usermod -a -G dialout $USER
- Install Kermit on both your development machine anf your DOS machine
- Under Linux, you can simply install ckermit via
sudo apt-get install ckermit
- Under DOS, you can download it from here: http://www.columbia.edu/kermit/mskermit.html
- Under Linux, you can simply install ckermit via
- Update the
.env
file to point to your local serial port and set the transfer speed (bps)
SERIAL_PORT = /dev/ttyUSB0
SERIAL_SPEED = 115200
- Boot into your DOS machine and go into the directory where you want to put your build (e.g.
game.exe
) - On your development machine, initiate the file file transfer with
make send
- On your DOS machine, run the kermit command to receive the file
- NOTE: subsequent runs can omit the
set speed 115200
- NOTE: subsequent runs can omit the
kermit set speed 115200, rec game.exe
- Wait for the file to transfer
- This process should begin immediately, if not you may want to troubleshoot your serial connection or set a lower baud rate on both ends (e.g. 9600bps)
Alternatively, you can also set up DOSBox to use your serial port and kick off the file transfer from there.
serial1=directserial realport:ttyUSB0
kermit set speed 115200, send game.exe
A lot of this code is loosely based on several sources, most derived from Michael Abrash's works featured in Graphics Programming Black Book.
The following projects have been used as references:
- David Brackeen's 256-Color VGA Programming in C (http://www.brackeen.com/vga/)
- @mills32's Little Game Engine for VGA (https://github.com/mills32/Little-Game-Engine-for-VGA)
- @64Mega's Venture-Out! LD44 project (https://github.com/64Mega/ld44-venture-out)
- @root42's Let's Code MS-DOS series (https://github.com/root42/letscode-breakout)
All source code + files outside of the /res
folder adheres to the MIT License