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.
While we're in C++, let's avoid #define's that we can... and use inline.
inline void PlotPixel(int x, int y, char colour)
{
video_buffer[320*y + x] = colour;
}
--- Maximus/2 3.01
---------------
* Origin: Tanktalus' Tower BBS (PVT) (1:342/708)
|