void* memset(void *dst, int c, uint n) { if ((int)dst%4 == 0 && n%4 == 0){ c &= 0xFF; stosl(dst, (c<<24)|(c<<16)|(c<<8)|c, n/4); } else stosb(dst, c, n); return dst; }
void drawColorRectangle(unsigned short x, unsigned short y, unsigned short width, unsigned short height, unsigned char colorIndex) { long color = lookUpCLUTIndex(colorIndex, VIDEO(depth)); long pixelBytes = VIDEO(depth) / 8; char * vram = (char *) VIDEO(baseAddr) + VIDEO(rowBytes) * y + pixelBytes * x; width = MIN(width, VIDEO(width) - x); height = MIN(height, VIDEO(height) - y); int rem = (pixelBytes * width) % 4; int length = pixelBytes * width / 4; while (height--) { bcopy(&color, vram, rem); stosl(vram + rem, color, length); vram += VIDEO(rowBytes); } }