Mail Archives: djgpp/1996/05/21/04:52:09
Austin Appleby (a.k.a. Tanjent) (applea AT weiss DOT che DOT utexas DOT edu) wrote:
: unsigned long *videoptr = (unsigned long *)0xA0000;
: unsigned char buff[320*200];
: unsigned long *sbuffptr = &char[0];
: dumpscrn() {
: int i;
: __djgpp_nearptr_enable();
: for(i=0;i<320*50;i++) {
: videoptr[4*i + __djgpp_conventional_base] = sbuffptr[i];
: }
: __djgpp_nearptr_disable();
: }
This doesn't look very speedy to me. The near pointer enabling and disabling
is slow. (I prefer to do it once at the beginning and end of my program, not
once per frame.) Also, the (320*50) must be calculated for every iteration
of the loop, as well as the (4*i) and the add. Why not just make an inline
assembler function to do it. That seems fastest to me. Something like:
mov esi, (pointer to Virtual Screen)
mov edi, (pointer ~csc/sample/ada/to VGA Memory)
mov ecx, 16000 (320*200 / 4 (for ~csc/sample/ada/dwords))
rep
movsl
(This code may not be exactly correct, but it gets the idea across)
--
_____ ___________
|\ \|\ \
_____ _____ | \ \ \ _____\
|\ \|\ \ \ \ \ \ \ |
| \ \ \ \ _____\ \ \ \______
\ \ \ \ \ |\ \ \ \
\ \ \ \ \ | \_____ \ \ _____\
_____\ \ \ \_____ \ | \ \ \ \ |
|\ \ \ \ \|______\ \ \ \___|
| \__________\ \_________\ |\ \ \ \
\ | | | | | \___________\ \____\
\|__________|\|_________| \ | | | |
\|___________|\|____|
- Raw text -