From: Eric Jacobs Newsgroups: comp.os.msdos.djgpp Subject: Re: [Q] Inline Assembly Date: Mon, 30 Jun 1997 12:40:40 +0000 Organization: Erol's Internet Services Lines: 42 Message-ID: <33B7A948.513C@no.no> References: <867681946 DOT 970324 AT red DOT parallax DOT co DOT uk> NNTP-Posting-Host: rkv-as2s36.erols.com 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 Precedence: bulk John Eccleston wrote: > > Hi All, > > I am having little difficulty trying to copy my double buffer to > video memory and I was just wondering if anyone could put me out of my > misery and tell me why the following code gives me a striping effect on > the screen. > > -----> Cut here <----- > void vgaBlitBuffer(BYTE *buffer) > { > int > selector = _dos_ds; > > /* Synchronise with vertical retrace to avoid flicker */ > while ((inportb(IST1_ADDR) & 0x08) == 0); /* Wait for vertical retrace */ > while ((inportb(IST1_ADDR) & 0x08) == 8); /* Wait for end of retrace */ > > #if 0 > /* Blit the double buffer */ > movedata(_my_ds(), (int) buffer, _dos_ds, 0xA0000, 320 * 200); > #else > asm("movw %%ax, %%es\n\t" > "movl $0xA0000, %%edi\n\t" > "movl $16000, %%ecx\n\t" > "cld\n\t" > "rep\n\t" > "movsl\n\t" > : /* no output registers */ > : "a" (selector), "S" (buffer) > : "%eax", "%esi", "%edi", "%ecx"); > #endif > } Your mov's are backwards! It's mov dest,src Also, I believe there is an inline function in movedata.h called _movedatal that is exactly what you want here. You call it the same way as movedata except you specify 16000 (longs) as the count instead of 64000 (bytes). -ej