Re: C 16 bit compiler

George Neuner <gneuner2@comcast.net>
Wed, 29 Sep 2010 16:31:09 -0400

          From comp.compilers

Related articles
C 16 bit compiler ilikequoting@katamail.com (Jack Smith) (2010-09-27)
Re: C 16 bit compiler efutch@gmail.com (Egdares Futch) (2010-09-28)
Re: C 16 bit compiler nmh@t3x.org (Nils M Holm) (2010-09-29)
Re: C 16 bit compiler cr88192@hotmail.com (BGB / cr88192) (2010-09-28)
Re: C 16 bit compiler gneuner2@comcast.net (George Neuner) (2010-09-29)
Re: C 16 bit compiler ArarghMail009@Arargh.com (2010-09-30)
Re: C 16 bit compiler ilikequoting@katamail.com (Jack Smith) (2010-10-01)
Re: C 16 bit compiler gneuner2@comcast.net (George Neuner) (2010-10-01)
Re: C 16 bit compiler gneuner2@comcast.net (George Neuner) (2010-10-03)
Re: C 16 bit compiler cr88192@hotmail.com (BGB / cr88192) (2010-10-06)
Re: C 16 bit compiler newshound1@digitalmars.com (Walter Bright) (2010-11-11)
[1 later articles]
| List of all articles for this month |

From: George Neuner <gneuner2@comcast.net>
Newsgroups: comp.compilers
Date: Wed, 29 Sep 2010 16:31:09 -0400
Organization: A noiseless patient Spider
References: 10-09-027
Keywords: C, code
Posted-Date: 29 Sep 2010 23:28:28 EDT

On Mon, 27 Sep 2010 23:01:36 -0700 (PDT), Jack Smith
<ilikequoting@katamail.com> wrote:


>Do you know about a compiler C which can compile into 16 bit?


16-bit what?


>i've tried watcom, but it's difficult to use and i need that 16 bit binary
>to be an ELF, not an OMF, besides ELF is rudimentary in wlink.


There are plenty of 16-bit x86 compilers around. Have you tried
Google?


>suppose you have to write a bootloader (only stage1) in C and in real
>mode, what compiler will you use?


A first stage boot loader can only be up to one device block long.
Because of this it would usually be written in assembler. It's
possible to write one in C, but you have to be *EXTREMELY* careful
about using any library functions. Still it would be difficult to get
a useful C program to fit into a 512 byte floppy sector.


Moreover, the second stage loader is usually packaged together with
the first stage loader, so if you want to use the same compiler for
both you'll need one suitable for the second stage as well.


And you can't put a boot loader in ELF, it has to be a flat
non-segmented format like A.OUT or COM.


I have no experience with freeware 16/32-bit compilers. I've used
Microsoft, Watcom (the commercial version), Lattice and Borland (which
is now freely available). Any of them would do fine.




>ah, yeah..unfortunately.. gcc is not suitable for this,
>because .code("asm16gcc"); directive makes the compiler to insert a
>lot of 66 and 67 stuff in the code which makes the binary too large
>for my purpose,


If you don't know what those codes mean, you probably shouldn't be
doing whatever you are doing.


>moreover someone says that it will not work either, do you confirm this?


No. Whether the code will work depends on what chip it will be run on
- which you haven't specified.


GCC is nominally a 32-bit compiler which makes no guarantees of
compatibility with smaller chips. Regardless of quality or length of
service, the GCC code generators for 16-bit chips are all considered
to be experimental.


>any help is appreciated..


You appear to need a lot of help and I question whether you are ready
to take on this project - whatever it is. I suggest you spend some
quality time learning more about it before you proceed.


George



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.