www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/12/20/01:16:18

Xref: news-dnh.mv.net comp.os.msdos.djgpp:3939
Path: news-dnh.mv.net!mv!news.sprintlink.net!cs.utexas.edu!math.ohio-state.edu!jussieu.fr!univ-lille1.fr!cict.fr!irit.fr!challier
From: challier AT news DOT irit DOT fr (Jean-Marc CHALLIER)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: DJGPP: Inline assembly?
Date: 19 Dec 1995 10:55:09 GMT
Organization: IRIT-UPS, Toulouse, France
Lines: 41
Message-ID: <4b65md$ol0@orphee.irit.fr>
References: <4apphs$las AT micro DOT internexus DOT net> <Pine DOT SUN DOT 3 DOT 91 DOT 951215145127 DOT 728B-100000 AT t3b>
NNTP-Posting-Host: lucie.irit.fr
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Andy Molyneux (molyneua AT cs DOT man DOT ac DOT uk) wrote:
: Trouble is, this doesn't let you refer to local variables or parameters 
: passed to the current function (which I believe BCC's asm{} does) and the 
: assembler syntax requires operands "backwards" amongst other bizarre 
: features.

Sorry, but it DOES let you do it, and moreover, you can put not only
variables but ANY VALID C-EXPRESSION inside the `()'. Please DO take a
further look at the info file I mentioned earlier. Here is a (silly)
example I can think of ; sorry I didn't compile it, but I'm at work at
the moment :

int   trigger;

int isTriggerPlus2(int i) {
  register int result asm("eax");

  asm(	"
	movl	%1, %%edx
	cmpl	%2, %%edx
	setnel	%0
	" : "=r" (result) : "g" (i), "g" (trigger+2) : "edx");
}

I know it is REALLY silly, but it's an example of what can be put
between the `:'.

	I know the syntax is not the same as Intel's assembly, but it
DOES allow you to do ASM constructs in a C-source file.

.... hope this helps...

			Igx, The dreaming drummer...

-----------------------------------------------------------------------------
Igx, The dreaming drummer... in real(???) life : Jean-Marc CHALLIER
email : challier AT irit DOT fr		| J-M CHALLIER,
pmail : IR1-17, UPS, 18 rte de Narbonne | 18, Bd Griffoul Dorval
	31000 Toulouse - FRANCE		| 31400 Toulouse - FRANCE
phone : (33) 61-55-63-57		| Tel : (33) 62-16-35-92

- Raw text -


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