Skip to content

About

A classic DOS mode calculator program written in C

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

DOS Calculator Program

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.

What it does (high level)

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.

Requirements

Development Tools

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)

Runtime Environment

  • 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

System Requirements

  • 16-bit DOS environment (real or emulated)
  • VGA or compatible text display for colors
  • Keyboard input support
  • File system access for data storage

Quick Setup with DOSBox

  1. 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)
    
  2. Launch DOSBox and mount:

    mount c c:\dos
    c:
    set path=c:\bin
  3. Compile the program:

    cd \src
    tcc -ms -Ic:\include -Lc:\lib calculator.c

    This creates CALCULATOR.EXE

  4. Run the calculator:

    calculator

Program Controls

Main Operations:

  • + - Addition
  • - - Subtraction
  • * - Multiplication
  • / - Division
  • m - String input mode
  • Home - Information display
  • E - Exit program

File Browser:

  • Tab/Shift+Tab - Navigate between fields
  • Enter - Confirm selection
  • Esc - Cancel operation
  • Arrow Keys - Navigate file/directory lists

Expected Behavior

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

Troubleshooting

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_s3 for proper text colors
  • No special CPU or memory configuration needed

Features

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

Educational Value

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.

License

Educational/demonstration code. Add appropriate license if redistributing.

About

A classic DOS mode calculator program written in C

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages