Message-ID: <380EF520.C2FAE759@connect.ab.ca> Date: Thu, 21 Oct 1999 11:12:32 +0000 From: Tom Fjellstrom X-Mailer: Mozilla 4.61 [en] (Win95; U) X-Accept-Language: en MIME-Version: 1.0 To: Eli Zaretskii CC: djgpp AT delorie DOT com Subject: Re: Plague of the slow 'blit' routine :) References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp AT delorie DOT com Eli Zaretskii wrote: > On Wed, 20 Oct 1999, Tom Fjellstrom wrote: > > > I've been playing around with mode 13h, and the > > only thing I've been really stuck on is my 'blit' > > routine. Suffice it to say it is extremely slow. > > It may have to do with '__djgpp_nearptr_enable()'ing > > before blit and '__djgpp_nearptr_disable()'ing after, > > for every bitmap > > These two functions are very slow, because they issue a DPMI function > call. You should call them as seldom as you can. The FAQ explains what > are the circumstances when you MUST call them. > > However, in general, I'd suggest to toss the idea of using nearptr hack, > and switch to dosmemput and farptr functions instead. They are almost as > fast as nearptr, even in tight loops, don't require an expensive call to > __djgpp_nearptr_enable, and don't disable memory protection. > > The FAQ clearly recommends not to use nearptr, so why do you need to mess > with it? Thank you Eli, But I can't be completely sure if the 'bitmap' i'm blitting to or from is in video memory. If I could then it would make sense to call the dosmemput or farptr functions only for those 'bitmaps'. I may be wrong but I don't think 'regular' memory can (or should?) be accessed with dosmemput or those farptr functions. The only way I have thought of determining that a bitmap is in video memory is too add a variable to the bitmap struct when creating it to indicate whether or not it is in video memory. If that is the only safe way of doing it I guess i'll have to. -- "An Optimist will say the glass is half full, A Pessimist will say the glass is half empty, A Canadian will say Waiter!" Tom Fjellstrom tomcf AT connect DOT ab DOT ca