Graphics in DJGPP

Started by
3 comments, last by Rene 24 years, 6 months ago
Making putpixel to backbuffer is fairly
easy; all you need is to allocate backbuffer
and write to it;

char *backbuffer;
...
backbuffer = (char*) malloc (64000);
...
*(backbuffer + x + y*320) = color;
(assuming 320x200x256 mode)

However, copying this to video memory is a bit trickier. As I don't have my sources nearby right now, I suggest that you check help (hmm... RHIDE's help will do nicely), function that could do the job is _dosmemput or something like that. You will need video memory's base address (0xa0000 - note 4 0's!) and it's size (64000 bytes) in addition of backbuffer address.

Of course, this isn't fastests possible way to do flipping, but faster methods are even trickier...

Advertisement
If you have DJGPP you should get ALLEGRO at once !!!!

------------------
Programming is an art

Programming is an art
Actually i really wanted to know how i can make a putpixel that can plot pixels on both a virtual screen the realscreen. Like this:

char *VirtualScreen=malloc(64000);
putpixel(x,y,color,0xa0000);
putpixel(x,y,color,VirtualScreen);
flip(0xa0000,VirtualScreen);

Is there some books which can help with this subject. Memory in protected mode is a bit confusing.

Thank you....

How can i make a putpixel routine that can plot pixels on both a virtual screen and the VGA screen. Something like this.

putpixel(int x, int y, int color, char*scr)

I also need a flip routine but how can this be done. Those i have made just generate a general page fault.

Please help me...
Thanks....

Try this link and look around.

This topic is closed to new replies.

Advertisement