static void RenderSprite(osd_bitmap bitmap, int spr_number) {
        int SprX, SprY, Col, Row, Height, src;
        int bank;
        UBytePtr SprReg = new UBytePtr();//unsigned char *SprReg;
        UBytePtr SprPalette = new UBytePtr();//unsigned short *SprPalette;
        short skip;	/* bytes to skip before drawing each row (can be negative) */


        SprReg.set(spriteram, 0x10 * spr_number);//SprReg		= spriteram + 0x10 * spr_number;

        src = SprReg.read(SPR_GFXOFS_LO) + (SprReg.read(SPR_GFXOFS_HI) << 8);
        bank = 0x8000 * (((SprReg.read(SPR_X_HI) & 0x80) >> 7) + ((SprReg.read(SPR_X_HI) & 0x40) >> 5));
        bank &= (memory_region_length(REGION_GFX2) - 1);	/* limit to the range of available ROMs */

        skip = (short) (SprReg.read(SPR_SKIP_LO) + (SprReg.read(SPR_SKIP_HI) << 8));

        Height = SprReg.read(SPR_Y_BOTTOM) - SprReg.read(SPR_Y_TOP);
        SprPalette.set(Machine.remapped_colortable, 0x10 * spr_number);//SprPalette	= Machine.remapped_colortable + 0x10 * spr_number;
        SprX = SprReg.read(SPR_X_LO) + ((SprReg.read(SPR_X_HI) & 0x01) << 8);
        SprX /= 2;	/* the hardware has sub-pixel placement, it seems */

        if (Machine.gamedrv == driver_wbml || Machine.gamedrv.clone_of == driver_wbml) {
            SprX += 7;
        }
        SprY = SprReg.read(SPR_Y_TOP) + 1;

        for (Row = 0; Row < Height; Row++) {
            src += skip;

            Col = 0;
            while (Col < 256) /* this is only a safety check, */ /* drawing is stopped by color == 15 */ {
                int color1, color2;

                if ((src & 0x8000) != 0) /* flip x */ {
                    int offs, data;

                    offs = ((src - Col / 2) & 0x7fff) + bank;

                    /* memory region #2 contains the packed sprite data */
                    data = memory_region(REGION_GFX2).read(offs);
                    color1 = data & 0x0f;
                    color2 = data >> 4;
                } else {
                    int offs, data;

                    offs = ((src + Col / 2) & 0x7fff) + bank;

                    /* memory region #2 contains the packed sprite data */
                    data = memory_region(REGION_GFX2).read(offs);
                    color1 = data >> 4;
                    color2 = data & 0x0f;
                }

                if (color1 == 15) {
                    break;
                }
                if (color1 != 0) {
                    Pixel(bitmap, SprX + Col, SprY + Row, spr_number, SprPalette.read(color1));
                }

                Col++;

                if (color2 == 15) {
                    break;
                }
                if (color2 != 0) {
                    Pixel(bitmap, SprX + Col, SprY + Row, spr_number, SprPalette.read(color2));
                }

                Col++;
            }
        }
    }