A vintage DOS calculator application written in C that provides basic arithmetic operations through a colorful windowed text interface. Features file operations, directory browsing, and string manipulation capabilities typical of classic DOS applications.
This calculator program provides:
- Basic arithmetic operations: Addition, subtraction, multiplication, and division
- String manipulation: Input and reverse strings with character analysis
- File operations: Save calculations and results to data files
- Directory browser: Navigate file system and manage data files
- Interactive interface: Color-coded windows with keyboard navigation
- Drive detection: Automatically detects available disk drives
- Error handling: Prevents division by zero and validates input
The program runs in a continuous loop, waiting for user input through keyboard commands and providing immediate visual feedback through its windowed interface.
C Compiler:
- Borland Turbo C/C++ for DOS (recommended versions 3.0-3.1)
- Borland C++ 3.1 or compatible DOS C compiler
Required Headers:
- Standard C libraries (stdio.h, string.h, math.h, ctype.h)
- DOS-specific headers (dos.h, dir.h, mem.h)
- Borland-specific console library (conio.h)
- DOSBox (recommended) - for modern systems
- FreeDOS or MS-DOS - on real hardware or VM
- Standard 80×25 text mode console
- At least 640KB conventional memory
- 16-bit DOS environment (real or emulated)
- VGA or compatible text display for colors
- Keyboard input support
- File system access for data storage
-
Prepare development environment:
C:\dos\ ├── bin\ (Turbo C compiler files: TC.EXE, TCC.EXE, etc.) ├── include\ (C header files) ├── lib\ (C library files) └── src\ (calculator.c source file) -
Launch DOSBox and mount:
mount c c:\dos c: set path=c:\bin
-
Compile the program:
cd \src tcc -ms -Ic:\include -Lc:\lib calculator.cThis creates
CALCULATOR.EXE -
Run the calculator:
calculator
Main Operations:
+- Addition-- Subtraction*- Multiplication/- Divisionm- String input modeHome- Information displayE- Exit program
File Browser:
Tab/Shift+Tab- Navigate between fieldsEnter- Confirm selectionEsc- Cancel operationArrow Keys- Navigate file/directory lists
When launched, the program will:
- Display a colorful windowed interface
- Show available operations in the status bar
- Wait for user input to perform calculations
- Automatically save results to data files
- Provide file browser for managing saved calculations
Build Issues:
- Ensure Turbo C include and library paths are correct
- Use small memory model (
-ms) for DOS compatibility - Verify all required headers are available
Runtime Issues:
- Colors not displaying: Use DOSBox with VGA text mode support
- File operations failing: Check write permissions and available disk space
- Keyboard input problems: Ensure DOSBox window has focus
DOSBox Configuration:
- Default settings work for most features
- Ensure
machine=svga_s3for proper text colors - No special CPU or memory configuration needed
Calculator Functions:
- Floating-point arithmetic with 7-digit precision
- Input validation and error checking
- Division by zero protection
File Management:
- Automatic result logging to .DAT files
- Directory browsing and navigation
- Drive detection and switching
- File deletion capabilities
User Interface:
- Color-coded windows and status bars
- Context-sensitive help text
- Keyboard-driven navigation
- Visual feedback for all operations
This program demonstrates:
- Classic DOS C programming techniques
- Borland-specific console functions (conio.h)
- File I/O operations in DOS
- Directory and drive management
- State machine programming patterns
- Text-mode user interface design
Perfect for learning about vintage DOS development, file system programming, and classic user interface design patterns.
Educational/demonstration code. Add appropriate license if redistributing.