Compare commits

..

No commits in common. "95b14b93eb3e857afc15668a6a9fbb181af9a66e" and "f3e286e787da2a2f348e8952e39be287e56f84e9" have entirely different histories.

12 changed files with 733 additions and 0 deletions

202
DOS_BUILD.md Normal file
View File

@ -0,0 +1,202 @@
# 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.

View File

@ -0,0 +1,33 @@
@echo off
REM DOSBox Launcher for Cordle
REM Automatically starts DOSBox with correct configuration
echo ================================================
echo Starting DOSBox for Cordle Development
echo ================================================
echo.
REM Check if DOSBox is installed
where dosbox >nul 2>&1
if %errorlevel% neq 0 (
echo ERROR: DOSBox not found in PATH
echo.
echo Please install DOSBox from: https://www.dosbox.com/
echo Or specify the full path to dosbox.exe below
pause
exit /b 1
)
REM Check if config file exists
if not exist "dosbox-cordle.conf" (
echo ERROR: dosbox-cordle.conf not found
echo Please ensure the config file is in the current directory
pause
exit /b 1
)
echo Launching DOSBox...
echo.
dosbox -conf dosbox-cordle.conf
pause

124
dosbox/CordleDosMakefile.mk Normal file
View File

@ -0,0 +1,124 @@
# Makefile for Cordle - Cross-platform C90 Wordle Game
# Supports Unix/Linux/macOS and DOS (DJGPP)
#
# Usage:
# Unix/Linux/macOS: make
# DOS (DJGPP): make
# Clean: make clean
# Compiler
CC = gcc
# Compiler flags - strict C90 compliance
CFLAGS = -std=c90 -Wall -Wextra -pedantic -O2
# Source files
SRC = cordle.c
OBJ = cordle.o
# Platform detection and configuration
# Check for DOS/Windows environment
ifdef COMSPEC
# DOS/Windows detected
PLATFORM = DOS
TARGET = cordle.exe
CURSES_LIB = -lpdcurses
RM = del /Q
RMDIR = rmdir /S /Q
PATHSEP = \\
# DOS-specific flags
CFLAGS += -DMSDOS
else
ifdef ComSpec
# Alternative Windows detection
PLATFORM = DOS
TARGET = cordle.exe
CURSES_LIB = -lpdcurses
RM = del /Q
RMDIR = rmdir /S /Q
PATHSEP = \\
CFLAGS += -DMSDOS
else
# Unix/Linux/macOS
PLATFORM = UNIX
TARGET = cordle
CURSES_LIB = -lncurses
RM = rm -f
RMDIR = rm -rf
PATHSEP = /
endif
endif
# Additional libraries
LIBS = $(CURSES_LIB)
# Phony targets
.PHONY: all clean help info
# Default target
all: info $(TARGET)
# Display build information
info:
@echo ============================================
@echo Building Cordle for $(PLATFORM)
@echo Compiler: $(CC)
@echo Flags: $(CFLAGS)
@echo Libraries: $(LIBS)
@echo ============================================
@echo
# Build target
$(TARGET): $(SRC)
$(CC) $(CFLAGS) -o $(TARGET) $(SRC) $(LIBS)
@echo
@echo ============================================
@echo Build complete: $(TARGET)
@echo ============================================
@echo
@echo To run: ./$(TARGET) --help
@echo
# Object file (alternative build method)
$(OBJ): $(SRC)
$(CC) $(CFLAGS) -c $(SRC)
# Clean build artifacts
clean:
@echo Cleaning build artifacts...
$(RM) $(TARGET) $(OBJ)
@echo Clean complete.
# Help target
help:
@echo Cordle Makefile - Build Instructions
@echo =====================================
@echo
@echo Targets:
@echo make - Build the game
@echo make clean - Remove build artifacts
@echo make help - Show this help message
@echo make info - Show build configuration
@echo
@echo Platform Detection:
@echo Current: $(PLATFORM)
@echo
@echo DOS/DJGPP Requirements:
@echo - DJGPP compiler installed
@echo - PDCurses library installed
@echo - Make utility available
@echo
@echo Unix/Linux/macOS Requirements:
@echo - GCC compiler
@echo - ncurses library
@echo - Make utility
@echo
@echo Game Options:
@echo ./$(TARGET) --easy Easy difficulty
@echo ./$(TARGET) --medium Medium difficulty
@echo ./$(TARGET) --hard Hard difficulty
@echo ./$(TARGET) --techy Technical words
@echo ./$(TARGET) --literary Literary words
@echo ./$(TARGET) --cultural Cultural words
@echo ./$(TARGET) --full Full dictionary
@echo ./$(TARGET) --help Show game help

