From 72fa930e7844bf87adcd12477c5861c06b387923 Mon Sep 17 00:00:00 2001 From: Zsolt Vasvari Date: Wed, 13 Feb 2008 00:53:16 +0000 Subject: [PATCH] Color table removal --- src/mame/drivers/gdrawpkr.c | 17 +++++++----- src/mame/drivers/goldstar.c | 3 --- src/mame/drivers/hanaawas.c | 5 ++-- src/mame/drivers/higemaru.c | 3 +-- src/mame/video/goldstar.c | 3 --- src/mame/video/hanaawas.c | 52 ++++++++++++++++--------------------- src/mame/video/higemaru.c | 51 ++++++++++++++++++++---------------- 7 files changed, 66 insertions(+), 68 deletions(-) diff --git a/src/mame/drivers/gdrawpkr.c b/src/mame/drivers/gdrawpkr.c index b51a6606984..0d5bd8e3492 100644 --- a/src/mame/drivers/gdrawpkr.c +++ b/src/mame/drivers/gdrawpkr.c @@ -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_GFXDECODE(gdrawpkr) - MDRV_PALETTE_LENGTH(256) - MDRV_COLORTABLE_LENGTH(1024) + MDRV_PALETTE_LENGTH(1024) MDRV_PALETTE_INIT(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-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_RELOAD( 0x0100, 0x0100 ) + ROM_RELOAD( 0x0200, 0x0100 ) + ROM_RELOAD( 0x0300, 0x0100 ) ROM_END ROM_START( elgrande ) @@ -641,8 +643,11 @@ ROM_START( elgrande ) 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_REGION( 0x200, REGION_PROMS, 0 ) + ROM_REGION( 0x0500, REGION_PROMS, 0 ) ROM_LOAD( "d1.u28", 0x0000, 0x0200, CRC(a6d43709) SHA1(cbff2cb60137462dc0b7c7719a64574218d96c62) ) + ROM_RELOAD( 0x0100, 0x0200 ) + ROM_RELOAD( 0x0200, 0x0200 ) + ROM_RELOAD( 0x0300, 0x0200 ) ROM_END @@ -656,7 +661,7 @@ static DRIVER_INIT( gdrawpkr ) int x; UINT8 *BPR = memory_region( REGION_PROMS ); - for (x=0x0000;x<0x0100;x++) + for (x=0x0000;x<0x0400;x++) { if (BPR[x] == 0x07) BPR[x] = 0x04; /* blue background */ @@ -674,7 +679,7 @@ static DRIVER_INIT( elgrande ) UINT8 *ROM = memory_region( REGION_GFX2 ); /* Palette transformed by PLDs? */ - for (x=0x0000;x<0x0100;x++) + for (x=0x0000;x<0x0400;x++) { if (BPR[x] == 0x07) BPR[x] = 0x00; /* black background */ diff --git a/src/mame/drivers/goldstar.c b/src/mame/drivers/goldstar.c index 1e9c203f7ae..9b17428ec2f 100644 --- a/src/mame/drivers/goldstar.c +++ b/src/mame/drivers/goldstar.c @@ -299,7 +299,6 @@ static MACHINE_DRIVER_START( goldstar ) MDRV_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 2*8, 30*8-1) MDRV_GFXDECODE(goldstar) MDRV_PALETTE_LENGTH(256) - MDRV_COLORTABLE_LENGTH(256) MDRV_NVRAM_HANDLER(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_GFXDECODE(bl) MDRV_PALETTE_LENGTH(256) - MDRV_COLORTABLE_LENGTH(256) MDRV_NVRAM_HANDLER(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_GFXDECODE(ml) MDRV_PALETTE_LENGTH(256) - MDRV_COLORTABLE_LENGTH(256) MDRV_NVRAM_HANDLER(goldstar) MDRV_VIDEO_START(goldstar) diff --git a/src/mame/drivers/hanaawas.c b/src/mame/drivers/hanaawas.c index 4535a3badcb..6769546c648 100644 --- a/src/mame/drivers/hanaawas.c +++ b/src/mame/drivers/hanaawas.c @@ -219,8 +219,7 @@ static MACHINE_DRIVER_START( hanaawas ) MDRV_SCREEN_SIZE(32*8, 32*8) MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 32*8-1) MDRV_GFXDECODE(hanaawas) - MDRV_PALETTE_LENGTH(16) - MDRV_COLORTABLE_LENGTH(32*8) + MDRV_PALETTE_LENGTH(32*8) MDRV_PALETTE_INIT(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 ) diff --git a/src/mame/drivers/higemaru.c b/src/mame/drivers/higemaru.c index c8e2f84ee61..8123166b623 100644 --- a/src/mame/drivers/higemaru.c +++ b/src/mame/drivers/higemaru.c @@ -186,8 +186,7 @@ static MACHINE_DRIVER_START( higemaru ) MDRV_SCREEN_SIZE(32*8, 32*8) MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) MDRV_GFXDECODE(higemaru) - MDRV_PALETTE_LENGTH(32) - MDRV_COLORTABLE_LENGTH(32*4+16*16) + MDRV_PALETTE_LENGTH(32*4+16*16) MDRV_PALETTE_INIT(higemaru) MDRV_VIDEO_START(higemaru) diff --git a/src/mame/video/goldstar.c b/src/mame/video/goldstar.c index d82e05bc4dc..8897cf9c5d2 100644 --- a/src/mame/video/goldstar.c +++ b/src/mame/video/goldstar.c @@ -33,9 +33,6 @@ VIDEO_START( goldstar ) 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); 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; } diff --git a/src/mame/video/hanaawas.c b/src/mame/video/hanaawas.c index 6fe037768d2..d1c769cd616 100644 --- a/src/mame/video/hanaawas.c +++ b/src/mame/video/hanaawas.c @@ -19,52 +19,47 @@ static tilemap *bg_tilemap; PALETTE_INIT( hanaawas ) { 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 */ - bit0 = (*color_prom >> 0) & 0x01; - bit1 = (*color_prom >> 1) & 0x01; - bit2 = (*color_prom >> 2) & 0x01; + bit0 = (color_prom[i] >> 0) & 0x01; + bit1 = (color_prom[i] >> 1) & 0x01; + bit2 = (color_prom[i] >> 2) & 0x01; r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + /* green component */ - bit0 = (*color_prom >> 3) & 0x01; - bit1 = (*color_prom >> 4) & 0x01; - bit2 = (*color_prom >> 5) & 0x01; + bit0 = (color_prom[i] >> 3) & 0x01; + bit1 = (color_prom[i] >> 4) & 0x01; + bit2 = (color_prom[i] >> 5) & 0x01; g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + /* blue component */ bit0 = 0; - bit1 = (*color_prom >> 6) & 0x01; - bit2 = (*color_prom >> 7) & 0x01; + bit1 = (color_prom[i] >> 6) & 0x01; + bit2 = (color_prom[i] >> 7) & 0x01; b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - palette_set_color(machine,i,MAKE_RGB(r,g,b)); - color_prom++; + colortable_palette_set_color(machine->colortable, i, MAKE_RGB(r, g, b)); } - color_prom += 0x10; /* 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 3bpp ones 0x10-0x1f */ - - for (i = 0;i < TOTAL_COLORS(0)/8 ;i++) + for (i = 0; i < 0x100; i++) { - COLOR(0,i*8+0) = color_prom[i*4+0x00] & 0x0f; - COLOR(0,i*8+1) = color_prom[i*4+0x01] & 0x0f; - COLOR(0,i*8+2) = color_prom[i*4+0x02] & 0x0f; - 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; + int swapped_i = BITSWAP8(i,2,7,6,5,4,3,1,0); + UINT8 ctabentry = color_prom[swapped_i] & 0x0f; + colortable_entry_set_value(machine->colortable, i, ctabentry); } } @@ -107,8 +102,7 @@ static TILE_GET_INFO( get_bg_tile_info ) VIDEO_START( hanaawas ) { - bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows, - 8, 8, 32, 32); + bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32); } VIDEO_UPDATE( hanaawas ) diff --git a/src/mame/video/higemaru.c b/src/mame/video/higemaru.c index e9e4d387e3b..c964dab4fb1 100644 --- a/src/mame/video/higemaru.c +++ b/src/mame/video/higemaru.c @@ -22,45 +22,53 @@ WRITE8_HANDLER( higemaru_colorram_w ) PALETTE_INIT( higemaru ) { 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 */ - bit0 = (*color_prom >> 0) & 0x01; - bit1 = (*color_prom >> 1) & 0x01; - bit2 = (*color_prom >> 2) & 0x01; + bit0 = (color_prom[i] >> 0) & 0x01; + bit1 = (color_prom[i] >> 1) & 0x01; + bit2 = (color_prom[i] >> 2) & 0x01; r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + /* green component */ - bit0 = (*color_prom >> 3) & 0x01; - bit1 = (*color_prom >> 4) & 0x01; - bit2 = (*color_prom >> 5) & 0x01; + bit0 = (color_prom[i] >> 3) & 0x01; + bit1 = (color_prom[i] >> 4) & 0x01; + bit2 = (color_prom[i] >> 5) & 0x01; g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + /* blue component */ bit0 = 0; - bit1 = (*color_prom >> 6) & 0x01; - bit2 = (*color_prom >> 7) & 0x01; + bit1 = (color_prom[i] >> 6) & 0x01; + bit2 = (color_prom[i] >> 7) & 0x01; b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - palette_set_color(machine,i,MAKE_RGB(r,g,b)); - color_prom++; + 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; /* characters use colors 0-15 */ - for (i = 0;i < TOTAL_COLORS(0);i++) - COLOR(0,i) = *(color_prom++) & 0x0f; - - color_prom += 128; /* the bottom half of the PROM doesn't seem to be used */ + for (i = 0; i < 0x80; i++) + { + UINT8 ctabentry = color_prom[i] & 0x0f; + colortable_entry_set_value(machine->colortable, i, ctabentry); + } /* sprites use colors 16-31 */ - for (i = 0;i < TOTAL_COLORS(1);i++) - COLOR(1,i) = (*(color_prom++) & 0x0f) + 0x10; + for (i = 0x80; i < 0x180; i++) + { + UINT8 ctabentry = (color_prom[i + 0x80] & 0x0f) | 0x10; + colortable_entry_set_value(machine->colortable, i, ctabentry); + } } WRITE8_HANDLER( higemaru_c800_w ) @@ -89,8 +97,7 @@ static TILE_GET_INFO( get_bg_tile_info ) VIDEO_START( higemaru ) { - bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows, - 8, 8, 32, 32); + bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32); } static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)