From: Damian Yerrick Newsgroups: comp.os.msdos.djgpp Subject: Re: Fastest bitblt? Organization: Pin Eight Software http://pineight.8m.com/ Message-ID: References: <83mebssig8p8d943fekqr2sgumh48ermno AT 4ax DOT com> X-Newsreader: Forte Agent 1.7/32.534 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 112 X-Trace: /wsX0IVtwoU0NDb/JFgWMrGr33+N11YNuznDPpYji+vfc3sTLKl8hmwPXYi7XZ5IuyrN3GH/LXte!VkhIXfZ/NEgoiJGhVehiIzpqJAW6Try/8x2xbC8dp50OquGvAzMOP4/3tzOsEPDPRqv7a1/c3ofQ!djSf X-Complaints-To: abuse AT gte DOT net X-Abuse-Info: Please be sure to forward a copy of ALL headers X-Abuse-Info: Otherwise we will be unable to process your complaint properly NNTP-Posting-Date: Mon, 28 Feb 2000 04:31:59 GMT Distribution: world Date: Mon, 28 Feb 2000 04:31:59 GMT To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com On Sat, 26 Feb 2000 20:28:15 +0600 (LKT), Kalum Somaratna aka Grendel wrote: >On Sat, 26 Feb 2000, Damian Yerrick wrote: > >> Watcom automatically nearptrs all memory. DJGPP doesn't, primarily >> because it's descended from a GNU tool, and GNU is a protected OS. > >Watcom32 (DOS4GW) is too a protected mode os (dosextender) >so it is _wrong_ to imply that dos4gw/Watcomc 32 extended dos >is not a protected mode environment. I said protected, not protected mode. Windows 9x runs in the Intel x86 CPU's protected mode, but nothing protects the computer from being rebooted (accidentally or intentionally) from within a user program. Protected mode only provides a mechanism for memory protection; it doesn't require that operating systems provide such protection. DOS4GW doesn't IIRC. >> >Both are 32bit compilers, so why would you need to >> >disable protection to access video memory in DJGPP? >> >> You don't... ..."need to disable protection." >Yes you can acess memory using the farpokeb etc... functions. >Allegro is a library which uses this method. I guess you misunderstood me. >> >How (un)safe is it to disable protection to access >> >video memory with memcpy()? >> >> You could _potentially_ overwrite the OS, leading to a crash or a >> corrupted FAT. Very bad. And according to Murphy, very probable. > >However it is worthwhile to consider the fact that ID software extensively >used nearptrs for the code for Quake. But does everyone have the beta testing resources of id Software? >So IMHO I think that it using >nearptrs _is_ useful and easy (just see how easy acessing memory using a >char *p pointer is than all those farpokeb etc..) Not to start a farptr vs. nearptr religious flamewar, but how is a movedata() harder than a memcpy()? >providing that you are careful when acessing memory using the >pointer as it is very easy to overwrite code or data using >a stray pointer. All too easy in a buggy program on a single-HD laptop. >So IMHO nearptrs are a useful feature and makes much more code portable >from Watcom to DJGPP and also that using nearptrs is resonably safe and >nothing to get a panic attack about :-) My experiences with a hugeptr library I wrote in real-mode DOS (which I used in a graphics library that I abandoned when I found about DJGPP and Allegro) speak differently. Your Furlongage May Vary. >Although we can't match ID softwares ability root out bugs ;-) So use the CPU's. farptr is your friend. >> >for(i=0;i<64000;i++) >> > _farpokeb(_dos_ds,0xA0000,+i,buffer[i]); > >char *p= (char *)(__djgpp_conventional_base+ 0xa0000); >for (i=0; i<64000;i++) >p=buffer[i]; After getting and storing the selector for video RAM (pointing to 0xa0000 or whatever VBE 2 tells you): #include movedata(_my_ds, (unsigned)video_buffer, video_ds, 0, 64000); >Beautiful isn't it :-) Yes. What could be more beautiful than one simple function call? >AFAIK memory protection isn't disabled using nearptrs >since protected mode is still being used. x86 protected mode with nearptrs disables protection because you can now overwrite DOS. >It just makes it more easier for a badly behaved >pointer to do unnatural things :-) Like corrupt the filesystem in the worst (very unlikely but very possible) case. >Thank you all the kind people who have set me as there signature. >Please help me fight this evil Yerrickafee virus scanner which also has no >version for linux :-) What could be more cross-platform than text? GNU/Linux has ASCII too, just like DOS (except for line endings, which are DOS-style on Usenet IIRC). And Linux doesn't need virus scanners, as system EXEs cannot be overwritten by a user program. -- Damian Yerrick http://yerricde.tripod.com/ Comment on story ideas: http://home1.gte.net/frodo/quickjot.html AOL is sucks! Find out why: http://anti-aol.org/faqs/aas/ View full sig: http://www.rose-hulman.edu/~yerricde/sig.html This is McAfee VirusScan. Add these two lines to your .sig to prevent the spread of .sig viruses. http://www.mcafee.com/