Color table removal

This commit is contained in:
Zsolt Vasvari 2008-02-13 00:53:16 +00:00
parent 9e974e6ac1
commit 72fa930e78
7 changed files with 66 additions and 68 deletions

View file

@ -580,8 +580,7 @@ static MACHINE_DRIVER_START( gdrawpkr )
MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 31*8-1) /* Taken from MC6845 init, registers 01 & 06 */ MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 31*8-1) /* Taken from MC6845 init, registers 01 & 06 */
MDRV_GFXDECODE(gdrawpkr) MDRV_GFXDECODE(gdrawpkr)
MDRV_PALETTE_LENGTH(256) MDRV_PALETTE_LENGTH(1024)
MDRV_COLORTABLE_LENGTH(1024)
MDRV_PALETTE_INIT(gdrawpkr) MDRV_PALETTE_INIT(gdrawpkr)
MDRV_VIDEO_START(gdrawpkr) MDRV_VIDEO_START(gdrawpkr)
@ -621,8 +620,11 @@ ROM_START( gdrawpkr )
ROM_LOAD( "cg-2b.u69", 0x0800, 0x0800, CRC(6bbb1e2d) SHA1(51ee282219bf84218886ad11a24bc6a8e7337527) ) ROM_LOAD( "cg-2b.u69", 0x0800, 0x0800, CRC(6bbb1e2d) SHA1(51ee282219bf84218886ad11a24bc6a8e7337527) )
ROM_LOAD( "cg-2a.u68", 0x1000, 0x0800, CRC(6e3e9b1d) SHA1(14eb8d14ce16719a6ad7d13db01e47c8f05955f0) ) ROM_LOAD( "cg-2a.u68", 0x1000, 0x0800, CRC(6e3e9b1d) SHA1(14eb8d14ce16719a6ad7d13db01e47c8f05955f0) )
ROM_REGION( 0x100, REGION_PROMS, 0 ) ROM_REGION( 0x400, REGION_PROMS, 0 )
ROM_LOAD( "82s129n.u28", 0x0000, 0x0100, CRC(6db5a344) SHA1(5f1a81ac02a2a74252decd3bb95a5436cc943930) ) ROM_LOAD( "82s129n.u28", 0x0000, 0x0100, CRC(6db5a344) SHA1(5f1a81ac02a2a74252decd3bb95a5436cc943930) )
ROM_RELOAD( 0x0100, 0x0100 )
ROM_RELOAD( 0x0200, 0x0100 )
ROM_RELOAD( 0x0300, 0x0100 )
ROM_END ROM_END
ROM_START( elgrande ) ROM_START( elgrande )
@ -641,8 +643,11 @@ ROM_START( elgrande )
ROM_LOAD( "d1.u69", 0x0800, 0x0800, CRC(ed3c83b7) SHA1(93e2134de3d9f79a6cff0391c1a32fccd3840c3f) ) ROM_LOAD( "d1.u69", 0x0800, 0x0800, CRC(ed3c83b7) SHA1(93e2134de3d9f79a6cff0391c1a32fccd3840c3f) )
ROM_LOAD( "d1.u68", 0x1000, 0x0800, BAD_DUMP CRC(3ab70570) SHA1(5ff84015a78d15a5207499f84ce637e49bca136f) ) /* bad bits */ ROM_LOAD( "d1.u68", 0x1000, 0x0800, BAD_DUMP CRC(3ab70570) SHA1(5ff84015a78d15a5207499f84ce637e49bca136f) ) /* bad bits */
ROM_REGION( 0x200, REGION_PROMS, 0 ) ROM_REGION( 0x0500, REGION_PROMS, 0 )
ROM_LOAD( "d1.u28", 0x0000, 0x0200, CRC(a6d43709) SHA1(cbff2cb60137462dc0b7c7719a64574218d96c62) ) ROM_LOAD( "d1.u28", 0x0000, 0x0200, CRC(a6d43709) SHA1(cbff2cb60137462dc0b7c7719a64574218d96c62) )
ROM_RELOAD( 0x0100, 0x0200 )
ROM_RELOAD( 0x0200, 0x0200 )
ROM_RELOAD( 0x0300, 0x0200 )
ROM_END ROM_END
@ -656,7 +661,7 @@ static DRIVER_INIT( gdrawpkr )
int x; int x;
UINT8 *BPR = memory_region( REGION_PROMS ); UINT8 *BPR = memory_region( REGION_PROMS );
for (x=0x0000;x<0x0100;x++) for (x=0x0000;x<0x0400;x++)
{ {
if (BPR[x] == 0x07) if (BPR[x] == 0x07)
BPR[x] = 0x04; /* blue background */ BPR[x] = 0x04; /* blue background */
@ -674,7 +679,7 @@ static DRIVER_INIT( elgrande )
UINT8 *ROM = memory_region( REGION_GFX2 ); UINT8 *ROM = memory_region( REGION_GFX2 );
/* Palette transformed by PLDs? */ /* Palette transformed by PLDs? */
for (x=0x0000;x<0x0100;x++) for (x=0x0000;x<0x0400;x++)
{ {
if (BPR[x] == 0x07) if (BPR[x] == 0x07)
BPR[x] = 0x00; /* black background */ BPR[x] = 0x00; /* black background */

View file

@ -299,7 +299,6 @@ static MACHINE_DRIVER_START( goldstar )
MDRV_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 2*8, 30*8-1) MDRV_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 2*8, 30*8-1)
MDRV_GFXDECODE(goldstar) MDRV_GFXDECODE(goldstar)
MDRV_PALETTE_LENGTH(256) MDRV_PALETTE_LENGTH(256)
MDRV_COLORTABLE_LENGTH(256)
MDRV_NVRAM_HANDLER(goldstar) MDRV_NVRAM_HANDLER(goldstar)
MDRV_VIDEO_START(goldstar) MDRV_VIDEO_START(goldstar)
@ -336,7 +335,6 @@ static MACHINE_DRIVER_START( goldstbl )
MDRV_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 2*8, 30*8-1) MDRV_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 2*8, 30*8-1)
MDRV_GFXDECODE(bl) MDRV_GFXDECODE(bl)
MDRV_PALETTE_LENGTH(256) MDRV_PALETTE_LENGTH(256)
MDRV_COLORTABLE_LENGTH(256)
MDRV_NVRAM_HANDLER(goldstar) MDRV_NVRAM_HANDLER(goldstar)
MDRV_VIDEO_START(goldstar) MDRV_VIDEO_START(goldstar)
@ -372,7 +370,6 @@ static MACHINE_DRIVER_START( moonlght )
MDRV_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 2*8, 30*8-1) MDRV_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 2*8, 30*8-1)
MDRV_GFXDECODE(ml) MDRV_GFXDECODE(ml)
MDRV_PALETTE_LENGTH(256) MDRV_PALETTE_LENGTH(256)
MDRV_COLORTABLE_LENGTH(256)
MDRV_NVRAM_HANDLER(goldstar) MDRV_NVRAM_HANDLER(goldstar)
MDRV_VIDEO_START(goldstar) MDRV_VIDEO_START(goldstar)

