From: csantill AT lausd DOT k12 DOT ca DOT us Message-ID: <33D29BAD.43F3@lausd.k12.ca.us> Date: Sun, 20 Jul 1997 16:13:49 -0700 MIME-Version: 1.0 To: djgpp AT delorie DOT com Subject: Is the FAQ wrong about FAR/NEAR ptr speed Content-Type: multipart/mixed; boundary="------------1F6F220D651A" Precedence: bulk This is a multi-part message in MIME format. --------------1F6F220D651A Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit from: csantill AT lausd DOT k12 DOT ca DOT us Thanks to Sinan I'm finally using working FAR PTR mode 13h hack stuff & I accidentally got the NEAR PTR hack stuff working on my own. I decided to test the speed difference & I found there was none! Everybody on the net(including the mailing list) thinks the NEAR PTR stuff is faster but on my system it is the exact _SAME_ as the FAR PTR stuff(about 90 FPS which is great; leaves alot clocks for animation & game AI). But I want to find if it is just my system. I've included my code to see if there is any difference. Ive got a Pent 120, 16MB RAM/1MB video(Trident) & I would like to test it on a true 386 as well as 486. My code is litely commented & not too hard to follow. It basically just fills the screen w/all 256 color 30x's (people who have taken basic stats know this is the # of trials to get a decent average). Well, here's my source. --------------1F6F220D651A Content-Type: text/plain; charset=us-ascii; name="Vga_comp.c" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="Vga_comp.c" #include #include #include #include #include #include #include #include // The includes are from my original file - circle/box/line snipped out // I owe a big thanx to Sinan for my receipt of some actually working VGA // code. THAAAAAAAAAAAAAAAANNNNNNNNXXXXXXXXXXXXXXXXXXX!!!!!!!!!!!!! :] enum GR_MODE{GR_INVALID=-1, GR_TEXT=0x03, GR_VGA=0x13}; enum GR_MODE Set_GR_Mode(enum GR_MODE mode) { __dpmi_regs r; memset(&r, 0, sizeof(r)); r.x.ax=mode; return(__dpmi_int(0x10,&r) ? GR_INVALID:mode); } // ************************************************************************ void Put_Pix_Far(int x, int y, char c) { _farpokeb(_dos_ds, 0xA0000+(y<<8)+(y<<6)+x,c); return; } // ************************************************************************ void Put_Pix_Near(int x, int y, char c) { char *v_m=(char *)(0xA0000+__djgpp_conventional_base); v_m[(y<<8)+(y<<6)+x] = c; } // ************************************************************************ int main(void) { int x, y, co; uclock_t st1, st2, et1, et2; if(GR_INVALID==Set_GR_Mode(GR_VGA)) { printf("Error setting mode 13h\n"); exit(8); } // Beginning of FAR PTR SPEED TEST st1=uclock(); for(co=0; co<7680; co++) for(y=0; y<200; y++) for(x=0; x<320; x++) Put_Pix_Far(x,y,co % 256); et1=uclock(); // Ending of FAR PTR SPEED TEST printf("Done w/FAR PTR test\nHit ENTER to start NEAR PTR TEST\n"); getchar(); // Beginning of NEAR PTR SPEED TEST if(__djgpp_nearptr_enable()) { st2=uclock(); for(co=0; co<7680; co++) for(y=0; y<200; y++) for(x=0; x<320; x++) Put_Pix_Near(x,y,co % 256); et2=uclock(); }; __djgpp_nearptr_disable(); // Ending of NEAR PTR SPEED TEST Set_GR_Mode(GR_TEXT); // Show the results printf("On my Pentium 120, 16MB RAM, Trident ET6???? w/1MB, while using" " RHIDE 1.3, GCC\n2.7 w/-O9 & -m386(-m486 I get the same results), I get" " 90.35 fps for both test.\nIs this unusual?\n\nYour results:\n"); // FAR PTR results printf("FPS for FAR PTR = %3.2f\n", (float)7680/((float)((et1-st1)/UCLOCKS_PER_SEC))); // NEAR PTR results printf("FPS for NEAR PTR = %3.2f\n", (float)7680/((float)((et1-st1)/UCLOCKS_PER_SEC))); getchar(); return 0; } --------------1F6F220D651A--