Mail Archives: djgpp/1998/01/10/18:30:35
HackerOC3 wrote:
>
> I am using mode 13h, and the book I am using has examples to access
> the video buffer. This is what it says to do to fill the screen:
>
> #define SCREEN_WIDTH unsigned int
> #define SCREEN_HEIGHT
huh??? if this really is what the book says, THROW IT OUT.
>
> unsigned char far *video_buffer =(char far *)0xA0000000L;
>
> void Fill_Screen(int value)
> {
>
> _fmemset(video_buffer,(char)value,SCREEN_WIDTH*SCREEN_HEIGHT+1);
>
> }
>
> dos.h, conio.h, stdio.h, are #included
>
> I always get parse errors. I don't know what to do, and I need to get
> this done fast. Please help!
of course, you'll get parse errors. with the macros expanded, the line
above becomes
_fmemset(video_buffer, (char)value, unsigned int* +1)
in any case, this would work only with a particular ms compiler.
for examples of how to switch to mode 0x13 etc, you can take a look at:
http://www.people.cornell.edu/pages/asu1/samples/index.html#Putpixel
once you are in mode 0x13, you can use the following function:
(untested, by the way)
#include <sys/farptr.h>
#include <go32.h>
void FillScrVGA13_1(unsigned color)
{
int i;
unsigned c = (color << 24)|(color << 16)|(color << 8)|color;
_farsetsel(_dos_ds);
for(i=0; i<64000; i+=4)
_farnspokel(_dos_ds, 0xa0000+i, c);
_farsetsel(_my_ds());
return;
}
compiled with -O2, this should be reasonably fast.
--
----------------------------------------------------------------------
A. Sinan Unur
Department of Policy Analysis and Management, College of Human Ecology,
Cornell University, Ithaca, NY 14853, USA
mailto:sinan DOT unur AT cornell DOT edu
http://www.people.cornell.edu/pages/asu1/
- Raw text -