Thread: Optimized C Compiler Capable of 16b Code

  1. #1
    Password:
    Join Date
    Dec 2009
    Location
    NC
    Posts
    587

    Optimized C Compiler Capable of 16b Code

    I'm kinda into OS development and so far I've done everything in asm, but I'm a little tired of doing everything by hand, so I'm looking for a reasonably optimized compiler capable of producing code suitable for real mode. Any suggestions?

  2. #2
    Make Fortran great again
    Join Date
    Sep 2009
    Posts
    1,413
    I take it gcc -OX doesn't satisfy your needs?

    edit: oh, 16-bit, nevermind

  3. #3
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Code:
     16 bit compiler
     produces good code
     free
    Turbo C/C++ (use the C compiler only, set that option in the IDE).

    Avoid "Turbo C", which was a different product by Borland, and was buggy.

    Google "Borland legacy compiler", and enjoy.

  4. #4

  5. #5
    Registered User
    Join Date
    Aug 2006
    Posts
    100
    I recently switched from Borland 5.5 to Digital Mars, and it works fine for 16 bit DOS apps.

  6. #6
    Make Fortran great again
    Join Date
    Sep 2009
    Posts
    1,413
    Main Page - Open Watcom

    Now that my mind is on track, I heard Watcom is supposed to be the best of the old DOS compilers

  7. #7
    Registered User
    Join Date
    Oct 2008
    Location
    TX
    Posts
    2,059
    Also specify your target chipset as there are many 16-bit rtos C compilers, but most cater to specific micros.

  8. #8
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by User Name: View Post
    I'm kinda into OS development and so far I've done everything in asm, but I'm a little tired of doing everything by hand, so I'm looking for a reasonably optimized compiler capable of producing code suitable for real mode. Any suggestions?
    Some people around here complain about people using the "obsolete" Turbo C compiler. I always retort with something like "Yeah, but what are you going to use when you need 16-bit real mode code?"

    Use Turbo C.

    What are you doing? When coding for segmented memory model, you need to choose between tiny/small/large/huge addressing modes.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  9. #9
    Registered User jeffcobb's Avatar
    Join Date
    Dec 2009
    Location
    Henderson, NV
    Posts
    875
    Been using Watcom since they were a paid-for concern. *great* compiler, handled a variety of cross-platform (I did Netware modules and OS/2 code along with Windows stuff back in the day and the debugger was second to none. It DID require one to use their brain on occasion but some days it was the only way to get the job done. I still have v11 or so around here someplace...
    C/C++ Environment: GNU CC/Emacs
    Make system: CMake
    Debuggers: Valgrind/GDB

  10. #10
    Password:
    Join Date
    Dec 2009
    Location
    NC
    Posts
    587
    Thanks for all the helpful responses. So I guess it's down to Watcom and Borland, so which has a good IDE for looking up defines+params quickly? I'm pretty new to strict C(some experience with C++) so I'll probably be right clicking and finding definitions a lot.

  11. #11
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Well, neither one are actually sold any more. You can get Borland's from their museum (Antique Software), I don't know if the OpenWatcom project has anything usable or not honestly.


    Quzah.
    Hope is the first step on the road to disappointment.

  12. #12
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    That Watcom looks very capable. I use Turbo C/C++ a good deal,and help for all C keywords and built in functions, are found by either:

    pressing the F1 key. If the cursor is over a word, the help will try and find that word, in it's listing, for you.

    If no word is under the cursor, then you get the help page, with it's built in search function.
    Enter a few letters and you're there.

    Every function or keyword in the help section, has an explanation of the subject, and a short example, as well. It's quick.

    It uses no windows functions, since it predates it, but includes it's own graphics modes (which may or may not have a good aspect ratio in your Windows set up, and the handy header conio.h to handle things like gotoxy(x,y) on the text window.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. embedded c code on c compiler
    By vinayharitsakp@ in forum C Programming
    Replies: 8
    Last Post: 11-28-2007, 03:31 AM
  2. Obfuscated Code Contest
    By Stack Overflow in forum Contests Board
    Replies: 51
    Last Post: 01-21-2005, 04:17 PM
  3. Errors in code
    By itzme in forum C++ Programming
    Replies: 12
    Last Post: 01-07-2005, 05:11 PM
  4. Replies: 3
    Last Post: 11-04-2001, 03:53 PM
  5. Bad code or bad compiler?
    By musayume in forum C Programming
    Replies: 3
    Last Post: 10-22-2001, 09:08 PM