delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/11/30/02:57:18

Date: Mon, 30 Nov 1998 09:55:29 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Nathaniel Johnson <najohnso AT expert DOT cc DOT purdue DOT edu>
cc: djgpp AT delorie DOT com
Subject: Re: Assembly in DJGPP
In-Reply-To: <Pine.GSO.3.96.981129225037.10001A-100000@expert.cc.purdue.edu>
Message-ID: <Pine.SUN.3.91.981130095506.9230K-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com

On Sun, 29 Nov 1998, Nathaniel Johnson wrote:

>   I am tring to port a program from Microsoft C and MASM to djgpp and I
> was wondering if anyone can tell me if I can leave the MASM assembly files
> the way they are and compile with MASM or if I need to port them with
> NASM.

Most probably, you will have to abandon MASM, since it usually
produces .obj files which are incompatible with DJGPP.  (MASM 6
reportedly has an option to produce COFF format, but I heard reports
that its COFF is not 100% compatible with DJGPP either.)  Section 17.5
of the DJGPP FAQ list (v2/faq211b.zip from the same place you get
DJGPP) explains this issue in more detail.

However, the more important problem is that the assembly code you have
was probably written for a real-mode program.  If so, it does things
which will immediately crash your program in protected mode.  (See
sections 17.3 of the FAQ for more about this.)  So you will probably
need to rewrite that code anyway.

> (If I do need to port to NASM, is there a tutorial on NASM, or
> djgpp inline assembly) 

See section 18.13 of the FAQ, it has some pointers to available docs.

You need also to be aware that sometimes it is much easier to rewrite
the assembly as C code.  Many real-mode programs used assembly just to
issue DOS/BIOS interrupts, which is much easier done in C.  Section
17.8 of the FAQ gives an example.

- Raw text -


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