static void mark_sprite_colors(){
		UShortPtr source = new UShortPtr(sys16_spriteram);
		UShortPtr finish = new UShortPtr(source,NUM_SPRITES*8);
		int pal_start=1024,pal_size=64;
	
		char[] used=new char[128];
		memset( used, 0, 128 );
	
		switch( sys16_spritesystem ){
			case 1: /* standard sprite hardware */
				do{
					if( source.read(0)>>8 == 0xff || source.read(2) == sys16_spritelist_end) break;
					used[source.read(4)&0x3f] = 1;
					source.offset+=8*2;
				}while( source.offset<finish.offset );
				break;
/*TODO*///			case 4: /* Aurail */
/*TODO*///				do{
/*TODO*///					if( (source[2]) == sys16_spritelist_end) break;
/*TODO*///					used[source[4]&0x3f] = 1;
/*TODO*///					source+=8;
/*TODO*///				}while( source<finish );
/*TODO*///				break;
/*TODO*///	
/*TODO*///			case 3:	/* Fantzone */
/*TODO*///			case 5:	/* Hang-On */
/*TODO*///			case 2: /* Quartet2 / alex kidd + others */
/*TODO*///				do{
/*TODO*///					if( (source[0]>>8) == 0xff ) break;;
/*TODO*///					used[(source[4]>>8)&0x3f] = 1;
/*TODO*///					source+=8;
/*TODO*///				}while( source<finish );
/*TODO*///				break;
/*TODO*///			case 6:	/* Space Harrier */
/*TODO*///				do{
/*TODO*///					if( (source[0]>>8) == 0xff ) break;;
/*TODO*///					used[(source[2]>>8)&0x3f] = 1;
/*TODO*///					source+=8;
/*TODO*///				}while( source<finish );
/*TODO*///				break;
/*TODO*///			case 7:	/* Out Run */
/*TODO*///				do{
/*TODO*///					if( (source[0]) == 0xffff ) break;;
/*TODO*///					used[(source[5])&0x7f] = 1;
/*TODO*///					source+=8;
/*TODO*///				}while( source<finish );
/*TODO*///				pal_start=2048;
/*TODO*///				pal_size=128;
/*TODO*///				break;
/*TODO*///			case 0: /* passing shot */
/*TODO*///			case 8: /* passing shot 4p */
/*TODO*///				do{
/*TODO*///					if( source[1]!=0xffff ) used[(source[5]>>8)&0x3f] = 1;
/*TODO*///					source+=8;
/*TODO*///				}while( source<finish );
/*TODO*///				break;
		}
	
		{
			UBytePtr pal = new UBytePtr(palette_used_colors,pal_start);
			int i;
			for (i = 0; i < pal_size; i++){
				if ( used[i]!=0 ){
					pal.write(0,  PALETTE_COLOR_UNUSED);
					memset( pal,1,PALETTE_COLOR_USED,14 );
					pal.write(15, PALETTE_COLOR_UNUSED);
				}
				else {
					memset( pal, PALETTE_COLOR_UNUSED, 16 );
				}
				pal.offset += 16;
			}
		}
		if (Machine.scrbitmap.depth == 8) /* 8 bit shadows */
		{
			memset(palette_used_colors,Machine.drv.total_colors/2, PALETTE_COLOR_USED, sys16_MaxShadowColors);
		}
/*TODO*///		else if(sys16_MaxShadowColors != 0) /* 16 bit shadows */
/*TODO*///		{
/*TODO*///			/* Mark the shadowed versions of the used pens */
/*TODO*///			memcpy(&palette_used_colors[Machine.drv.total_colors/2], &palette_used_colors[0], Machine.drv.total_colors/2);
/*TODO*///		}
	}