From: "Graham Reeds" Newsgroups: comp.os.msdos.djgpp References: <6v%E5.29784$L12 DOT 598411 AT news2-win DOT server DOT ntlworld DOT com> <8s49vu$k4l$1 AT slb6 DOT atl DOT mindspring DOT net> <8s4uou$381$1 AT slb7 DOT atl DOT mindspring DOT net> <8s73ft$fvg$04$1 AT news DOT t-online DOT com> <8s9ka0$pgg$04$1 AT news DOT t-online DOT com> Subject: Re: VBE2.0 w/LFB + GCC Lines: 58 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Message-ID: <%S1G5.3521$NQ4.79911@news2-win.server.ntlworld.com> Date: Sat, 14 Oct 2000 19:46:13 +0100 NNTP-Posting-Host: 62.254.81.161 X-Complaints-To: abuse AT ntlworld DOT com X-Trace: news2-win.server.ntlworld.com 971549243 62.254.81.161 (Sat, 14 Oct 2000 19:47:23 BST) NNTP-Posting-Date: Sat, 14 Oct 2000 19:47:23 BST Organization: ntlworld News Service To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com > - After you decide about LFB or bankswitching, you calculate the remainder > and videomemory pointer again with the bankswitching formula. > So you destroy them both in the case of LFB. > That's why you had only a fraction of your image on the screen Oops. My mistake - I was so concerned that the problem was higher in the code than that I never noticed it. Thanks it now works fine. > - You allocate your "primarysurface" AFTER you calculate the remainder > stuff. > This works for LFB, because you don't use it with the LDT descriptor > allocating part. > But as soon as bank switching is used, you will get a crash. > Put it before > > if (vbeinfoblock.vbeversion >= 0x0200) > It never seemed to bother my original version of my code, or the rewrote vbe1.2. This code is just an extension of that with some new bits stuck in , and one that compiled correctly about 2 years ago when I used to program in gcc 100%. Now I program 60/40 MSVC / GCC (though it seems to be back to 100%). I decided to go through all my old code and get everything look nice and orderly, with proper variable names (int thack1, thack2; anyone?). Seems with time, applications just fall apart... > - You calculate the remainder to be xres*yres. This is OK, because with LFB > you can copy the full screen at once. But you use _movedatal() for this, > which gets the number of DWORDS to copy, but you give it the number of > BYTES. > Either calculate remainder to be xres*yres/4 or divide it at the > _movedatal() > call. Sorry, another one of those grasping at straws moments... I've put it back in. > - Your calculation of the bankswitch-remainder works, but the modulo > operator > is predestinated to calculate remainders :-) Why don't you use it? I thought that the modulo calculates the number of x in y - ie: 145%12 = 12. Oh well, you live and learn!-) Seriously though. I always use rand()%100, to return a number between 0-99, so that's how I thought of modulus operating. Thanks for all your help, any other suggestions would be welcome. -- Stay Lucky, Graham "Mournblade" Reeds. ICQ No.: 30514803 http://homepage.dtn.ntl.com/grahamr