static void draw_priority_sprites(osd_bitmap bitmap, int prioritylayer)
	{
		int offs;
	
		/* sprites must be drawn in this order to get correct priority */
		for (offs = 0;offs < spriteram_size[0];offs += 8)
		{
			int i,incr,code,col,flipx,flipy,sx,sy;
	
	
			if (prioritylayer==0 || (prioritylayer!=0 && (spriteram.read(offs) & 0x10)!=0))
			{
				code = spriteram.read(offs+4) + ((spriteram.read(offs+5) & 0x07) << 8);
				col = spriteram.read(offs+0) & 0x0f;
				sx = 256 * (spriteram.read(offs+7) & 1) + spriteram.read(offs+6);
				sy = 256+128-15 - (256 * (spriteram.read(offs+3) & 1) + spriteram.read(offs+2));
				flipx = spriteram.read(offs+5) & 0x40;
				flipy = spriteram.read(offs+5) & 0x80;
	
				i = sprite_height_prom.read((code >> 5) & 0x1f);
				if (i == 1)	/* double height */
				{
					code &= ~1;
					sy -= 16;
				}
				else if (i == 2)	/* quadruple height */
				{
					i = 3;
					code &= ~3;
					sy -= 3*16;
				}
	
				if (flipscreen != 0)
				{
					sx = 496 - sx;
					sy = 242 - i*16 - sy;	/* sprites are slightly misplaced by the hardware */
					flipx = NOT(flipx);
					flipy = NOT(flipy);
				}
	
				if (flipy != 0)
				{
					incr = -1;
					code += i;
				}
				else incr = 1;
	
				do
				{
					drawgfx(bitmap,Machine.gfx[1],
							code + i * incr,col,
							flipx,flipy,
							sx,sy + 16 * i,
							Machine.drv.visible_area,TRANSPARENCY_PEN,0);
	
					i--;
				} while (i >= 0);
			}
		}
	}