Message-Id: <199808010337.EAA08924@sable.ox.ac.uk> Comments: Authenticated sender is From: George Foot To: drmcc AT ecr DOT mu DOT oz DOT au Date: Sat, 1 Aug 1998 04:36:57 +0000 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Subject: Re: Inline asm Reply-to: george DOT foot AT merton DOT oxford DOT ac DOT uk CC: djgpp AT delorie DOT com Precedence: bulk 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