delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/09/19/15:40:34

From: korpela AT albert DOT ssl DOT berkeley DOT edu (Eric J. Korpela)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Porting from Watcom to DJGPP
Date: 19 Sep 1996 18:16:30 GMT
Organization: Cal Berkeley-- Space Sciences Lab
Lines: 36
Message-ID: <51s2lu$fu4@agate.berkeley.edu>
References: <Pine DOT SOL DOT 3 DOT 95 DOT 960919093325 DOT 3454B-100000 AT columbia>
NNTP-Posting-Host: albert.ssl.berkeley.edu
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

In article <Pine DOT SOL DOT 3 DOT 95 DOT 960919093325 DOT 3454B-100000 AT columbia>,
MIKAEL BACKMAN  <di95mba AT student DOT hk-r DOT se> wrote:
>1. When using Watcom I declared my interrupt routines as follows :
>
>void (__interrupt __far __cdecl Introutine)()

DJGPP has no idea what __interrupt __far and __cdecl mean.  If you
need to do interrupts with DJGPP you'll have to check you the FAQ
>
>2. In Watcom I used pragmas for inline assembly functions.
>
>#pragma aux func =3D  \
> "shl eax,1"        \
> parm caller [eax]  \
> value [eax];
>

In DJGPP you use extended assembly.  See 
http://www.rt66.com/~brennan/djgpp_asm.html for a tutorial.  Your
function above would be...

inline unsigned int func(unsigned int value)  /* inline is optional */
{
  unsigned int retval;
  __asm__ ( "shll $1,%0"
            : "=r" (retval)  /* Use any GP register for return value */
            : "0" (value)    /* Use same register for input value    */
          );
  return (retval);
}

-- 
Eric Korpela                        |  An object at rest can never be
korpela AT ssl DOT berkeley DOT edu            |  stopped.
<a href="http://www.cs.indiana.edu/finger/mofo.ssl.berkeley.edu/korpela/w">
Click here for more info.</a>

- Raw text -


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