Mail Archives: djgpp/1998/07/31/23:39:11
On 1 Aug 98 at 12:20, Donald McComb wrote:
> Okay, I have a (very) limited knowledge of intel assembler, and I'd like
> to convert some inline asm in intel format which I've found in a book
> into AT&T format for use with djgpp. Here's the intel asm:
>
> _asm {
> push ds;
> les di, video_buffer;
> lds si, data;
> mov cx,320*200/2;
> cld;
> rep movsw;
> pop ds;
> }
How about this: memcpy (video_buffer, data, 320*200);
That's assuming that `video_buffer' and `data' are just ordinary
pointers. Since 320*200 is a constant, gcc will inline this anyway
to something like this:
movl _video_buffer,%edi
movl _data,%esi
cld
movl $16000,%ecx
rep
movsl
You can't ask for much more, can you? :)
Notes:
* ES and DS are automatically correctly set, because they're
normally both equal to our program's main segment, in which all our
heap resides.
* gcc is copying longs here -- 16000 longs = 320*200 bytes.
* If you want to copy this code into extended inline assembler,
you'll need to double up the % signs (as you did in your example).
Or you could just arrange for all the values to be in the correct
registers to begin with, and just put "cld ; rep ; movsl" as the
instructions.
Ultimately, though, you might as well use memcpy since that's what
it's for.
--
george DOT foot AT merton DOT oxford DOT ac DOT uk
- Raw text -