Mail Archives: djgpp/1997/07/04/10:32:02
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
> }
Hello..
The answer is.. movsl movs from ds:esi to es:edi.. not to edi:es..
like this:
asm("movw %%ax, %%edi\n\t"
"movl $0xA0000, %%es\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");
I hope it helps..
--
/* -gulgi adamskog AT algonet DOT se www.algonet.se/~adamskog *
* There's something in the air, makes me go insane *
* brings it back to me. *
* It's been so long, and alls I have to do, is live along *
* Coming coming down, over me *
* Do you want to see, the explosions in my eye *
* Do you want to see, the reflection of, how it used to be *
* Beauty lies in the eyes of anothers dreams *
* Beauty lies in the eyes of anothers dreams \\ Sonic Youth */
- Raw text -