View file

@ -219,8 +219,7 @@ static MACHINE_DRIVER_START( hanaawas )
MDRV_SCREEN_SIZE(32*8, 32*8) MDRV_SCREEN_SIZE(32*8, 32*8)
MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 32*8-1) MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 32*8-1)
MDRV_GFXDECODE(hanaawas) MDRV_GFXDECODE(hanaawas)
MDRV_PALETTE_LENGTH(16) MDRV_PALETTE_LENGTH(32*8)
MDRV_COLORTABLE_LENGTH(32*8)
MDRV_PALETTE_INIT(hanaawas) MDRV_PALETTE_INIT(hanaawas)
MDRV_VIDEO_START(hanaawas) MDRV_VIDEO_START(hanaawas)
@ -262,4 +261,4 @@ ROM_END
GAME( 1982, hanaawas, 0, hanaawas, hanaawas, 0, ROT0, "Seta", "Hana Awase (Flower Matching)", 0 ) GAME( 1982, hanaawas, 0, hanaawas, hanaawas, 0, ROT0, "Setakikaku, Ltd.", "Hana Awase", 0 )

View file

@ -186,8 +186,7 @@ static MACHINE_DRIVER_START( higemaru )
MDRV_SCREEN_SIZE(32*8, 32*8) MDRV_SCREEN_SIZE(32*8, 32*8)
MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
MDRV_GFXDECODE(higemaru) MDRV_GFXDECODE(higemaru)
MDRV_PALETTE_LENGTH(32) MDRV_PALETTE_LENGTH(32*4+16*16)
MDRV_COLORTABLE_LENGTH(32*4+16*16)
MDRV_PALETTE_INIT(higemaru) MDRV_PALETTE_INIT(higemaru)
MDRV_VIDEO_START(higemaru) MDRV_VIDEO_START(higemaru)

