From: Brian Dean Newsgroups: comp.os.msdos.djgpp,gnu.gcc.help Subject: Re: embedded 16 bit, real mode, x86 target for gcc? Date: Wed, 03 May 2000 14:15:44 -0400 Organization: The SAS Institue Inc. Lines: 43 Message-ID: <39106CCF.19C26C1E@unx.sas.com> References: <39104272 DOT D461E8D8 AT vvm DOT com> NNTP-Posting-Host: dean.pc.sas.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: license1.unx.sas.com 957377744 28876 10.26.2.60 (3 May 2000 18:15:44 GMT) X-Complaints-To: usenet AT newshost DOT unx DOT sas DOT com NNTP-Posting-Date: 3 May 2000 18:15:44 GMT X-Mailer: Mozilla 4.72 [en] (X11; I; FreeBSD 4.0-STABLE i386) X-Accept-Language: en To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Karl Rasmussen wrote: > > I am writing some low level IO code (essentially BIOS equivalent) for an > embedded project. If possible, C would be prefered to assembly language > (goal: 90% C, 10% assembly or better). We need some code to be 16 bit > compatible for legacy interface requirements. For other parts, 32 bit is > fine, though not required. > > I was hoping to find a gcc back end for this. If it would look like a 16 > bit x86 cross compiler, that would be great. Our development environment > is 32 bit x86, Linux or Win 9x, NT 4. > > I was excited to find DJGPP, but from the FAQ I get the message this is > not what DJGPP is. Nor did any of the other gcc builds or compilers seem > to claim to do this. Did I miss something? Is there any gcc based > solution? Or do I need to get an old Borland or MS 16 bit compiler? > > The DJGPP solution with dpmi services is quite clever, but I can't use > that trick. The code I'm writing is already at the level that is > supposed to be implementing those functions for real. > > (Yes, I tried to push back the 16 bit requirement and see if we could go > all 32 bit, and we are stuck with the 16 bit requirement.) > > Any pointers or ideas will be appreciated. > > Thanks, > > Karl Rasmussen > karl AT vvm DOT com Perhaps I'm oversimplifying your need, but I just use: asm(".code16"); at the top of my C files. My boot loader code, for instance, uses this. I believe that 32 bit code is still generated, but the opcodes are properly prefixed to run in real mode. I am currently using gcc-2.95.2 on FreeBSD, but I've used it with other versions of gcc as well. -Brian