Skip to content

Memory, storage, input and networks ​

This page covers memory beyond 640 KB, CDs, joysticks and networks, and how to recognise each in a game's code.

Memory in DOS ​

A DOS program runs in real mode with 640 KB of conventional memory. Games used several ways to get more.

MethodWhat it isSigns in the codeIn the port
EMS (expanded memory)Pages of 16 KB mapped into a 64 KB window, through EMM386 or a cardINT 67h; the string EMMXXXX0Ordinary memory; keep any logic that depends on page numbers
XMS (extended memory)Memory above 1 MB, copied to and from conventional memory through HIMEM.SYSINT 2Fh with AX = 4310h to find the driver, then far callsOrdinary memory
OverlaysParts of the program loaded on demand into the same memoryBorland's .OVR files, or the game's own loaderOne program; but know which overlay is loaded at which time while you read addresses
DOS extenders32-bit protected mode with flat memory, with DOS calls passed to real modeDOS/4GW (Watcom, LE executables), PMODE/W, CWSDPMI (DJGPP), Phar LapSee DOS games for loaders and emulators
DPMIThe interface extenders use to ask for memory, selectors and interruptsINT 31hGameFrame's dos_env emulates the calls games use

Some games lowered detail or disabled sound when memory was short. Find the memory checks and fix their result in the port, so every run takes the same path.

Storage and CDs ​

  • Hard disk files are read with DOS calls (INT 21h) or the C runtime. GameFrame's fileio_trace.py turns a DOSBox-X log into a map of the reads.
  • CD audio: many games played music as Red Book audio tracks on the CD, through MSCDEX (INT 2Fh, AX = 15xxh) in DOS or MCI (mciSendCommand) in Windows. The music is then not in any file. The port needs the player's CD audio tracks ripped to files. Document how the player does that.
  • CD checks: a game checks for its disc by reading a file or a volume label. The port reads the player's files and does not need the check. Breaking copy protection is restricted in many countries (Your own copy and the law).
  • Streaming: some games read from the CD while playing (video, music, level data). The read times then affected the game's timing. A port reads from disk and need not reproduce delays unless the game logic depended on them.

Input devices ​

DeviceHow DOS games read itHow Windows games read it
KeyboardTheir own INT 9 handler reading port 60h; BIOS INT 16hWindow messages, DirectInput
MouseThe mouse driver, INT 33hWindow messages, DirectInput
Joystick (game port)Write to port 201h, then time how long each axis bit stays setWinMM joyGetPosEx, DirectInput
Gamepads (Gravis GamePad, Sidewinder)Through the game port, some with their own digital protocolsDirectInput

The game port is an analogue device read by timing. The count depends on the CPU's speed, so games calibrated the joystick at start-up. Port the result of the calibration, the position in the game's own range, as an input (Inputs).

Networks and multiplayer ​

MethodYearsSigns in the code
Serial cable (null modem)from the 1980sThe UART at port 3F8h or 2F8h; INT 14h
Modemfrom the 1980sSerial port code plus AT command strings (ATDT, ATZ)
IPX on a local network1993 to about 2000INT 7Ah or INT 2Fh with AX = 7A00h to find the IPX driver
NetBIOSearly 1990sINT 5Ch
DirectPlay1996 to about 2003dplayx.dll, IDirectPlay interfaces
TCP/IP (Winsock)from 1995wsock32.dll, ws2_32.dll

Multiplayer games of this time are usually lockstep: every computer runs the whole game and only commands travel (Strategy, Networking). The message format is the input record for multiplayer. Find it, together with the packet a game sends each turn.

  • A port can replace the transport (IPX, serial) with a modern one. The port must keep the messages and the turn timing if two copies of the port must play together. The same holds if the port must play with the original, which is rarely worth it.
  • Tools from the time (Kali, Kahn) tunnelled IPX over the internet. DOSBox can do the same, so you can run two copies of the original and capture their messages.

Code: Apache 2.0. Content: CC0 1.0. No game material: bring your own copy.