Mail Archives: djgpp/1997/03/25/22:48:44
From: | Neil Stone <Neil_Stone AT CyberServices DOT Com>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Re: info, FAQ not enough -> GCC and ASM
|
Date: | Tue, 25 Mar 1997 23:23:10 +0000
|
Organization: | [not set]
|
Lines: | 27
|
Message-ID: | <33385E5E.325E@CyberServices.Com>
|
References: | <5g1hv1$qtb$1 AT thor DOT atcon DOT com>
|
NNTP-Posting-Host: | n70i015.c1r2.pol.co.uk
|
Mime-Version: | 1.0
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
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.
To access the registers you just specify them:
asm("movw %1, %%ax
movw %%ax, %0"
:"=i(var2)"
:"ivar1");
The only point to make is that when using variables, %0, %1, etc, you
need to put %% in front of register names. If you don't use variables
then you only need one %:
asm("movw %bx, %ax");
I hope this helps (I hope this works!).
- Raw text -