View file

@ -33,9 +33,6 @@ VIDEO_START( goldstar )
tmpbitmap2 = auto_bitmap_alloc(machine->screen[0].width,machine->screen[0].height,machine->screen[0].format); tmpbitmap2 = auto_bitmap_alloc(machine->screen[0].width,machine->screen[0].height,machine->screen[0].format);
tmpbitmap3 = auto_bitmap_alloc(machine->screen[0].width,machine->screen[0].height,machine->screen[0].format); tmpbitmap3 = auto_bitmap_alloc(machine->screen[0].width,machine->screen[0].height,machine->screen[0].format);
tmpbitmap4 = auto_bitmap_alloc(machine->screen[0].width,machine->screen[0].height,machine->screen[0].format); tmpbitmap4 = auto_bitmap_alloc(machine->screen[0].width,machine->screen[0].height,machine->screen[0].format);
/* leave everything at the default, but map all foreground 0 pens as transparent */
// for (i = 0;i < 16;i++) palette_used_colors[8 * i] = PALETTE_COLOR_TRANSPARENT;
} }

View file

@ -19,52 +19,47 @@ static tilemap *bg_tilemap;
PALETTE_INIT( hanaawas ) PALETTE_INIT( hanaawas )
{ {
int i; 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])
/* allocate the colortable */
machine->colortable = colortable_alloc(machine, 0x10);
for (i = 0;i < machine->drv->total_colors;i++) /* create a lookup table for the palette */
for (i = 0; i < 0x10; i++)
{ {
int bit0,bit1,bit2,r,g,b; int bit0, bit1, bit2;
int r, g, b;
/* red component */ /* red component */
bit0 = (*color_prom >> 0) & 0x01; bit0 = (color_prom[i] >> 0) & 0x01;
bit1 = (*color_prom >> 1) & 0x01; bit1 = (color_prom[i] >> 1) & 0x01;
bit2 = (*color_prom >> 2) & 0x01; bit2 = (color_prom[i] >> 2) & 0x01;
r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
/* green component */ /* green component */
bit0 = (*color_prom >> 3) & 0x01; bit0 = (color_prom[i] >> 3) & 0x01;
bit1 = (*color_prom >> 4) & 0x01; bit1 = (color_prom[i] >> 4) & 0x01;
bit2 = (*color_prom >> 5) & 0x01; bit2 = (color_prom[i] >> 5) & 0x01;
g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
/* blue component */ /* blue component */
bit0 = 0; bit0 = 0;
bit1 = (*color_prom >> 6) & 0x01; bit1 = (color_prom[i] >> 6) & 0x01;
bit2 = (*color_prom >> 7) & 0x01; bit2 = (color_prom[i] >> 7) & 0x01;
b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
palette_set_color(machine,i,MAKE_RGB(r,g,b)); colortable_palette_set_color(machine->colortable, i, MAKE_RGB(r, g, b));
color_prom++;
} }
color_prom += 0x10;
/* color_prom now points to the beginning of the lookup table */ /* color_prom now points to the beginning of the lookup table */
color_prom += 0x20;
/* character lookup table. The 1bpp tiles really only use colors 0-0x0f and the /* character lookup table. The 1bpp tiles really only use colors 0-0x0f and the
3bpp ones 0x10-0x1f */ 3bpp ones 0x10-0x1f */
for (i = 0; i < 0x100; i++)
for (i = 0;i < TOTAL_COLORS(0)/8 ;i++)
{ {
COLOR(0,i*8+0) = color_prom[i*4+0x00] & 0x0f; int swapped_i = BITSWAP8(i,2,7,6,5,4,3,1,0);
COLOR(0,i*8+1) = color_prom[i*4+0x01] & 0x0f; UINT8 ctabentry = color_prom[swapped_i] & 0x0f;
COLOR(0,i*8+2) = color_prom[i*4+0x02] & 0x0f; colortable_entry_set_value(machine->colortable, i, ctabentry);
COLOR(0,i*8+3) = color_prom[i*4+0x03] & 0x0f;
COLOR(0,i*8+4) = color_prom[i*4+0x80] & 0x0f;
COLOR(0,i*8+5) = color_prom[i*4+0x81] & 0x0f;
COLOR(0,i*8+6) = color_prom[i*4+0x82] & 0x0f;
COLOR(0,i*8+7) = color_prom[i*4+0x83] & 0x0f;
} }
} }
@ -107,8 +102,7 @@ static TILE_GET_INFO( get_bg_tile_info )
VIDEO_START( hanaawas ) VIDEO_START( hanaawas )
{ {
bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows, bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
8, 8, 32, 32);
} }
VIDEO_UPDATE( hanaawas ) VIDEO_UPDATE( hanaawas )

