C compiler for MS-DOS

Here are a bunch of details others have missed:

  1. Nobody mentioned DJGPP at all.

    It's a protected-mode DOS port of GCC and probably has the largest selection of libraries and guides available of any of the open-source options. (Including a Turbo Vision port with an installation HOWTO)

  2. No matter what you're trying to do, OpenWatcom (source) is likely to meet your needs.

    1. OpenWatcom still includes the free license to use DOS/4GW that made it so popular back in the day. (When you see a game like DOOM saying "DOS/4GW Protected Mode Runtime" when it starts, that means that it was built using Watcom C/C++, because DOS/4GW is the special Watcom bundle version of DOS/4G.)

      In fact, DOS/4GW's creator was trying to dig up the source code for a newer version of DOS/4GW to contribute to Open Watcom when he passed away.

    2. If you don't want nostalgia, OpenWatcom bundles newer, better alternatives to DOS/4GW, like DOS/32 and PMODE/W.

    3. If you want to putter around with Windows 3.1 programming, OpenWatcom includes Win386, a 32-bit extender for Window 3.x which was used by companies like Sierra for their Windows 3.1 games before Microsoft produced their own "Win32s" 32-bit API addon.

    4. OpenWatcom can target all supported platforms from a single install. (I use it to build various DOS and Windows test EXEs from Linux.)

    5. OpenWatcom can target a lot of retro-platforms:

      • COM files
      • real-mode EXEs (there's a separate set of options to select minimum CPU requirement)
      • protected-mode EXEs (with your choice of several extenders)
      • Windows 3.1 EXEs (with or without the Win386 extender)
      • Lots of other formats you probably don't care about
  3. If your project must run in real mode (ie. no DJGPP) and you want something with a more modern optimizer than the one in Open Watcom C/C++, there's a fork of GCC named GCC IA16 that you can try. (Though I don't know how complete its support is for the various memory models and calling conventions used in the 16-bit x86 ecosystem.)

  4. If you want something that'll let you run the IDE and compiler on ancient hardware, the Pacific C compiler and IDE list a 286 CPU as their minimum requirement but can also be run in DOSEMU for easy integration into Linux-based build automation.

  5. Here are a few other free C compilers for DOS, though they lack the huge ecosystems DJGPP and OpenWatcom have:

    • CC386
    • DeSmet C
    • Dev86
    • Orange C/C++ Compiler

You may also want to run the UPX compressor on the EXE files you build so you'll have more free space on any floppy images you make. (Don't forget to run it with --8086 if you're targeting something older than a 386.)

It's capable of compressing EXE, COM, and SYS files and using this sort of executable compression was commonplace back in the day.

(However, two of the three major formats UPX doesn't compress are OS/2 and Windows 3.1 executables. I'm still looking into the best option for those, given that LxLite doesn't get along with OpenWatcom-generated EXEs.)


I have installed the compiler and it worked successfully, if you want the ova here is the link MS-DOS ova with C compiler

To open the compiler:

cd TC

TC

and that's it! You can write C and compile. The best part is that you can deal with registers and memory without any restriction.


The Turbo C compiler for DOS is just awesome, and freeware.

Official site link http://edn.embarcadero.com//article/20841

Also there are Microsoft QuickC but I don't know how hard is to find it.

Or Watcom C, but I don't know if their OpenWatcom version works with DOS

Tags:

C

Virtualbox

Dos