View File

@ -0,0 +1,12 @@
# DOSBox Setup for Cordle Development
## Quick Start
### 1. Install DOSBox
**Windows:**
- Download from: https://www.dosbox.com/download.php?main=1
- Install using the installer
- Or use Chocolatey: `choco install dosbox`
**macOS:**

View File

@ -0,0 +1,30 @@
#!/bin/bash
# DOSBox Launcher for Cordle
# Automatically starts DOSBox with correct configuration
echo "================================================"
echo "Starting DOSBox for Cordle Development"
echo "================================================"
echo
# Check if DOSBox is installed
if ! command -v dosbox &> /dev/null; then
echo "ERROR: DOSBox not found"
echo
echo "Install DOSBox:"
echo " macOS: brew install dosbox"
echo " Linux: sudo apt-get install dosbox"
echo " or sudo yum install dosbox"
exit 1
fi
# Check if config file exists
if [ ! -f "dosbox-cordle.conf" ]; then
echo "ERROR: dosbox-cordle.conf not found"
echo "Please ensure the config file is in the current directory"
exit 1
fi
echo "Launching DOSBox..."
echo
dosbox -conf dosbox-cordle.conf

View File

@ -0,0 +1,129 @@
================================================================================
CORDLE - DOS BUILD INSTRUCTIONS
================================================================================
Building Cordle on DOS requires DJGPP (DJ Delorie's GCC Port) and PDCurses.
================================================================================
1. INSTALL DJGPP
================================================================================
Download and install 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)
- fil41b.zip (GNU File utilities)
Unzip all packages to C:\DJGPP
Set environment variables in AUTOEXEC.BAT:
SET DJGPP=C:\DJGPP\DJGPP.ENV
SET PATH=C:\DJGPP\BIN;%PATH%
================================================================================
2. INSTALL PDCURSES
================================================================================
Download PDCurses from: https://pdcurses.org/
Build PDCurses for DOS:
cd pdcurses\dos
make -f Makefile.dj
Copy files:
copy pdcurses.a C:\DJGPP\LIB\libpdcurses.a
copy curses.h C:\DJGPP\INCLUDE\
copy panel.h C:\DJGPP\INCLUDE\
================================================================================
3. BUILD CORDLE
================================================================================
Copy the Cordle source files to your DOS system:
- cordle.c
- Makefile
- wordlists\ directory (with all word list files)
Build the game:
cd \CORDLE
make
This will create CORDLE.EXE
================================================================================
4. RUN THE GAME
================================================================================
Run with default settings:
cordle
Run with specific difficulty:
cordle --easy
cordle --medium
cordle --hard
Show help:
cordle --help
================================================================================
5. MEMORY REQUIREMENTS
================================================================================
Minimum:
- 2 MB RAM
- VGA compatible display (for colors)
- DOS 5.0 or higher
Recommended:
- 4 MB RAM
- 80x25 text mode or larger
================================================================================
6. TROUBLESHOOTING
================================================================================
Error: "Out of memory"
- Increase DOS memory limit
- Try using CWSDPMI.EXE memory extender
Error: "libpdcurses.a not found"
- Ensure PDCurses is properly installed
- Check library path: C:\DJGPP\LIB\
Error: "curses.h not found"
- Copy curses.h to C:\DJGPP\INCLUDE\
Colors not working:
- Ensure display supports VGA colors
- Try different terminal emulator
================================================================================
7. TESTING
================================================================================
Tested on:
- MS-DOS 6.22
- FreeDOS 1.3
- DOSBox (with DJGPP)
- DOSBox-X
================================================================================
8. FILE STRUCTURE
================================================================================
Required files:
CORDLE.EXE Main executable
WORDLISTS\ Word list directory
PYRDLE_WORDS_EASY.TXT
PYRDLE_WORDS_MEDIUM.TXT
PYRDLE_WORDS_HARD.TXT
(... other word lists ...)
================================================================================
For modern systems, use CMake build instead (see README.md)
================================================================================

