Date: Mon, 7 Feb 2000 18:40:12 +0200 (IST) From: Eli Zaretskii X-Sender: eliz AT is To: Jan-Jaap Severs cc: djgpp AT delorie DOT com Subject: Re: Inline asm translations? In-Reply-To: <389ED6AC.76B16F3F@yahoo.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com Errors-To: dj-admin AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On Mon, 7 Feb 2000, Jan-Jaap Severs wrote: > void FillDoubleBuffer( int color ) > { > asm { > mov cx, double_buffer_size > mov al, BYTE PTR color > mov ah, al > les di, double_buffer > rep stosw > } > } Why can't you use memset? That's exactly what it does, and GCC will inline it automatically (if you compile with optimizations). > And another one: > > asm { > les di, dest_addr > mov al, BYTE PTR color > mov ah, al > mov cx, xe > sub cx, xs > inc cx > shr cx, 1 > rep stosw > } This is also memset, except that it does some simple arithmetics on the number of bytes to set. I suggest to use C library functions wherever you can, instead of getting yourself into complications and portability problems with inline assembly.