4.7 KiB
Building Cordle for DOS
Cordle is fully compatible with DOS systems using either DJGPP or Borland C compilers. The code is strictly C90 compliant and includes platform-specific conditional compilation.
Platform Support
Tested Environments
- MS-DOS 6.22
- FreeDOS 1.3
- DOSBox (with DJGPP)
- DOSBox-X
Compiler Options
Option 1: DJGPP (Recommended)
DJGPP is a complete 32-bit C/C++ development system for DOS, based on GCC.
Requirements:
- DJGPP 2.05 or later
- PDCurses library (DOS port)
- GNU Make
- Minimum 2MB RAM
Installation:
-
Download DJGPP from http://www.delorie.com/djgpp/
-
Required packages:
djdev205.zip(DJGPP development kit)gcc930b.zip(GNU C Compiler)bnu234b.zip(GNU Binutils)mak43b.zip(GNU Make)
-
Extract all to
C:\DJGPP -
Set environment variables in
AUTOEXEC.BAT:SET DJGPP=C:\DJGPP\DJGPP.ENV SET PATH=C:\DJGPP\BIN;%PATH%
Building PDCurses:
- Download PDCurses from https://pdcurses.org/
- Extract and build:
cd pdcurses\dos make -f Makefile.dj - Install:
copy pdcurses.a C:\DJGPP\LIB\libpdcurses.a copy curses.h C:\DJGPP\INCLUDE\ copy panel.h C:\DJGPP\INCLUDE\
Building Cordle:
cd \CORDLE
make
This creates CORDLE.EXE in the build directory.
Option 2: Borland C/C++ 3.1 or Turbo C++
Requirements:
- Borland C/C++ 3.1 or later
- PDCurses for DOS
- Minimum 640KB RAM
Manual Build:
bcc -mc -IC:\BC\INCLUDE -LC:\BC\LIB -std=c90 src\main.c src\game.c src\ui.c src\words.c -lpdcurses -ocordle.exe
Note: Borland uses slightly different command-line syntax. Adjust paths as needed.
File Paths in DOS Build
The DOS version automatically detects the platform and uses DOS-appropriate paths:
DOS Search Order:
wordlists\(relative to executable - for development)C:\CORDLE\wordlists\(system installation)- Custom path via
--wordlistargument
Unix Search Order:
wordlists/(relative to executable)/usr/local/share/cordle/wordlists/$HOME/.local/share/cordle/wordlists/- Custom path via
--wordlistargument
Installation on DOS
Directory Structure
C:\CORDLE\
├── CORDLE.EXE
└── wordlists\
├── CORDLE_WORDS_EASY.TXT
├── CORDLE_WORDS_MEDIUM.TXT
├── CORDLE_WORDS_HARD.TXT
└── ...
Quick Install
- Create directory:
mkdir C:\CORDLE - Copy
CORDLE.EXEtoC:\CORDLE - Copy
wordlistsdirectory toC:\CORDLE - Add to PATH in
AUTOEXEC.BAT:SET PATH=C:\CORDLE;%PATH%
Running on DOS
C:\> cordle
C:\> cordle --easy
C:\> cordle --medium
C:\> cordle --hard
C:\> cordle --help
Memory Requirements
- Minimum: 2MB RAM (DJGPP), 640KB (Borland)
- Recommended: 4MB RAM
- Display: VGA compatible (for colors)
- DOS Version: 5.0 or higher
Troubleshooting
"Out of memory" Error
- Increase DOS memory limit
- Use CWSDPMI.EXE memory extender (included with DJGPP)
- Free up conventional memory by unloading TSRs
"libpdcurses.a not found"
- Verify PDCurses installation
- Check library path:
C:\DJGPP\LIB\
"curses.h not found"
- Copy
curses.htoC:\DJGPP\INCLUDE\
Colors Not Working
- Ensure VGA-compatible display
- Try running in DOSBox with
machine=svga_s3
Arrow Keys Crash (Fixed in v1.1)
- Arrow keys are now properly handled and ignored
- Update to latest version if experiencing issues
Testing in DOSBox
A DOSBox configuration is included in the dosbox/ directory:
dosbox -conf dosbox/dosbox_config_cordle.ini
Platform Detection
The code automatically detects DOS vs Unix at compile time:
#if defined(__MSDOS__) || defined(_MSDOS) || defined(__DOS__) || defined(MSDOS)
/* DOS-specific code */
#else
/* Unix-specific code */
#endif
Differences from Unix Version
- Curses Library: PDCurses instead of ncurses
- Path Separators: Backslash (
\) instead of forward slash (/) - File Paths: DOS-style paths (
C:\CORDLE\wordlists\) - Executable:
.exeextension - No HOME Environment: Uses fixed system path instead
Source Code Portability
The code is 100% C90 compliant with:
- No C99/C11 features
- No GNU extensions
- Conditional compilation for platform differences
- Standard library only (stdio, stdlib, string, time, ctype)
- Platform-specific curses handling
For Modern Development
For testing DOS builds on modern systems:
- Use DOSBox-X (more accurate DOS emulation)
- Install DJGPP within DOSBox
- Use cross-compilation from Linux/macOS (advanced)
License Note
Ensure PDCurses license compatibility with your distribution. PDCurses is public domain.
For Unix/Linux/macOS build instructions, see the main README.md.