View File

@ -0,0 +1,117 @@
# DOSBox Configuration File for Cordle
# =====================================
# This configuration is optimized for running and developing Cordle
#
# Usage: dosbox -conf dosbox-cordle.conf
[sdl]
# Display settings
fullscreen=false
fulldouble=false
fullresolution=original
windowresolution=original
output=opengl
autolock=true
[dosbox]
# DOSBox machine settings
machine=svga_s3
captures=capture
memsize=16
[render]
# Rendering and aspect ratio
frameskip=0
aspect=true
scaler=normal2x
[cpu]
# CPU settings - adjust if game runs too fast/slow
core=auto
cputype=auto
cycles=max
cycleup=10
cycledown=20
[mixer]
# Sound settings (not used by Cordle, but included for completeness)
nosound=false
rate=44100
blocksize=1024
prebuffer=25
[midi]
mpu401=intelligent
mididevice=default
midiconfig=
[sblaster]
sbtype=sb16
sbbase=220
irq=7
dma=1
hdma=5
sbmixer=true
oplmode=auto
oplemu=default
oplrate=44100
[gus]
gus=false
[speaker]
pcspeaker=true
pcrate=44100
tandy=auto
tandyrate=44100
disney=true
[joystick]
joysticktype=auto
[serial]
serial1=dummy
serial2=dummy
serial3=disabled
serial4=disabled
[dos]
# DOS settings
xms=true
ems=true
umb=true
keyboardlayout=auto
[ipx]
ipx=false
[autoexec]
# Auto-execute commands on DOSBox startup
@echo off
echo.
echo ===============================================
echo DOSBOX CONFIGURED FOR CORDLE DEVELOPMENT
echo ===============================================
echo.
# Mount the Cordle directory
# CHANGE THIS PATH TO YOUR ACTUAL CORDLE DIRECTORY
mount c: .
c:
# Set DJGPP environment if needed
# Uncomment and adjust paths if DJGPP is installed
# SET DJGPP=C:\DJGPP\DJGPP.ENV
# SET PATH=C:\DJGPP\BIN;%PATH%
echo Current directory mounted as C:
echo.
echo Available commands:
echo dir - List files
echo cd cordle - Change to cordle directory
echo make - Build the game
echo cordle --help - Show game help
echo cordle --easy - Play easy mode
echo exit - Exit DOSBox
echo.
echo ===============================================

View File

@ -0,0 +1,86 @@
# DOSBox-X Configuration for Cordle
# ==================================
# DOSBox-X provides better DOS compatibility and development features
# Download from: https://dosbox-x.com/
[sdl]
fullscreen=false
fulldouble=false
fullresolution=0x0
windowresolution=1024x768
output=opengl
autolock=true
sensitivity=100
waitonerror=true
priority=higher,normal
mapperfile=mapper-cordle.map
usescancodes=true
[dosbox]
language=
machine=svga_s3
captures=capture
memsize=32
startup_verbosity=high
[render]
frameskip=0
aspect=true
scaler=normal3x
glshader=default
[cpu]
core=auto
cputype=pentium_slow
cycles=max
cycleup=10
cycledown=20
[mixer]
nosound=false
rate=44100
blocksize=1024
prebuffer=25
[midi]
mpu401=intelligent
mididevice=default
[dos]
xms=true
ems=true
umb=true
ver=7.1
keyboardlayout=auto
[files]
nocachedir=false
[autoexec]
@echo off
cls
echo.
echo ===============================================
echo CORDLE - DOS DEVELOPMENT ENVIRONMENT
echo (DOSBox-X Enhanced)
echo ===============================================
echo.
# Mount current directory
mount c: .
c:
# Enhanced prompt
prompt $P$G
# Display useful info
echo DOSBox-X Version with enhanced DOS support
echo Memory: 32 MB configured
echo Display: SVGA S3 emulation
echo.
echo Quick Start:
echo make Build Cordle
echo cordle.exe Run the game
echo edit cordle.c Edit source (if edit is available)
echo.
echo ===============================================

BIN
game.o Normal file

Binary file not shown.

BIN
main.o Normal file

Binary file not shown.

BIN
ui.o Normal file

Binary file not shown.

BIN
words.o Normal file

Binary file not shown.