# 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:** 1. Download DJGPP from http://www.delorie.com/djgpp/ 2. Required packages: - `djdev205.zip` (DJGPP development kit) - `gcc930b.zip` (GNU C Compiler) - `bnu234b.zip` (GNU Binutils) - `mak43b.zip` (GNU Make) 3. Extract all to `C:\DJGPP` 4. Set environment variables in `AUTOEXEC.BAT`: ``` SET DJGPP=C:\DJGPP\DJGPP.ENV SET PATH=C:\DJGPP\BIN;%PATH% ``` **Building PDCurses:** 1. Download PDCurses from https://pdcurses.org/ 2. Extract and build: ``` cd pdcurses\dos make -f Makefile.dj ``` 3. 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:** 1. `wordlists\` (relative to executable - for development) 2. `C:\CORDLE\wordlists\` (system installation) 3. Custom path via `--wordlist` argument **Unix Search Order:** 1. `wordlists/` (relative to executable) 2. `/usr/local/share/cordle/wordlists/` 3. `$HOME/.local/share/cordle/wordlists/` 4. Custom path via `--wordlist` argument ## Installation on DOS ### Directory Structure ``` C:\CORDLE\ ├── CORDLE.EXE └── wordlists\ ├── CORDLE_WORDS_EASY.TXT ├── CORDLE_WORDS_MEDIUM.TXT ├── CORDLE_WORDS_HARD.TXT └── ... ``` ### Quick Install 1. Create directory: `mkdir C:\CORDLE` 2. Copy `CORDLE.EXE` to `C:\CORDLE` 3. Copy `wordlists` directory to `C:\CORDLE` 4. 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.h` to `C:\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: ```c #if defined(__MSDOS__) || defined(_MSDOS) || defined(__DOS__) || defined(MSDOS) /* DOS-specific code */ #else /* Unix-specific code */ #endif ``` ## Differences from Unix Version 1. **Curses Library:** PDCurses instead of ncurses 2. **Path Separators:** Backslash (`\`) instead of forward slash (`/`) 3. **File Paths:** DOS-style paths (`C:\CORDLE\wordlists\`) 4. **Executable:** `.exe` extension 5. **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: 1. Use DOSBox-X (more accurate DOS emulation) 2. Install DJGPP within DOSBox 3. 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.