I wrote these programs and utilities, when I was a teenager in the 90s, for MS-DOS 5.0 and MS-DOS 6.22 etc. I used Turbo C and later Turbo C++. I'll port each program to Open Watcom C/C++ 2.0, add comments, maybe refactor code, and add a Makefile. After testing programs in FreeDOS or DOSBox, I'll add it here.
| Project | Name | Notes |
|---|---|---|
| EvenOdd | Even or Odd Number | Prints out whether a number is an even number or an odd number. |
| RandNum | Random Number Generator | Prints out a random number. |
| PrimeNum | Naive Prime Number Finder | A very naive method to determine whether a number is a prime number or not. |
| CelsFahr | Celsius and Fahrenheit Converter | Celsius to Fahrenheit converter and vice versa. |
| DistConv | Mile and Kilometer Converter | Mile to Kilometer converter and vice versa. |
| StpWatch | Stopwatch | A simple stopwatch. |
| StpWtch2 📷 | Stopwatch v2 | A simple stopwatch but the elapsed time is displayed while the stopwatch is running. |
| GuessNum 📷 | Guess Number Game | A simple Guess the Number game. |
| Today 📷 | Current Date and Time | Displays current date and time in Pakistani-British style. Before we started using Windows 95, this was the last program to execute in the AUTOEXEC.BAT file. |
| Weekday 📷 | Calculate Weekday from Date | Displays weekday of the given date. We used it during planning events etc, to check the weekday of any future date. |
| BismKey | Bismillah with key wait | Displays text-based Bimillah calligraphy, and wait for the user to press any key to exit. |
| Bism 📷 | Bismillah with timer | Displays text-based Bimillah calligraphy, and wait for timer or any key to exit. The default timer is 3 seconds, but a new timer can be supplied through command-line arguments. For example, BISM.EXE 0.5 for half a second timer. In the old days, before adopting Windows 95, this was executed as the second-last program in AUTOEXEC.BAT, before TODAY.EXE was executed. |
| Allah 📷 | Name of Allah | Displays text-based name of Allah calligraphy, with sparkles in background. |
| AsciiChr | ASCII Character-set | Display Extended ASCII Character-set, from character 0 to character 255. |
| AsciiTbl 📷 | ASCII Character-set Table | Display Extended ASCII Character-set in a tabular format in 16 columns, from character 0 to character 255. |
| SortNum | Sort Numbers Array | Sorts an array of integer numbers using QSORT() function. |
| SortStr | Sort Strings Array | Sorts an array of strings using QSORT() function. |
| NoiseClr 📷 | TV Color Noise | Inspired from old school CRT TV White-Noise/Snow. I was very intrigued by TV's White Noise so I tried to replicate it. |
| NoiseBw 📷 | TV Black & White Noise | Inspired from old school CRT TV White-Noise/Snow. Instead of the colored version (as mentioned above), I tried black, white, and gray-scale colors to mimic the TV's white-noise. |
| TicTacTo 📷 | Text-based Tic Tac Toe Game | Text-based Tic Tac Toe. It allows playing human vs human, and human vs computer games. It was from my early teen years, therefore, instead of using the minimax algorithm, I just brute-forced most of the move combinations for computer play. |
| PhoneDb 📷 | Telephone Directory Database | Telephone directory with rudimentary struct based database (binary) file. User can add, edit, and delete records. User can also search records using ID number, name, telephone, address, and notes. To view details of a record, use search by ID to view full record data. If I recall correctly, it was used to store about 40 or 50 records. I was writing an upgraded version in C++ with a better UI, before abandoning the project and writing it in FoxPro for DOS. |
| Clock24h 📷 | 24 Hours Digital Clock | Displays 24-hours digital clock in HH:MM:SS format in large font (using # as base character). |
| Clck24h2 📷 | Enhanced 24 Hours Digital Clock | Displays 24-hours digital clock in HH:MM:SS format in large font (using extended ASCII characters). The separators : blinks with each second. It was the most used version among digital clocks that I wrote. Imagine a world where there were no mobile phones, only wristwatches and wall clocks to tell the time. When getting away from the computer, I would run this program to display the clock on the monitor screen, so that anyone can view the current time from a distance. |
| Clk24hXl 📷 | Extra Large 24 Hours Digital Clock | Displays 24-hours digital clock in HH:MM format in extra-large font (using extended ASCII characters). The separator : blinks with each second. |
This was the last program to run in AUTOEXEC.BAT (before migrating to Windows 95). The AUTOEXEC.BAT structure would be as following:
@ECHO OFF
REM ...settings, programs, drivers, and utilities...
BISM.EXE
CLS
TODAY.EXEThere was a version of this program without my name on it, which I compiled as a Tiny memory model (.COM file). I built it for my dad's office computer. Soon it was circulating in many offices and businesses' computers in Islamabad. On our home computer, this was the second-last program to run in AUTOEXEC.BAT before migrating to Windows 95.
Note
I couldn't find the gettext() function (Turbo C's CONIO.H) or similar function in Open Watcom C/C++. Therefore, I rewrite that piece of code by directly accessing memory of Text-mode screen memory. However, I tried to keep the vibe of the original code.
Main Menu
Gameplay of Human vs Human
Gameplay of Human vs Computer
Menu
Add Record
Edit Record
Delete Record
Search by Name
Database Information
Turbo C/C++ is no longer maintained. I searched for a FOSS C/C++ compiler which is still in active development, and can produce 16-bit x86 real-mode executables.
DGJPP is a really good project and I acknowledge the efforts to bring modern versions of GCC to DOS. However, it produces 32-bit DOS executable files, targeting Intel 80386 or later processors.
The Open Watcom C/C++ is close enough to Turbo C/C++. There are some differences in libraries, and some functions are missing, however, I was able to work around the obstacles. Though, I had to refactor and rewrite code during the porting process. However, I am glad that I put in the effort. Now anyone can compile and produce executable files which can still work in DOS on Intel 80286 (and earlier processors). If anyone wishes then they can extend functionality using later versions of C (specifically C99, or perhaps in future, newer versions of C).
Note: Even in my teen years, I had admiration for Watcom C/C++; when in the 90s, I learned that one of my favorite games, DOOM, was written using it.
- Install FreeDOS or DOSBox
- Install Open Watcom v2.0 (GitHub repository)
- Clone this repository
- Change directory into any project, for example
CD dos_c\today, then run:make. For release executable, run:make release
Tip
I recommend using FreeDOS or DOSBox. However, you can also use MS-DOS 5.0 or MS-DOS 6.22 (or later), though I didn't test it.
Download Open Watcom v2.0 (or later) from https://openwatcom.org official website, or from https://github.com/open-watcom/open-watcom-v2 official GitHub repository. Most likely the projects will compile with Open Watcom v1.9, however, it is not tested as I used v2.0 for compiling and testing.
-
Open Watcom C/C++16 Compile and Link Utility (
WCL.EXE): I used theWCLfor simple compilation in theMakefile. I used v2.0 Beta 1 ofWCL. -
Open Watcom Make (
WMAKE.EXE): I used theWMakeutility for theMakefile. I wrote a simpleMAKE.BATfile because I have a habit of writingmakeinstead ofwmake. I used v2.0 Beta 1 ofWMake. -
Open Watcom Debugger (
WD.EXE): I used v2.0 Beta 1 of theWDfor debugging.
Caution
If you want to use Visual Studio Code (or any other modern editor) to modify any source file then I'll recommend changing the encoding of (reopening and saving) that source file to DOS CP-437. Especially when the source code is using extended ASCII characters.
Tip
In the Visual Studio Code, click on the UTF-8 (or similar current file encoding) in the lower-right corner of the status bar to change the reopening and saving encoding of the currently opened file.
Each project directory has its own Makefile in it. Run MAKE.BAT to run WMake (or directly run WMake) to build the targets in the Makefile.
In a project's directory, the source files and header files are in the SRC sub-directory.
In a project's directory, run command make to build a debuggable executable file using the Makefile. The executable file will be in the BUILD sub-directory.
In a project's directory, run command make run to run the executable file. If the executable file doesn't exist then the Make utility will try to first build the executable and then run it.
In a project's directory, run command make debug to launch the executable file in the Watcom Debugger. If the executable file doesn't exist then the Make utility will try to first build the executable before launching Watcom Debugger.
Note
You can debug a release version of the executable. However, debuggable executable will be much easier, as it will include source code and other information, which will help to add proper breakpoints and watches.
In a project's directory, run command make strip to run WSTRIP.EXE on the executable file. It will strip away debuggable and unnecessary information from the executable file (for example from the debuggable executable file. If the executable file doesn't exist then the Make utility will try to first build the executable and then run WStrip on it.
Note
Strip will automatically execute when the target Release is run (see below).
In a project's directory, run command make release to build a production ready executable. All the debugging and any other excess information will be stripped away from the final executable. The executable file will be in the BUILD sub-directory.
In a project's directory, run command make clean to clean all files which were generated from the source files (executable file, OBJ files, and other files generated during compilation and linking).
There are many projects files which are probably lost forever due to corrupted copies of backup. I'll try to search and look in other backups. If I find more source code then I'll add them here.
Copyright © Farhan Ali Qureshi. All rights reserved. View the MIT LICENSE file for details.




















