www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/02/20/23:00:10

From: knakasato AT aol DOT com (KNakasato)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: asm and variables access
Date: 21 Feb 1998 01:38:46 GMT
Lines: 40
Message-ID: <19980221013801.UAA25772@ladder02.news.aol.com>
NNTP-Posting-Host: ladder02.news.aol.com
References: <34ED884D DOT 45CBA0 AT teccart DOT qc DOT ca>
Organization: AOL http://www.aol.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

In article <34ED884D DOT 45CBA0 AT teccart DOT qc DOT ca>, "Jean-Réginald Louis"
<louis DOT jean-reginald AT teccart DOT qc DOT ca> writes:

>
>How can I acces the parameter of a function and is local variable in
>DJGPP when I use inline assembly (write inside that function)?
>
>This thing get me crazy! Whith Borland C++ 3.1, I had no problem doing
>this. I thing GCC can do so!
>

Other than syntax that I am not used to, GCC do this better.

You should get yourself NASM which isn't inline but has Intel style
which I find much easier since it is more or less  TASM compatible
except for macros.

Also I think I got this for macro from Brennan's webpage. If someone
else don't give you the URL, let me know

#define COPY32(dest, src, numwords) \
__asm__ __volatile__ ( \
  "cld\n\t" \
  "rep\n\t" \
  "movsl" \
  : : "S" (src), "D" (dest), "c" (numwords) \
  : "%ecx", "%esi", "%edi" )

#define times3(arg1, arg2) \
__asm__ ( \
  "leal (%0,%0,2),%0" \
  : "=r" (arg2) \
  : "0" (arg1) );


This syntax should work the same for any variables (just remove #define.)



Aloha

- Raw text -


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