Mail Archives: djgpp/1997/10/19/16:50:51
On 19 Oct 97 at 18:51, Anders Clerwall wrote:
> Hi!.. I have made a flip routine in inline asm, why doesn't it
> work!!.. Can anyone help? Here it is:
> void flip(short source, short dest) {
> asm( "movw %0, %%ds\n\t"
> "movw %1, %%es\n\t"
> "rep\n\t"
> "movsl"
> : : "r" (source), "r" (dest), "S" (0), "D" (0), "c"
> (16000) : "memory", "%esi", "%edi", "%ecx");
> }
You must preserve %es and %ds accross the call.
void flip(short source, short dest) {
asm( "movw %0, %%ds\n\t"
"pushl %%es\n\t"
"pushl %%ds\n\t"
"movw %1, %%es\n\t"
"rep\n\t"
"movsl\n\t"
"popl %%ds\n\t"
"popl %%es\n\t"
: : "r" (source), "r" (dest), "S" (0), "D" (0), "c"
(16000) : "memory", "%esi", "%edi", "%ecx");
}
Bill
--
Leave others their otherness.
- Raw text -