Xref: news2.mv.net comp.os.msdos.djgpp:7016 From: "Robert E. Arthur" Newsgroups: comp.os.msdos.djgpp Subject: Re: Drawing a pixel?? Date: Fri, 09 Aug 1996 13:17:29 +0100 Organization: The University of St Andrews Lines: 58 Message-ID: <320B2C59.167E@st-and.ac.uk> References: NNTP-Posting-Host: dufftown.dcs.st-and.ac.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp patrick fox wrote: > > void v_putpixel(int x,int y,char clr) > { > __asm__ __volatile__( > "pushl %%eax\n" > "pushl %%edi\n" > "pushw %%es\n" > "movl %0,%%eax\n" ^ Should this not read "movl %1,%%eax\n" ? > "movl %%eax,%%edi\n" > "shll $8,%%eax\n" > "shll $6,%%edi\n" > "addl %0,%%eax\n" > "addl %%eax,%%edi\n" > "movw _dos_ds,%%ax\n" > "movw %%ax,%%es\n" > "movb %2,%%al\n" > "stosb\n" > "popw %%es\n" > "popl %%edi\n" > "popl %%eax"); > } Also, if you wish to replace y*320 by faster instructions, try movl %1,%%edi leal [%%edi,%%edi,4],%%edi shll $6,%%edi (you *can* leal with edi can't you?) So the complete version would read void v_putpixel(int x,int y,char clr) { __asm__ __volatile__( "pushl %%eax\n" "pushl %%edi\n" "pushw %%es\n" "movl %1,%%edi\n" "leal [%%edi,%%edi,4],%%edi "shll $6,%%edi\n" "addl %0,%%edi\n" "movw _dos_ds,%%ax\n" "movw %%ax,%%es\n" "movb %2,%%al\n" "stosb\n" "popw %%es\n" "popl %%edi\n" "popl %%eax" ); Bob.