delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/03/26/22:12:12

From: mdruiter AT cs DOT vu DOT nl (Ruiter de M)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: info, FAQ not enough -> GCC and ASM
Date: 26 Mar 1997 15:23:40 GMT
Organization: Fac. Wiskunde & Informatica, VU, Amsterdam
Lines: 24
Message-ID: <5hbf1s$gs6@star.cs.vu.nl>
References: <5g1hv1$qtb$1 AT thor DOT atcon DOT com> <33385E5E DOT 325E AT CyberServices DOT Com>
NNTP-Posting-Host: sloep60.cs.vu.nl
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Neil Stone (Neil_Stone AT CyberServices DOT Com) wrote:
: SteelGolem wrote:
: > 
: > asm( "mov %1, %0": "=i(var2)": "i(var1)" );
:
: I don't know that much about assembler but what I have read is that for
: one thing the above code won't work. In AT&T syntax you have to specify
: the size of what you are moving. So the above would be:
: 
: asm("movw %1, %0": "=i(var2)": "i(var1)");
: 
: movw = 2 bytes, movb = 1 byte, movl = 4 bytes. There is also pushb,
: pushw, etc. 

Don't you mean:
asm("movw %1, %0": "=i" (var2): "i" (var1));

Mind the '(var[12])' outside the double quotes. I'm not an expert, but i
_have_ used it like this before. Or can it be used both ways?
-- 
Groeten, Michel.        http://www.cs.vu.nl/~mdruiter
 \----/==\----/
  \  /    \  /          "Life is cool.", Beavis.
   \/      \/

- Raw text -


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