Page 1 of 1

best 16bit C compiler

Posted: Wed Aug 06, 2008 10:35 am
by FlashBurn
I´m looking for a good (better the best) 16bit C compiler for writing a bootloader (2nd stage). I have somewhere an old version of turbo c++, but I think there are newer ones, maybe also free? I also thought about writing it in pascal. I still didn´t manage to look at fpc, is it possible to produce 16bit code and how good does it optimize.

A nice features would be good optimizing. At the moment I´m writing the bootloader in asm, but as I have a 3rd stage which I would like to get into the 2nd stage I like to change the language to C.

Re: best 16bit C compiler

Posted: Wed Aug 06, 2008 10:49 am
by 01000101
I think borland C++ does it and GCC can do it with some researching. I have a few experimental C bootloaders written in GCC C.

Re: best 16bit C compiler

Posted: Wed Aug 06, 2008 11:15 am
by FlashBurn
Ok, but maybe you can tell where to look what I have to do, to get gcc to outbut 16bit code.

Re: best 16bit C compiler

Posted: Wed Aug 06, 2008 11:46 am
by 01000101
I'm really short on time right now, I'll post more help links later, but here's a thread that I started about it a while ago:
http://forum.osdev.org/viewtopic.php?f=1&t=17618

Re: best 16bit C compiler

Posted: Wed Aug 06, 2008 3:08 pm
by Combuster
I would use GCC+binutils, because I know how it can be done. I don't know how (or even if) it can be done with Turbo C.

If you really want a 16 bit compiler, use bcc (famous for being used for bochs' bios)

Re: best 16bit C compiler

Posted: Sun Aug 24, 2008 1:59 am
by Ready4Dis
Umm... bcc == borland c compiler. Which was the best C compiler of it's time (16-bit dos) and can be used for real-mode programming. It even gives you different memory modes to work with depending on how you're OS is setup, one may be better than another (or worse, if it relies on things like extended memory managers). Just do some reading, and you'll be fine. I have not used gcc for 16-bit, my OS stays in 16-bit just long enough to enable a20, get memory map, and load my kernel image, then switches to 32-bit (no need for c code, since code to load disk image is pretty simplistic in my boot loader). Anyways, I used Turbo C/C++ a lot when Dos was in (I even still use it today to make things like disk management tools that I can run under dos, for example, I used it to write my master bootsector writing program, so I could write my MBR out to disk under Dos, formating drives, etc). Pretty neat, mostly featured, and a nice text based UI. There are free versions available, I think Turbo C 2.0 is free, I used Turbo C/C++ 3.0, I think the latest version was 3.1.

Re: best 16bit C compiler

Posted: Sun Aug 24, 2008 2:53 am
by AndrewAPrice
I'm sure GCC could do it aswell, since GCC targets many exotic architectures. I don't know if 16-bit would be an extension of x86 or it's own architecture entirely.

Re: best 16bit C compiler

Posted: Sun Aug 24, 2008 4:42 am
by froggey
bcc can also refer to Bruce Evans' C Compiler, another 16-bit C compiler. Part of the Dev86 package