delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2003/02/10/13:31:51

From: "Ben Peddell" <lightspeed85 AT hotmail DOT com>
Newsgroups: comp.os.msdos.djgpp
References: <b22rbg$7ei$1 AT wildfire DOT prairienet DOT org>
Subject: Re: How to compile for 16-bit
Lines: 29
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2615.200
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200
Message-ID: <J1S1a.44716$jM5.113097@newsfeeds.bigpond.com>
Date: Tue, 11 Feb 2003 04:29:14 +1000
NNTP-Posting-Host: 144.139.175.71
X-Trace: newsfeeds.bigpond.com 1044901097 144.139.175.71 (Tue, 11 Feb 2003 05:18:17 EST)
NNTP-Posting-Date: Tue, 11 Feb 2003 05:18:17 EST
Organization: Telstra BigPond Internet Services (http://www.bigpond.com)
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

If you have GCC 3.2 or above, and if either NASM understands GAS's syntax or
the linker that you're using understands both COFF and the output of 16-bit
NASM, then you could possibly do it (with some tweaking of the intermediate
aSm code).
However, I don't think that LD supports outputting MZ exes.
First compile the code with the -S switch. Then, insert ".code16gcc" in the
start of the S file. Then, compile the S file with -c. Also ensure that the
CALLs and RETs between the NASM code and the GCC code are 32-bit. If not,
then you may need to alter the S code more to override the CALLs and RETs to
16 bits (with addr16)
Then, if the output is a COM file, then LD all of the object files with
"--oformat binary", as well as any other necessary switches. However, you
must make sure that the total code and data size in this instance is less
than 64kB.

If you want to use the libraries that come with any version of GCC, whether
DJGPP or otherwise, then forget it. They are 32-bit protected mode
libraries.


Scott J. McCaughrin <sjmccaug AT bluestem DOT prairienet DOT org> wrote in message
news:b22rbg$7ei$1 AT wildfire DOT prairienet DOT org...
> Is there a way to compile gcc for 16-bit real-mode? I have to link
> it with a 16-bit NASM program which talks to DOS.
>
> Thanks.
>


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019