- Color table removal

- resnet conversion
This commit is contained in:
Zsolt Vasvari 2008-02-06 11:18:03 +00:00
parent 8a723628c1
commit 897ea4b0b5
2 changed files with 72 additions and 60 deletions

View File

@ -13,15 +13,15 @@ driver by Allard Van Der Bas
UINT8 shaolins_nmi_enable;
extern WRITE8_HANDLER( shaolins_videoram_w );
extern WRITE8_HANDLER( shaolins_colorram_w );
extern WRITE8_HANDLER( shaolins_palettebank_w );
extern WRITE8_HANDLER( shaolins_scroll_w );
extern WRITE8_HANDLER( shaolins_nmi_w );
WRITE8_HANDLER( shaolins_videoram_w );
WRITE8_HANDLER( shaolins_colorram_w );
WRITE8_HANDLER( shaolins_palettebank_w );
WRITE8_HANDLER( shaolins_scroll_w );
WRITE8_HANDLER( shaolins_nmi_w );
extern PALETTE_INIT( shaolins );
extern VIDEO_START( shaolins );
extern VIDEO_UPDATE( shaolins );
PALETTE_INIT( shaolins );
VIDEO_START( shaolins );
VIDEO_UPDATE( shaolins );
static INTERRUPT_GEN( shaolins_interrupt )
@ -231,8 +231,7 @@ static MACHINE_DRIVER_START( shaolins )
MDRV_SCREEN_SIZE(32*8, 32*8)
MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
MDRV_GFXDECODE(shaolins)
MDRV_PALETTE_LENGTH(256)
MDRV_COLORTABLE_LENGTH(16*8*16+16*8*16)
MDRV_PALETTE_LENGTH(16*8*16+16*8*16)
MDRV_PALETTE_INIT(shaolins)
MDRV_VIDEO_START(shaolins)
@ -302,4 +301,4 @@ ROM_END
GAME( 1985, kicker, 0, shaolins, shaolins, 0, ROT90, "Konami", "Kicker", 0 )
GAME( 1985, shaolins, kicker, shaolins, shaolins, 0, ROT90, "Konami", "Shao-Lin's Road", 0 )
GAME( 1985, shaolins, kicker, shaolins, shaolins, 0, ROT90, "Konami", "Shao-lin's Road", 0 )

View File

