delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/08/08/06:15:46

Xref: news2.mv.net comp.os.msdos.djgpp:6953
From: Arcanix <arcanix AT pop DOT erols DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: buffer -> screen transfers
Date: 8 Aug 1996 05:34:52 GMT
Organization: None
Lines: 37
Message-ID: <4ubu9s$l3d@news8.erols.com>
References: <320647A3 DOT 5827 AT cadvision DOT com>
NNTP-Posting-Host: as3s43.erols.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019