Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"DOS Mode" / 16-bit program... how? 1

Status
Not open for further replies.

Ghodmode

Programmer
Feb 17, 2004
177
NZ
I have a very small, simple program that I want to compile for DOS.

The program itself works fine. It's console-only. It just opens a file, reads some data, and writes a new file after parsing the first file.

It has to run in DOS.

I've had some success with DJGPP, but I have to use DPMI if I use that.

Maybe I just need the right command-line options.

I have tried the following compilers:
MSYS/MinGW
Microsoft Visual C++ Toolkit 2003
Borland C++ compiler

I have about a half-dozen other compilers that I have downloaded, but not tried yet.

Am I missing something that should be obvious?

--
-- Ghodmode
 
How big is the file?

Do you mean proper dos as in dos6.22 or a dos box in a windoze machine?
 
yep... "proper" DOS :-(

Technically, it's Windows 98 in MS-DOS mode. When it boots I can see the logo, but whoever built this system did it in such a way that there's not even a WINDOWS directory.

In any case, it acts like real DOS. The MS-DOS "stub" executes and states something like "This program must be run under Win32." when compiled with Borland and something like "This program cannot be run in DOS mode" with other compilers.

--
-- Ghodmode
 
Thank you.

I knew about the compilers.net page. I downloaded several of them, but didn't install any. I hadn't heard of most of the companies there, so I was looking for advice on which compiler to use.

I was looking for something like Turbo C because I've heard of Borland, but I didn't know what to look for. I ended up with the 32-bit compiler which wasn't what I needed.

After doing some reading, I chose the Digital Mars C compiler, mostly because of this statement on their features page: "Most other compilers for 16 bit code were abandoned nearly a decade ago. Digital Mars has a modern compiler for 16 bits."

For future reference, here's how to compile a DOS app with the Digital Mars compiler:
Code:
dmc -mtd hello.c

You end up with [tt]hello.com[/tt].

Best of all, for me, is that I can compile using WINE and test using DOSBOX or DOSEMU rather than starting my vmware session just to compile and test.

--
-- Ghodmode
 
Good choice - it is one of the few that handles templates correctly.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top