bci_ptr = s3vPriv.BciMem;
BCI_RESET;
void SavageWriteBitmapCPUToScreenColorExpand(    int x, int y, int w, int h,    unsigned char * src,    int srcwidth,    int srcx, int srcy,    int bg, int fg,    int rop,    unsigned int planemask){    BCI_GET_PTR;    int i, j, count, shift, reset;    unsigned int cmd;    unsigned int * srcp;/* We aren't using planemask at all here... */    cmd = BCI_CMD_RECT | BCI_CMD_RECT_XP | BCI_CMD_RECT_YP        | BCI_CMD_SEND_COLOR | BCI_CMD_CLIP_LR        | BCI_CMD_DEST_GBD | BCI_CMD_SRC_MONO;    cmd |= s3vAlu[rop];    if( !srcwidth )        return;    BCI_SEND(cmd);    BCI_SEND(BCI_CLIP_LR(x, x+w-1));    BCI_SEND(fg);    BCI_SEND(bg);    /* Bitmaps come in in units of DWORDS, LSBFirst.  This is exactly */    /* reversed of what we expect.  */    x -= srcx & 31;    w += srcx & 31;    count = (w + 31) / 32;    src += (srcy * srcwidth) + ((srcx & ~31) / 8);    /* The BCI region is 128k bytes.  A screen-sized mono bitmap can */    /* exceed that. */    reset = 65536 / srcwidth;        for (j = 0; j < h; j ++) {        BCI_SEND(BCI_X_Y(x, y+j));	BCI_SEND(BCI_W_H(w, 1));	srcp = (unsigned int*) src;	for (i = count; i > 0; srcp ++, i --) {	    /* We have to invert the bits in each byte. */	    unsigned long u = *srcp;	    u = ((u & 0x0f0f0f0f) << 4) | ((u & 0xf0f0f0f0) >> 4);	    u = ((u & 0x33333333) << 2) | ((u & 0xcccccccc) >> 2);	    u = ((u & 0x55555555) << 1) | ((u & 0xaaaaaaaa) >> 1);	    BCI_SEND(u);	}	src += srcwidth;        if( !--reset ) {            bci_ptr = s3vPriv.BciMem;            reset = 65536 / srcwidth;        }    }}