On (11 Apr 97) Danial Gibson wrote to Eric Yale...
EY> The following works well and is also fairly fast:
EY> void Plot_Pixel(int x, int y, char color)
EY> {
EY> // using the fact that 320*y = 256*y + 64*y = y<<8 +y<<6.
EY> video_buffer[((Y<<8) + (y<<6)) + x] = color;
EY> }
DG> You should actually #define a similar Plot_Pixel as this one has too
DG> much overhead for some cpu's. (ie. a far jump, pushing and popping the
DG> stack etc). The #define is usually a lot faster method.
Keeping in mind that this echo is devoted to C++, you might want to
simply use an inline function instead:
void inline Plot_Pixel(int x, int y, char color) // ...
also note that C++ is case sensitive, so you have to be careful of the
typos ('Y' vs. 'y' above...)
Later,
Jerry.
... The Universe is a figment of its own imagination.
--- PPoint 1.90
---------------
* Origin: Point Pointedly Pointless (1:128/166.5)
|