Mail Archives: djgpp/1997/07/03/15:29: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
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
- Raw text -