public static void wbml_backgroundrefresh(osd_bitmap bitmap, int trasp) {
        int page;

        int xscroll = (bg_ram[0x7c0] >> 1) + ((bg_ram[0x7c1] & 1) << 7) - 256 + 5;
        int yscroll = -bg_ram[0x7ba];

        for (page = 0; page < 4; page++) {
            //const unsigned char *source = bg_ram + (bg_ram[0x0740 + page*2] & 0x07)*0x800;
            UBytePtr source = new UBytePtr(bg_ram, (bg_ram[0x0740 + page * 2] & 0x07) * 0x800);
            int startx = (page & 1) * 256 + xscroll;
            int starty = (page >> 1) * 256 + yscroll;
            int row, col;

            for (row = 0; row < 32 * 8; row += 8) {
                for (col = 0; col < 32 * 8; col += 8) {
                    int code, priority;
                    int x = (startx + col) & 0x1ff;
                    int y = (starty + row) & 0x1ff;
                    if (x > 256) {
                        x -= 512;
                    }
                    if (y > 224) {
                        y -= 512;
                    }

                    if (x > -8 && y > -8) {
                        code = source.read(0) + (source.read(1) << 8);
                        priority = code & 0x800;
                        code = ((code >> 4) & 0x800) | (code & 0x7ff);

                        if (trasp == 0) {
                            drawgfx(bitmap, Machine.gfx[0],
                                    code,
                                    ((code >> 5) & 0x3f) + 64,
                                    0, 0,
                                    x, y,
                                    Machine.drv.visible_area, TRANSPARENCY_NONE, 0);
                        } else if (priority != 0) {
                            drawgfx(bitmap, Machine.gfx[0],
                                    code,
                                    ((code >> 5) & 0x3f) + 64,
                                    0, 0,
                                    x, y,
                                    Machine.drv.visible_area, TRANSPARENCY_PEN, 0);
                        }
                    }

                    source.inc(2);//source+=2;
                }
            }
        } /* next page */

    }