static void kungfum_draw_background(osd_bitmap bitmap)
	{
		int offs,i;
	
	
		/* for every character in the Video RAM, check if it has been modified */
		/* since last time and update it accordingly. */
		for (offs = videoram_size[0]/2 - 1;offs >= 0;offs--)
		{
			if (dirtybuffer[offs]!=0 || dirtybuffer[offs+0x800]!=0)
			{
				int sx,sy,flipx,flipy;
	
	
				dirtybuffer[offs] = dirtybuffer[offs+0x800] = 0;
	
				sx = offs % 64;
				sy = offs / 64;
				flipx = videoram.read(offs+0x800) & 0x20;
				flipy = 0;
				if (flipscreen != 0)
				{
					sx = 63 - sx;
					sy = 31 - sy;
					flipx = NOT(flipx);
					flipy = NOT(flipy);
				}
	
				drawgfx(tmpbitmap,Machine.gfx[0],
						videoram.read(offs) + 4 * (videoram.read(offs+0x800) & 0xc0),
						videoram.read(offs+0x800) & 0x1f,
						flipx,flipy,
						8*sx,8*sy,
						null,TRANSPARENCY_NONE,0);
			}
		}
	
	
		/* copy the temporary bitmap to the screen */
		{
			int[] scrollx=new int[32];
	
	
			if (flipscreen != 0)
			{
				for (i = 31;i > 25;i--)
					scrollx[i] = 0;
				for (i = 25;i >= 0;i--)
					scrollx[i] = irem_background_hscroll;
			}
			else
			{
				for (i = 0;i < 6;i++)
					scrollx[i] = 0;
				for (i = 6;i < 32;i++)
					scrollx[i] = -irem_background_hscroll;
			}
	
			copyscrollbitmap(bitmap,tmpbitmap,32,scrollx,0,null,Machine.drv.visible_area,TRANSPARENCY_NONE,0);
		}
	}