Example #1
0
PALETTE_INIT_MEMBER(equites_state,splndrbt)
{
	const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
	int i;

	machine().colortable = colortable_alloc(machine(), 256);

	for (i = 0; i < 0x100; i++)
		colortable_palette_set_color(machine().colortable, i, MAKE_RGB(pal4bit(color_prom[i]), pal4bit(color_prom[i + 0x100]), pal4bit(color_prom[i + 0x200])));

	for (i = 0; i < 0x100; i++)
		colortable_entry_set_value(machine().colortable, i, i);

	// point to the bg CLUT
	color_prom += 0x300;

	for (i = 0; i < 0x80; i++)
		colortable_entry_set_value(machine().colortable, i + 0x100, color_prom[i] + 0x10);

	// point to the sprite CLUT
	color_prom += 0x100;

	for (i = 0; i < 0x100; i++)
		colortable_entry_set_value(machine().colortable, i + 0x180, color_prom[i]);
}
Example #2
0
void megazone_state::palette_init()
{
	const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
	static const int resistances_rg[3] = { 1000, 470, 220 };
	static const int resistances_b [2] = { 470, 220 };
	double rweights[3], gweights[3], bweights[2];
	int i;

	/* compute the color output resistor weights */
	compute_resistor_weights(0,	255, -1.0,
			3, &resistances_rg[0], rweights, 1000, 0,
			3, &resistances_rg[0], gweights, 1000, 0,
			2, &resistances_b[0],  bweights, 1000, 0);

	/* allocate the colortable */
	machine().colortable = colortable_alloc(machine(), 0x20);

	/* create a lookup table for the palette */
	for (i = 0; i < 0x20; i++)
	{
		int bit0, bit1, bit2;
		int r, g, b;

		/* red component */
		bit0 = BIT(color_prom[i], 0);
		bit1 = BIT(color_prom[i], 1);
		bit2 = BIT(color_prom[i], 2);
		r = combine_3_weights(rweights, bit0, bit1, bit2);

		/* green component */
		bit0 = BIT(color_prom[i], 3);
		bit1 = BIT(color_prom[i], 4);
		bit2 = BIT(color_prom[i], 5);
		g = combine_3_weights(gweights, bit0, bit1, bit2);

		/* blue component */
		bit0 = BIT(color_prom[i], 6);
		bit1 = BIT(color_prom[i], 7);
		b = combine_2_weights(bweights, bit0, bit1);

		colortable_palette_set_color(machine().colortable, i, MAKE_RGB(r, g, b));
	}

	/* color_prom now points to the beginning of the lookup table */
	color_prom += 0x20;

	/* sprites */
	for (i = 0; i < 0x100; i++)
	{
		UINT8 ctabentry = color_prom[i] & 0x0f;
		colortable_entry_set_value(machine().colortable, i, ctabentry);
	}

	/* characters */
	for (i = 0x100; i < 0x200; i++)
	{
		UINT8 ctabentry = (color_prom[i] & 0x0f) | 0x10;
		colortable_entry_set_value(machine().colortable, i, ctabentry);
	}
}
Example #3
0
void retofinv_state::palette_init()
{
	const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
	int i;

	/* allocate the colortable */
	machine().colortable = colortable_alloc(machine(), 0x100);

	/* create a lookup table for the palette */
	for (i = 0; i < 0x100; i++)
	{
		int r = pal4bit(color_prom[i + 0x000]);
		int g = pal4bit(color_prom[i + 0x100]);
		int b = pal4bit(color_prom[i + 0x200]);

		colortable_palette_set_color(machine().colortable, i, MAKE_RGB(r, g, b));
	}

	/* color_prom now points to the beginning of the lookup table */
	color_prom += 0x300;


	/* fg chars (1bpp) */
	for (i = 0; i < 0x200; i++)
	{
		UINT8 ctabentry;

		if (i & 0x01)
			ctabentry = i >> 1;
		else
			ctabentry = 0;

		colortable_entry_set_value(machine().colortable, i, ctabentry);
	}
Example #4
0
void jailbrek_state::palette_init()
{
	const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
	int i;

	/* allocate the colortable */
	machine().colortable = colortable_alloc(machine(), 0x20);

	/* create a lookup table for the palette */
	for (i = 0; i < 0x20; i++)
	{
		int r = pal4bit(color_prom[i + 0x00] >> 0);
		int g = pal4bit(color_prom[i + 0x00] >> 4);
		int b = pal4bit(color_prom[i + 0x20] >> 0);

		colortable_palette_set_color(machine().colortable, i, MAKE_RGB(r, g, b));
	}

	/* color_prom now points to the beginning of the lookup table */
	color_prom += 0x40;

	for (i = 0; i < 0x100; i++)
	{
		UINT8 ctabentry = (color_prom[i] & 0x0f) | 0x10;
		colortable_entry_set_value(machine().colortable, i, ctabentry);
	}

	for (i = 0x100; i < 0x200; i++)
	{
		UINT8 ctabentry = color_prom[i] & 0x0f;
		colortable_entry_set_value(machine().colortable, i, ctabentry);
	}
}
Example #5
0
void mermaid_state::palette_init()
{
	const UINT8 *color_prom = memregion("proms")->base();
	int i;

	/* allocate the colortable */
	machine().colortable = colortable_alloc(machine(), 0x41);

	for (i = 0; i < 0x40; i++)
	{
		int r = 0x21 * BIT(color_prom[i], 0) + 0x47 * BIT(color_prom[i], 1) + 0x97 * BIT(color_prom[i], 2);
		int g = 0x21 * BIT(color_prom[i], 3) + 0x47 * BIT(color_prom[i], 4) + 0x97 * BIT(color_prom[i], 5);
		int b =                                0x47 * BIT(color_prom[i], 6) + 0x97 * BIT(color_prom[i], 7);

		colortable_palette_set_color(machine().colortable, i, MAKE_RGB(r, g, b));
	}

	/* blue background */
	colortable_palette_set_color(machine().colortable, 0x40, MAKE_RGB(0, 0, 0xff));

	/* char/sprite palette */
	for (i = 0; i < 0x40; i++)
		colortable_entry_set_value(machine().colortable, i, i);

	/* background palette */
	colortable_entry_set_value(machine().colortable, 0x40, 0x20);
	colortable_entry_set_value(machine().colortable, 0x41, 0x21);
	colortable_entry_set_value(machine().colortable, 0x42, 0x40);
	colortable_entry_set_value(machine().colortable, 0x43, 0x21);
}
Example #6
0
static PALETTE_INIT( intv )
{
	int k = 0;

	UINT8 i, j, r, g, b;
	/* Two copies of everything (why?) */

	machine.colortable = colortable_alloc(machine, 32);

	for ( i = 0; i < 16; i++ )
	{
		r = intv_colors[i*3]; g = intv_colors[i*3+1]; b = intv_colors[i*3+2];
		colortable_palette_set_color(machine.colortable, i, MAKE_RGB(r, g, b));
		colortable_palette_set_color(machine.colortable, i + 16, MAKE_RGB(r, g, b));
	}

	for(i=0;i<16;i++)
	{
		for(j=0;j<16;j++)
		{
		colortable_entry_set_value(machine.colortable, k++, i);
		colortable_entry_set_value(machine.colortable, k++, j);
		}
	}

	for(i=0;i<16;i++)
	{
		for(j=16;j<32;j++)
		{
			colortable_entry_set_value(machine.colortable, k++, i);
			colortable_entry_set_value(machine.colortable, k++, j);
		}
	}
}
Example #7
0
void strnskil_state::palette_init()
{
	const UINT8 *color_prom = memregion("proms")->base();
	int i;

	/* allocate the colortable */
	machine().colortable = colortable_alloc(machine(), 0x100);

	/* create a lookup table for the palette */
	for (i = 0; i < 0x100; i++)
	{
		int r = pal4bit(color_prom[i + 0x000]);
		int g = pal4bit(color_prom[i + 0x100]);
		int b = pal4bit(color_prom[i + 0x200]);

		colortable_palette_set_color(machine().colortable, i, MAKE_RGB(r, g, b));
	}

	/* color_prom now points to the beginning of the lookup table */
	color_prom += 0x300;

	/* sprites lookup table */
	for (i = 0; i < 0x400; i++)
	{
		UINT8 ctabentry = color_prom[i];
		colortable_entry_set_value(machine().colortable, i, ctabentry);
	}
}
Example #8
0
void contra_state::palette_init()
{
	const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
	int chip;

	/* allocate the colortable */
	machine().colortable = colortable_alloc(machine(), 0x80);

	for (chip = 0; chip < 2; chip++)
	{
		int pal;

		for (pal = 0; pal < 8; pal++)
		{
			int i;
			int clut = (chip << 1) | (pal & 1);

			for (i = 0; i < 0x100; i++)
			{
				UINT8 ctabentry;

				if (((pal & 0x01) == 0) && (color_prom[(clut << 8) | i] == 0))
					ctabentry = 0;
				else
					ctabentry = (pal << 4) | (color_prom[(clut << 8) | i] & 0x0f);

				colortable_entry_set_value(machine().colortable, (chip << 11) | (pal << 8) | i, ctabentry);
			}
		}
	}
}
Example #9
0
static PALETTE_INIT( bsktball )
{
	int i;

	machine.colortable = colortable_alloc(machine, 4);

	colortable_palette_set_color(machine.colortable,0,MAKE_RGB(0x00,0x00,0x00)); /* BLACK */
	colortable_palette_set_color(machine.colortable,1,MAKE_RGB(0x80,0x80,0x80)); /* LIGHT GREY */
	colortable_palette_set_color(machine.colortable,2,MAKE_RGB(0x50,0x50,0x50)); /* DARK GREY */
	colortable_palette_set_color(machine.colortable,3,MAKE_RGB(0xff,0xff,0xff)); /* WHITE */

	/* playfield */
	for (i = 0; i < 2; i++)
	{
		colortable_entry_set_value(machine.colortable, i*4 + 0, 1);
		colortable_entry_set_value(machine.colortable, i*4 + 1, 3 * i);
		colortable_entry_set_value(machine.colortable, i*4 + 2, 3 * i);
		colortable_entry_set_value(machine.colortable, i*4 + 3, 3 * i);
	}

	/* motion */
	for (i = 0; i < 4*4*4; i++)
	{
		colortable_entry_set_value(machine.colortable, 2*4 + i*4 + 0, 1);
		colortable_entry_set_value(machine.colortable, 2*4 + i*4 + 1, (i >> 2) & 3);
		colortable_entry_set_value(machine.colortable, 2*4 + i*4 + 2, (i >> 0) & 3);
		colortable_entry_set_value(machine.colortable, 2*4 + i*4 + 3, (i >> 4) & 3);
	}
}
Example #10
0
void darkmist_state::palette_init()
{
	const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
	int i;

	/* allocate the colortable */
	machine().colortable = colortable_alloc(machine(), 0x101);

	for (i = 0; i < 0x400; i++)
	{
		int ctabentry;

		if (color_prom[i] & 0x40)
			ctabentry = 0x100;
		else
		{
			ctabentry = (color_prom[i] & 0x3f);

			switch (i & 0x300)
			{
			case 0x000:  ctabentry = ctabentry | 0x80; break;
			case 0x100:  ctabentry = ctabentry | 0x00; break;
			case 0x200:  ctabentry = ctabentry | 0x40; break;
			case 0x300:  ctabentry = ctabentry | 0xc0; break;
			}
		}

		colortable_entry_set_value(machine().colortable, i, ctabentry);
	}
}
Example #11
0
PALETTE_INIT_MEMBER(clshroad_state,firebatl)
{
	const UINT8 *color_prom = memregion("proms")->base();
	int i;

	/* allocate the colortable */
	machine().colortable = colortable_alloc(machine(), 0x100);

	/* create a lookup table for the palette */
	for (i = 0; i < 0x100; i++)
	{
		int r = pal4bit(color_prom[i + 0x000]);
		int g = pal4bit(color_prom[i + 0x100]);
		int b = pal4bit(color_prom[i + 0x200]);

		colortable_palette_set_color(machine().colortable, i, MAKE_RGB(r, g, b));
	}

	/* color_prom now points to the beginning of the lookup table */
	color_prom += 0x300;

	for (i = 0; i < 0x200; i++)
		colortable_entry_set_value(machine().colortable, i, i & 0xff);

	for (i = 0x200; i < 0x300; i++)
	{
		UINT8 ctabentry = ((color_prom[(i - 0x200) + 0x000] & 0x0f) << 4) |
							(color_prom[(i - 0x200) + 0x100] & 0x0f);
		colortable_entry_set_value(machine().colortable, i, ctabentry);
	}
}
Example #12
0
static PALETTE_INIT( panicr )
{
    int i;

    /* allocate the colortable */
    machine->colortable = colortable_alloc(machine, 0x100);

    /* create a lookup table for the palette */
    for (i = 0; i < 0x100; i++)
    {
        int r = pal4bit(color_prom[i + 0x000]);
        int g = pal4bit(color_prom[i + 0x100]);
        int b = pal4bit(color_prom[i + 0x200]);

        colortable_palette_set_color(machine->colortable, i, MAKE_RGB(r, g, b));
    }

    /* color_prom now points to the beginning of the lookup table */
    color_prom += 0x300;

    // txt lookup table
    for (i = 0; i < 0x100; i++)
    {
        UINT8 ctabentry;

        if (color_prom[i] & 0x40)
            ctabentry = 0;
        else
            ctabentry = (color_prom[i] & 0x3f) | 0x80;

        colortable_entry_set_value(machine->colortable, i, ctabentry);
    }

    // tile lookup table
    for (i = 0x100; i < 0x200; i++)
    {
        UINT8 ctabentry = (color_prom[i] & 0x3f) | 0x00;

        colortable_entry_set_value(machine->colortable, i, ctabentry);
    }

    // sprite lookup table
    for (i = 0x200; i < 0x300; i++)
    {
        UINT8 ctabentry;

        if (color_prom[i] & 0x40)
            ctabentry = 0;
        else
            ctabentry = (color_prom[i] & 0x3f) | 0x40;

        colortable_entry_set_value(machine->colortable, i, ctabentry);
    }
}
Example #13
0
void aquarius_state::palette_init()
{
	int i;

	machine().colortable = colortable_alloc(machine(), 16);

	for (i = 0; i < 16; i++)
		colortable_palette_set_color(machine().colortable, i, aquarius_colors[i]);

	for (i = 0; i < 512; i++)
		colortable_entry_set_value(machine().colortable, i, aquarius_palette[i]);
}
Example #14
0
void exedexes_state::palette_init()
{
	const UINT8 *color_prom = memregion("proms")->base();
	int i;

	/* allocate the colortable */
	machine().colortable = colortable_alloc(machine(), 0x100);

	/* create a lookup table for the palette */
	for (i = 0; i < 0x100; i++)
	{
		int r = pal4bit(color_prom[i + 0x000]);
		int g = pal4bit(color_prom[i + 0x100]);
		int b = pal4bit(color_prom[i + 0x200]);

		colortable_palette_set_color(machine().colortable, i, MAKE_RGB(r, g, b));
	}

	/* color_prom now points to the beginning of the lookup table */
	color_prom += 0x300;

	/* characters use colors 0xc0-0xcf */
	for (i = 0; i < 0x100; i++)
	{
		UINT8 ctabentry = color_prom[i] | 0xc0;
		colortable_entry_set_value(machine().colortable, i, ctabentry);
	}

	/* 32x32 tiles use colors 0-0x0f */
	for (i = 0x100; i < 0x200; i++)
	{
		UINT8 ctabentry = color_prom[i];
		colortable_entry_set_value(machine().colortable, i, ctabentry);
	}

	/* 16x16 tiles use colors 0x40-0x4f */
	for (i = 0x200; i < 0x300; i++)
	{
		UINT8 ctabentry = color_prom[i] | 0x40;
		colortable_entry_set_value(machine().colortable, i, ctabentry);
	}

	/* sprites use colors 0x80-0xbf in four banks */
	for (i = 0x300; i < 0x400; i++)
	{
		UINT8 ctabentry = color_prom[i] | (color_prom[i + 0x100] << 4) | 0x80;
		colortable_entry_set_value(machine().colortable, i, ctabentry);
	}
}
Example #15
0
PALETTE_INIT_MEMBER(madalien_state,madalien)
{
	const UINT8 *color_prom = memregion("proms")->base();
	int i;

	/* allocate the colortable */
	machine().colortable = colortable_alloc(machine(), 0x20);

	for (i = 0; i < 0x20; i++)
	{
		int r = 0;
		int g = 0;
		int b = 0;

		if (BIT(color_prom[i], 0))
			r += 0x3f;
		if (BIT(color_prom[i], 1))
			r += 0xc0;
		if (BIT(color_prom[i], 2))
			g += 0x3f;
		if (BIT(color_prom[i], 3))
			g += 0xc0;
		if (BIT(color_prom[i], 4))
			b += 0x3f;
		if (BIT(color_prom[i], 5))
			b += 0xc0;

		colortable_palette_set_color(machine().colortable, i, MAKE_RGB(r, g, b));
	}

	for (i = 0; i < 0x10; i++)
		colortable_entry_set_value(machine().colortable, i, i);

	for (i = 0x10; i < 0x20; i++)
	{
		UINT8 ctabentry = i - 0x10;

		if (BIT((i - 0x10), 1))
			ctabentry = ctabentry ^ 0x06;

		if (BIT((i - 0x10), 2))
			ctabentry = ctabentry ^ 0x06;

		colortable_entry_set_value(machine().colortable, i, ctabentry);
	}

	for (i = 0x20; i < 0x30; i++)
		colortable_entry_set_value(machine().colortable, i, (i - 0x20) | 0x10);
}
Example #16
0
void mz_state::palette_init()
{
	int i;

	machine().colortable = colortable_alloc(machine(), 8);

	for (i = 0; i < 8; i++)
		colortable_palette_set_color(machine().colortable, i, MAKE_RGB((i & 2) ? 0xff : 0x00, (i & 4) ? 0xff : 0x00, (i & 1) ? 0xff : 0x00));

	for (i = 0; i < 256; i++)
	{
		colortable_entry_set_value(machine().colortable, i*2, i & 7);
			colortable_entry_set_value(machine().colortable, i*2+1, (i >> 4) & 7);
	}
}
Example #17
0
static PALETTE_INIT( cgenienz )
{
	UINT8 i, r, g, b;

	machine.colortable = colortable_alloc(machine, 49);

	for ( i = 0; i < 49; i++ )
	{
		r = cgenienz_colors[i*3]; g = cgenienz_colors[i*3+1]; b = cgenienz_colors[i*3+2];
		colortable_palette_set_color(machine.colortable, i, MAKE_RGB(r, g, b));
	}

	for(i=0; i<108; i++)
		colortable_entry_set_value(machine.colortable, i, cgenie_palette[i]);
}
Example #18
0
static PALETTE_INIT( madalien )
{
	int i;

	/* allocate the colortable */
	machine->colortable = colortable_alloc(machine, 0x20);

	for (i = 0; i < 0x20; i++)
	{
		int r = 0;
		int g = 0;
		int b = 0;

		if (BIT(color_prom[i], 0))
			r += 0x3f;
		if (BIT(color_prom[i], 1))
			r += 0xc0;
		if (BIT(color_prom[i], 2))
			g += 0x3f;
		if (BIT(color_prom[i], 3))
			g += 0xc0;
		if (BIT(color_prom[i], 4))
			b += 0x3f;
		if (BIT(color_prom[i], 5))
			b += 0xc0;

		colortable_palette_set_color(machine->colortable, i, MAKE_RGB(r, g, b));
	}

	for (i = 0; i < 0x10; i++)
		colortable_entry_set_value(machine->colortable, i, i);

	for (i = 0x10; i < 0x20; i++)
	{
		UINT8 ctabentry = i - 0x10;

		if (BIT((i - 0x10), 1))
			ctabentry = ctabentry ^ 0x06;

		if (BIT((i - 0x10), 2))
			ctabentry = ctabentry ^ 0x06;

		colortable_entry_set_value(machine->colortable, i, ctabentry);
	}

	for (i = 0x20; i < 0x30; i++)
		colortable_entry_set_value(machine->colortable, i, (i - 0x20) | 0x10);
}
Example #19
0
/* Initialise the palette */
static PALETTE_INIT( vtech2 )
{
	int i;

	machine.colortable = colortable_alloc(machine, 16);

	for ( i = 0; i < 16; i++ )
		colortable_palette_set_color(machine.colortable, i, vt_colors[i]);

	for (i = 0; i < 256; i++)
	{
		colortable_entry_set_value(machine.colortable, 2*i, i&15);
		colortable_entry_set_value(machine.colortable, 2*i+1, i>>4);
	}

	for (i = 0; i < 16; i++)
		colortable_entry_set_value(machine.colortable, 512+i, i);
}
Example #20
0
void ddribble_state::palette_init()
{
	const UINT8 *color_prom = memregion("proms")->base();
	int i;

	/* allocate the colortable */
	machine().colortable = colortable_alloc(machine(), 0x40);

	for (i = 0x10; i < 0x40; i++)
		colortable_entry_set_value(machine().colortable, i, i);

	/* sprite #2 uses pens 0x00-0x0f */
	for (i = 0x40; i < 0x140; i++)
	{
		UINT8 ctabentry = color_prom[i - 0x40] & 0x0f;
		colortable_entry_set_value(machine().colortable, i, ctabentry);
	}
}
Example #21
0
void sprint8_state::palette_init()
{
	int i;

	/* allocate the colortable */
	machine().colortable = colortable_alloc(machine(), 0x12);

	for (i = 0; i < 0x10; i++)
	{
		colortable_entry_set_value(machine().colortable, 2 * i + 0, 0x10);
		colortable_entry_set_value(machine().colortable, 2 * i + 1, i);
	}

	colortable_entry_set_value(machine().colortable, 0x20, 0x10);
	colortable_entry_set_value(machine().colortable, 0x21, 0x10);
	colortable_entry_set_value(machine().colortable, 0x22, 0x10);
	colortable_entry_set_value(machine().colortable, 0x23, 0x11);
}
Example #22
0
/* Initialise the palette */
void vtech2_state::palette_init()
{
	int i;

	machine().colortable = colortable_alloc(machine(), 16);

	for ( i = 0; i < 16; i++ )
		colortable_palette_set_color(machine().colortable, i, vt_colors[i]);

	for (i = 0; i < 256; i++)
	{
		colortable_entry_set_value(machine().colortable, 2*i, i&15);
		colortable_entry_set_value(machine().colortable, 2*i+1, i>>4);
	}

	for (i = 0; i < 16; i++)
		colortable_entry_set_value(machine().colortable, 512+i, i);
}
Example #23
0
void ikki_state::palette_init()
{
	const UINT8 *color_prom = memregion("proms")->base();
	int i;

	/* allocate the colortable - extra pen for the punch through pen */
	machine().colortable = colortable_alloc(machine(), 0x101);

	/* create a lookup table for the palette */
	for (i = 0; i < 0x100; i++)
	{
		int r = pal4bit(color_prom[i + 0x000]);
		int g = pal4bit(color_prom[i + 0x100]);
		int b = pal4bit(color_prom[i + 0x200]);

		colortable_palette_set_color(machine().colortable, i, MAKE_RGB(r, g, b));
	}

	/* color_prom now points to the beginning of the lookup table */
	color_prom += 0x300;

	/* sprites lookup table */
	for (i = 0; i < 0x200; i++)
	{
		UINT16 ctabentry = color_prom[i] ^ 0xff;

		if (((i & 0x07) == 0x07) && (ctabentry == 0))
		{
			/* punch through */
			m_punch_through_pen = i;
			ctabentry = 0x100;
		}

		colortable_entry_set_value(machine().colortable, i, ctabentry);
	}

	/* bg lookup table */
	for (i = 0x200; i < 0x400; i++)
	{
		UINT8 ctabentry = color_prom[i];
		colortable_entry_set_value(machine().colortable, i, ctabentry);
	}
}
Example #24
0
void fastlane_state::palette_init()
{
	const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
	int pal;

	/* allocate the colortable */
	machine().colortable = colortable_alloc(machine(), 0x400);

	for (pal = 0; pal < 0x10; pal++)
	{
		int i;

		for (i = 0; i < 0x400; i++)
		{
			UINT8 ctabentry = (i & 0x3f0) | color_prom[(pal << 4) | (i & 0x0f)];
			colortable_entry_set_value(machine().colortable, (pal << 10) | i, ctabentry);
		}
	}
}
Example #25
0
void gunsmoke_state::palette_init()
{
	const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
	int i;

	/* allocate the colortable */
	machine().colortable = colortable_alloc(machine(), 0x100);

	/* create a lookup table for the palette */
	for (i = 0; i < 0x100; i++)
	{
		int r = pal4bit(color_prom[i + 0x000]);
		int g = pal4bit(color_prom[i + 0x100]);
		int b = pal4bit(color_prom[i + 0x200]);

		colortable_palette_set_color(machine().colortable, i, MAKE_RGB(r, g, b));
	}

	/* color_prom now points to the beginning of the lookup table */
	color_prom += 0x300;

	/* characters use colors 0x40-0x4f */
	for (i = 0; i < 0x80; i++)
	{
		UINT8 ctabentry = color_prom[i] | 0x40;
		colortable_entry_set_value(machine().colortable, i, ctabentry);
	}

	/* background tiles use colors 0-0x3f */
	for (i = 0x100; i < 0x200; i++)
	{
		UINT8 ctabentry = color_prom[i] | ((color_prom[i + 0x100] & 0x03) << 4);
		colortable_entry_set_value(machine().colortable, i - 0x80, ctabentry);
	}

	/* sprites use colors 0x80-0xff */
	for (i = 0x300; i < 0x400; i++)
	{
		UINT8 ctabentry = color_prom[i] | ((color_prom[i + 0x100] & 0x07) << 4) | 0x80;
		colortable_entry_set_value(machine().colortable, i - 0x180, ctabentry);
	}
}
Example #26
0
void flower_state::palette_init()
{
	const UINT8 *color_prom = memregion("proms")->base();
	int i;

	/* allocate the colortable */
	machine().colortable = colortable_alloc(machine(), 0x100);

	/* create a lookup table for the palette */
	for (i = 0; i < 0x100; i++)
	{
		int r = pal4bit(color_prom[i + 0x000]);
		int g = pal4bit(color_prom[i + 0x100]);
		int b = pal4bit(color_prom[i + 0x200]);

		colortable_palette_set_color(machine().colortable, i, MAKE_RGB(r, g, b));
	}

	for (i = 0; i < 0x100; i++)
		colortable_entry_set_value(machine().colortable, i, i);
}
Example #27
0
void labyrunr_state::palette_init()
{
	const UINT8 *color_prom = memregion("proms")->base();
	int pal;

	/* allocate the colortable */
	machine().colortable = colortable_alloc(machine(), 0x80);

	for (pal = 0; pal < 8; pal++)
	{
		/* chars, no lookup table */
		if (pal & 1)
		{
			int i;

			for (i = 0; i < 0x100; i++)
				colortable_entry_set_value(machine().colortable, (pal << 8) | i, (pal << 4) | (i & 0x0f));
		}
		/* sprites */
		else
		{
			int i;

			for (i = 0; i < 0x100; i++)
			{
				UINT8 ctabentry;

				if (color_prom[i] == 0)
					ctabentry = 0;
				else
					ctabentry = (pal << 4) | (color_prom[i] & 0x0f);

				colortable_entry_set_value(machine().colortable, (pal << 8) | i, ctabentry);
			}
		}
	}
}
Example #28
0
void sprint2_state::palette_init()
{
	/* allocate the colortable */
	machine().colortable = colortable_alloc(machine(), 4);

	colortable_palette_set_color(machine().colortable, 0, MAKE_RGB(0x00, 0x00, 0x00));
	colortable_palette_set_color(machine().colortable, 1, MAKE_RGB(0x5b, 0x5b, 0x5b));
	colortable_palette_set_color(machine().colortable, 2, MAKE_RGB(0xa4, 0xa4, 0xa4));
	colortable_palette_set_color(machine().colortable, 3, MAKE_RGB(0xff, 0xff, 0xff));

	colortable_entry_set_value(machine().colortable, 0x0, 1);	/* black playfield */
	colortable_entry_set_value(machine().colortable, 0x1, 0);
	colortable_entry_set_value(machine().colortable, 0x2, 1);	/* white playfield */
	colortable_entry_set_value(machine().colortable, 0x3, 3);

	colortable_entry_set_value(machine().colortable, 0x4, 1);	/* car #1 */
	colortable_entry_set_value(machine().colortable, 0x5, 3);
	colortable_entry_set_value(machine().colortable, 0x6, 1);	/* car #2 */
	colortable_entry_set_value(machine().colortable, 0x7, 0);
	colortable_entry_set_value(machine().colortable, 0x8, 1);	/* car #3 */
	colortable_entry_set_value(machine().colortable, 0x9, 2);
	colortable_entry_set_value(machine().colortable, 0xa, 1);	/* car #4 */
	colortable_entry_set_value(machine().colortable, 0xb, 2);
}
Example #29
0
void stfight_state::palette_init()
{
	const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
	int i;

	/* allocate the colortable */
	machine().colortable = colortable_alloc(machine(), 0x100);

	/* text uses colors 0xc0-0xcf */
	for (i = 0; i < 0x40; i++)
	{
		UINT8 ctabentry = (color_prom[i] & 0x0f) | 0xc0;
		colortable_entry_set_value(machine().colortable, i, ctabentry);
	}

	/* fg uses colors 0x40-0x7f */
	for (i = 0x40; i < 0x140; i++)
	{
		UINT8 ctabentry = (color_prom[i + 0x1c0] & 0x0f) | ((color_prom[i + 0x0c0] & 0x03) << 4) | 0x40;
		colortable_entry_set_value(machine().colortable, i, ctabentry);
	}

	/* bg uses colors 0-0x3f */
	for (i = 0x140; i < 0x240; i++)
	{
		UINT8 ctabentry = (color_prom[i + 0x2c0] & 0x0f) | ((color_prom[i + 0x1c0] & 0x03) << 4);
		colortable_entry_set_value(machine().colortable, i, ctabentry);
	}

	/* bg uses colors 0x80-0xbf */
	for (i = 0x240; i < 0x340; i++)
	{
		UINT8 ctabentry = (color_prom[i + 0x3c0] & 0x0f) | ((color_prom[i + 0x2c0] & 0x03) << 4) | 0x80;
		colortable_entry_set_value(machine().colortable, i, ctabentry);
	}
}
Example #30
0
void m52_state::palette_init()
{
	const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
	const UINT8 *char_pal = color_prom + 0x000;
	const UINT8 *back_pal = color_prom + 0x200;
	const UINT8 *sprite_pal = color_prom + 0x220;
	const UINT8 *sprite_table = color_prom + 0x240;
	static const int resistances_3[3] = { 1000, 470, 220 };
	static const int resistances_2[2]  = { 470, 220 };
	double weights_r[3], weights_g[3], weights_b[3], scale;
	int i;

	machine().colortable = colortable_alloc(machine(), 512 + 32 + 32);

	/* compute palette information for characters/backgrounds */
	scale = compute_resistor_weights(0,	255, -1.0,
			3, resistances_3, weights_r, 0, 0,
			3, resistances_3, weights_g, 0, 0,
			2, resistances_2, weights_b, 0, 0);

	/* character palette */
	for (i = 0; i < 512; i++)
	{
		UINT8 promval = char_pal[i];
		int r = combine_3_weights(weights_r, BIT(promval,0), BIT(promval,1), BIT(promval,2));
		int g = combine_3_weights(weights_g, BIT(promval,3), BIT(promval,4), BIT(promval,5));
		int b = combine_2_weights(weights_b, BIT(promval,6), BIT(promval,7));

		colortable_palette_set_color(machine().colortable, i, MAKE_RGB(r,g,b));
	}

	/* background palette */
	for (i = 0; i < 32; i++)
	{
		UINT8 promval = back_pal[i];
		int r = combine_3_weights(weights_r, BIT(promval,0), BIT(promval,1), BIT(promval,2));
		int g = combine_3_weights(weights_g, BIT(promval,3), BIT(promval,4), BIT(promval,5));
		int b = combine_2_weights(weights_b, BIT(promval,6), BIT(promval,7));

		colortable_palette_set_color(machine().colortable, 512+i, MAKE_RGB(r,g,b));
	}

	/* compute palette information for sprites */
	compute_resistor_weights(0,	255, scale,
			2, resistances_2, weights_r, 470, 0,
			3, resistances_3, weights_g, 470, 0,
			3, resistances_3, weights_b, 470, 0);

	/* sprite palette */
	for (i = 0; i < 32; i++)
	{
		UINT8 promval = sprite_pal[i];
		int r = combine_2_weights(weights_r, BIT(promval,6), BIT(promval,7));
		int g = combine_3_weights(weights_g, BIT(promval,3), BIT(promval,4), BIT(promval,5));
		int b = combine_3_weights(weights_b, BIT(promval,0), BIT(promval,1), BIT(promval,2));

		colortable_palette_set_color(machine().colortable, 512 + 32 + i, MAKE_RGB(r,g,b));
	}

	/* character lookup table */
	for (i = 0; i < 512; i++)
		colortable_entry_set_value(machine().colortable, i, i);

	/* sprite lookup table */
	for (i = 0; i < 16 * 4; i++)
	{
		UINT8 promval = sprite_table[(i & 3) | ((i & ~3) << 1)];
		colortable_entry_set_value(machine().colortable, 512 + i, 512 + 32 + promval);
	}

	/* background */
	/* the palette is a 32x8 PROM with many colors repeated. The address of */
	/* the colors to pick is as follows: */
	/* xbb00: mountains */
	/* 0xxbb: hills */
	/* 1xxbb: city */
	colortable_entry_set_value(machine().colortable, 512+16*4+0*4+0, 512);
	colortable_entry_set_value(machine().colortable, 512+16*4+0*4+1, 512+4);
	colortable_entry_set_value(machine().colortable, 512+16*4+0*4+2, 512+8);
	colortable_entry_set_value(machine().colortable, 512+16*4+0*4+3, 512+12);
	colortable_entry_set_value(machine().colortable, 512+16*4+1*4+0, 512);
	colortable_entry_set_value(machine().colortable, 512+16*4+1*4+1, 512+1);
	colortable_entry_set_value(machine().colortable, 512+16*4+1*4+2, 512+2);
	colortable_entry_set_value(machine().colortable, 512+16*4+1*4+3, 512+3);
	colortable_entry_set_value(machine().colortable, 512+16*4+2*4+0, 512);
	colortable_entry_set_value(machine().colortable, 512+16*4+2*4+1, 512+16+1);
	colortable_entry_set_value(machine().colortable, 512+16*4+2*4+2, 512+16+2);
	colortable_entry_set_value(machine().colortable, 512+16*4+2*4+3, 512+16+3);
}