@ -7,6 +7,7 @@
***************************************************************************/
#include "driver.h"
#include "video/resnet.h"
extern UINT8 shaolins_nmi_enable;
@ -30,66 +31,81 @@ static tilemap *bg_tilemap;
***************************************************************************/
PALETTE_INIT( shaolins )
{
static const int resistances[4] = { 1000, 470, 220, 100 };
double rweights[4], gweights[4], bweights[4];
int i;
#define TOTAL_COLORS(gfxn) (machine->gfx[gfxn]->total_colors * machine->gfx[gfxn]->color_granularity)
#define COLOR(gfxn,offs) (colortable[machine->drv->gfxdecodeinfo[gfxn].color_codes_start + offs])
/* compute the color output resistor weights */
compute_resistor_weights(0, 255, -1.0,
4, resistances, rweights, 470, 0,
4, resistances, gweights, 470, 0,
4, resistances, bweights, 470, 0);
for (i = 0;i < machine->drv->total_colors;i++)
/* allocate the colortable */
machine->colortable = colortable_alloc(machine, 0x100);
/* create a lookup table for the palette */
for (i = 0; i < 0x100; i++)
{
int bit0,bit1,bit2,bit3,r,g,b;
int bit0, bit1, bit2, bit3;
int r, g, b;
/* red component */
bit0 = (color_prom[i + 0x000] >> 0) & 0x01;
bit1 = (color_prom[i + 0x000] >> 1) & 0x01;
bit2 = (color_prom[i + 0x000] >> 2) & 0x01;
bit3 = (color_prom[i + 0x000] >> 3) & 0x01;
r = combine_4_weights(rweights, bit0, bit1, bit2, bit3);
bit0 = (color_prom[0] >> 0) & 0x01;
bit1 = (color_prom[0] >> 1) & 0x01;
bit2 = (color_prom[0] >> 2) & 0x01;
bit3 = (color_prom[0] >> 3) & 0x01;
r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
bit0 = (color_prom[machine->drv->total_colors] >> 0) & 0x01;
bit1 = (color_prom[machine->drv->total_colors] >> 1) & 0x01;
bit2 = (color_prom[machine->drv->total_colors] >> 2) & 0x01;
bit3 = (color_prom[machine->drv->total_colors] >> 3) & 0x01;
g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
bit0 = (color_prom[2*machine->drv->total_colors] >> 0) & 0x01;
bit1 = (color_prom[2*machine->drv->total_colors] >> 1) & 0x01;
bit2 = (color_prom[2*machine->drv->total_colors] >> 2) & 0x01;
bit3 = (color_prom[2*machine->drv->total_colors] >> 3) & 0x01;
b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
/* green component */
bit0 = (color_prom[i + 0x100] >> 0) & 0x01;
bit1 = (color_prom[i + 0x100] >> 1) & 0x01;
bit2 = (color_prom[i + 0x100] >> 2) & 0x01;
bit3 = (color_prom[i + 0x100] >> 3) & 0x01;
g = combine_4_weights(gweights, bit0, bit1, bit2, bit3);
palette_set_color(machine,i,MAKE_RGB(r,g,b));
color_prom++;
/* blue component */
bit0 = (color_prom[i + 0x200] >> 0) & 0x01;
bit1 = (color_prom[i + 0x200] >> 1) & 0x01;
bit2 = (color_prom[i + 0x200] >> 2) & 0x01;
bit3 = (color_prom[i + 0x200] >> 3) & 0x01;
b = combine_4_weights(bweights, bit0, bit1, bit2, bit3);
colortable_palette_set_color(machine->colortable, i, MAKE_RGB(r, g, b));
}
color_prom += 2*machine->drv->total_colors;
/* color_prom now points to the beginning of the character lookup table */
/* color_prom now points to the beginning of the lookup table */
color_prom += 0x300;
/* there are eight 32 colors palette banks; sprites use colors 0-15 and */
/* characters 16-31 of each bank. */
for (i = 0;i < TOTAL_COLORS(0)/8;i++)
/* characters use colors 0x10-0x1f of each 0x20 color bank */
for (i = 0; i < 0x100; i++)
{
int j;
for (j = 0;j < 8;j++)
COLOR(0,i + j * TOTAL_COLORS(0)/8) = (*color_prom & 0x0f) + 32 * j + 16;
color_prom++;
}
for (i = 0;i < TOTAL_COLORS(1)/8;i++)
{
int j;
for (j = 0;j < 8;j++)
for (j = 0; j < 8; j++)
{
/* preserve transparency */
if ((*color_prom & 0x0f) == 0) COLOR(1,i + j * TOTAL_COLORS(1)/8) = 0;
else COLOR(1,i + j * TOTAL_COLORS(1)/8) = (*color_prom & 0x0f) + 32 * j;
UINT8 ctabentry = (j << 5) | 0x10 | (color_prom[i] & 0x0f);
colortable_entry_set_value(machine->colortable, (j << 8) | i, ctabentry);
}
}
color_prom++;
/* characters use colors 0-0x0f of each 0x20 color bank */
for (i = 0x100; i < 0x200; i++)
{
int j;
for (j = 0; j < 8; j++)
{
UINT8 ctabentry;
if ((color_prom[i] & 0x0f))
ctabentry = (j << 5) | (color_prom[i] & 0x0f);
else
/* preserve transparency */
ctabentry = 0;
colortable_entry_set_value(machine->colortable, 0x800 | (j << 8) | (i & 0xff), ctabentry);
}
}
}
@ -119,9 +135,7 @@ WRITE8_HANDLER( shaolins_scroll_w )
int col;
for (col = 4; col < 32; col++)
{
tilemap_set_scrolly(bg_tilemap, col, data + 1);
}
}
WRITE8_HANDLER( shaolins_nmi_w )
@ -180,9 +194,8 @@ static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const re
code, color,
flipx, flipy,
sx, sy,
cliprect,
TRANSPARENCY_COLOR, 0);
/* transparency_color, otherwise sprites in test mode are not visible */
cliprect,TRANSPARENCY_PENS,
colortable_get_transpen_mask(machine->colortable, machine->gfx[1], color, 0));
}
}
}