/* Function: FDV_PIXEL_FAST
Purpose: Plot a pixel to the VGA Screen (320x200x256)
Parameters: x = Horizontal Screen Position ( Value: 0 < x < 320 )
y = Vertical Screen Position ( Value: 0 < y < 200 )
cor = pixel color (Value: 0 < cor < 256)
Compiler: Watcom C/C++ 11.0 (32bit Protected Mode - DOS4GW)
Author: Fabio D. Vecchia
Extracted from Fabio Vecchia's Game Library (c) 1995 - (FDV_LB95)
*/
// Initializing the screen buffer
unsigned char *buf_tela=(unsigned char *)0x0a0000;
void fdv_pixel_fast(long x, long y, unsigned char cor)
{
buf_tela[(y<<8) + (y<<6) + x]=cor;
}
/* Comment: What does the expression [(y<<8) + (y<<6) + x] mean?
It is similar to [y*320+x], but it is much faster, because
shift (<< or >>) operations require less CPU usage than
multiplying operations.
Comparing: y<<8 = y*256
y<<6 = y*64
Then, (y<<8) + (y<<6) = (y*256) + (y*64) = y*320
So, (y<<8) + (y<<6) + x = y*320+x
*/
Text file Source (historic): geocities.com/fdvbuzzard
(to report bad content: archivehelp @ gmail)
|
|
|
|
|