Mail Archives: djgpp/1997/07/03/17:28:23
Eric Jacobs <no AT no DOT no> wrote:
> To: djgpp AT delorie DOT com
> Subject: Re: [Q] Inline Assembly
> Date: 30 June 1997 13:40
>
> 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
No there not, it uses AT&T synatx which is
mov src, dest
>
> 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
Liam
- Raw text -