Mail Archives: djgpp/1998/12/19/20:45:42.1
Christian Hofrichter wrote:
>
> Let's say I have the following code :
>
> asm("movw %0,%%es":
> :"r"((unsigned short) vesa_framebuffer) )
> asm("movl %0,%%edi" :
> :"r"(address) );
>
> How can I put it into one asm-instruction ?
> If I use the "normal" asm-syntax I can use "\n\t" but in extended
> asm-syntax this doesn't seem to work.
asm ("movw %0, %%es \n\t"
"movl %1, %%edi"
: /* no outputs */
: "r" ((unsigned short) vesa_framebuffer), "r" (address));
Operands are numbered in the order defined. You should read (or reread)
the "Extended Asm" section of the GCC docs, which explains all this.
Note that you will of course want to add some instructions that actually
do something, and set the clobber list appropriately.
Also, you can use "\n", "\n\t" or ";" (a semicolon) as you wish. "\n\t"
looks a little better if you ever have to read the generated asm, but is
less convenient to type.
--
Nate Eldredge
nate AT cartsys DOT com
- Raw text -