Using AND OR to do blitting is a waste unless you are in GDI or something. This technique requires two blits and is wasteful.
Without MMX the most you can blit at one time is:
8 bits per pixel - 4 pixels
16 bits per pixel - 2 pixels
32 bit per pixel - 1 pixel
A stosd is the most you can blit without using SIMD instructions.
This blit does not take into account the edges of the screen. It also does not take into account transparent pixels or alpha.
void Blit(DWORD *pScreen,RGBA *pImage,int x,int y,int image_width,int image_height,int buffer_pitch)
unsigned long buffer_offset = y * buffer_pitch + x;
unsigned long actual_buffer_offset = buffer_offset;
unsigned long image_offset = 0;
int y_counter = 0;
int x_counter = 0;
while (y_counter < image_height)
pScreen[actual_buffer_offset] = pImage[image_offset];
if (x_counter > image_width)
x_counter = 0;
buffer_offset += buffer_pitch;
actual_buffer_offset = buffer_offset;