Mail Archives: djgpp/1996/08/08/06:15:46
John Meilleur <meilleuj AT cadvision DOT com> wrote:
>Can anyone help me speed up this bit of code. I'm writing some hi-res >graphics routines and would like to know
>how i can speed up clearing the screen buffer and the buffer transfer. >I know I should be able to do 32-bit
>transfering but I've had no luck with it sofar. The "video_ds" is the >selector to video memory and starts at
>offset 0. Can any show me how to speed this up alot? TIA
>
>char *screen = malloc(640*480);
>while (!kbhit())
>{
> for (i=0;i<640*480;i++)
> screen[i]=0;
>
> drawstuff(screen);
>
> _farsetsel(video_ds);
> for (i=0;i<640*480;i++)
> _farnspokeb(i,screen[i]);
>
>}
What exactly is this piece of code trying to accomplish? What you are
doing in the last 2 lines is crazy. Are you getting general protection
faults? Here is what you seem to be doing:
Allocating a screen buffer.
Setting all of it to 0 (use memset for this).
Calling drawstuff (whatever that does)
Setting the selector to video_ds
Writing the value of i to an offset which is derived from the value of
screen[i] (which is 0, since all of screen[i] is = to 0).
So in essence, you are just writing to offset 0.
>
> -John Meilleur
> meilleuj AT cadvision DOT com
- Raw text -