View file

@ -22,45 +22,53 @@ WRITE8_HANDLER( higemaru_colorram_w )
PALETTE_INIT( higemaru ) PALETTE_INIT( higemaru )
{ {
int i; 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])
/* allocate the colortable */
machine->colortable = colortable_alloc(machine, 0x20);
for (i = 0;i < machine->drv->total_colors;i++) /* create a lookup table for the palette */
for (i = 0; i < 0x20; i++)
{ {
int bit0,bit1,bit2,r,g,b; int bit0, bit1, bit2;
int r, g, b;
/* red component */ /* red component */
bit0 = (*color_prom >> 0) & 0x01; bit0 = (color_prom[i] >> 0) & 0x01;
bit1 = (*color_prom >> 1) & 0x01; bit1 = (color_prom[i] >> 1) & 0x01;
bit2 = (*color_prom >> 2) & 0x01; bit2 = (color_prom[i] >> 2) & 0x01;
r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
/* green component */ /* green component */
bit0 = (*color_prom >> 3) & 0x01; bit0 = (color_prom[i] >> 3) & 0x01;
bit1 = (*color_prom >> 4) & 0x01; bit1 = (color_prom[i] >> 4) & 0x01;
bit2 = (*color_prom >> 5) & 0x01; bit2 = (color_prom[i] >> 5) & 0x01;
g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
/* blue component */ /* blue component */
bit0 = 0; bit0 = 0;
bit1 = (*color_prom >> 6) & 0x01; bit1 = (color_prom[i] >> 6) & 0x01;
bit2 = (*color_prom >> 7) & 0x01; bit2 = (color_prom[i] >> 7) & 0x01;
b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
palette_set_color(machine,i,MAKE_RGB(r,g,b)); colortable_palette_set_color(machine->colortable, i, MAKE_RGB(r, g, b));
color_prom++;
} }
/* color_prom now points to the beginning of the lookup table */ /* color_prom now points to the beginning of the lookup table */
color_prom += 0x20;
/* characters use colors 0-15 */ /* characters use colors 0-15 */
for (i = 0;i < TOTAL_COLORS(0);i++) for (i = 0; i < 0x80; i++)
COLOR(0,i) = *(color_prom++) & 0x0f; {
UINT8 ctabentry = color_prom[i] & 0x0f;
color_prom += 128; /* the bottom half of the PROM doesn't seem to be used */ colortable_entry_set_value(machine->colortable, i, ctabentry);
}
/* sprites use colors 16-31 */ /* sprites use colors 16-31 */
for (i = 0;i < TOTAL_COLORS(1);i++) for (i = 0x80; i < 0x180; i++)
COLOR(1,i) = (*(color_prom++) & 0x0f) + 0x10; {
UINT8 ctabentry = (color_prom[i + 0x80] & 0x0f) | 0x10;
colortable_entry_set_value(machine->colortable, i, ctabentry);
}
} }
WRITE8_HANDLER( higemaru_c800_w ) WRITE8_HANDLER( higemaru_c800_w )
@ -89,8 +97,7 @@ static TILE_GET_INFO( get_bg_tile_info )
VIDEO_START( higemaru ) VIDEO_START( higemaru )
{ {
bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows, bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
8, 8, 32, 32);
} }
static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect) static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)