summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Zsolt Vasvari <zsoltvas@mamedev.org>2008-02-02 03:39:19 +0000
committer Zsolt Vasvari <zsoltvas@mamedev.org>2008-02-02 03:39:19 +0000
commite52902f9ea1f56a31003027a61cd5afb3e859f07 (patch)
treecc3dba1520b06b83237553317dd229fb09722c14
parent6696fe197cd75ea39cf694e8653d2a182b0c18c6 (diff)
Color table removal
-rw-r--r--src/mame/drivers/ace.c1
-rw-r--r--src/mame/drivers/alpha68k.c15
-rw-r--r--src/mame/drivers/irobot.c3
-rw-r--r--src/mame/video/alpha68k.c94
-rw-r--r--src/mame/video/irobot.c93
5 files changed, 83 insertions, 123 deletions
diff --git a/src/mame/drivers/ace.c b/src/mame/drivers/ace.c
index 274e3db7a08..5d91e5c3996 100644
--- a/src/mame/drivers/ace.c
+++ b/src/mame/drivers/ace.c
@@ -331,7 +331,6 @@ static MACHINE_DRIVER_START( ace )
MDRV_SCREEN_VISIBLE_AREA(4*8, 32*8-1, 2*8, 32*8-1)
MDRV_GFXDECODE(ace)
MDRV_PALETTE_LENGTH(2)
- MDRV_COLORTABLE_LENGTH(2*2)
MDRV_PALETTE_INIT(ace)
MDRV_VIDEO_UPDATE(ace)
diff --git a/src/mame/drivers/alpha68k.c b/src/mame/drivers/alpha68k.c
index 43a08029634..d470fdd138b 100644
--- a/src/mame/drivers/alpha68k.c
+++ b/src/mame/drivers/alpha68k.c
@@ -2077,9 +2077,8 @@ static MACHINE_DRIVER_START( sstingry )
MDRV_SCREEN_SIZE(32*8, 32*8)
MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
MDRV_GFXDECODE(sstingry)
- MDRV_PALETTE_LENGTH(256)
+ MDRV_PALETTE_LENGTH(256 + 1)
//AT
- MDRV_COLORTABLE_LENGTH(256)
MDRV_PALETTE_INIT(kyros)
//ZT
MDRV_VIDEO_UPDATE(sstingry)
@@ -2128,8 +2127,7 @@ static MACHINE_DRIVER_START( kyros )
MDRV_SCREEN_SIZE(32*8, 32*8)
MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
MDRV_GFXDECODE(kyros)
- MDRV_PALETTE_LENGTH(256)
- MDRV_COLORTABLE_LENGTH(256)
+ MDRV_PALETTE_LENGTH(256 + 1)
MDRV_PALETTE_INIT(kyros)
MDRV_VIDEO_UPDATE(kyros)
@@ -2176,8 +2174,7 @@ static MACHINE_DRIVER_START( jongbou )
MDRV_SCREEN_SIZE(32*8, 32*8)
MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
MDRV_GFXDECODE(jongbou)
- MDRV_PALETTE_LENGTH(256)
- MDRV_COLORTABLE_LENGTH(256)
+ MDRV_PALETTE_LENGTH(256 + 1)
MDRV_PALETTE_INIT(kyros)
MDRV_VIDEO_UPDATE(kyros)
@@ -2211,8 +2208,7 @@ static MACHINE_DRIVER_START( alpha68k_I )
MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
MDRV_GFXDECODE(paddle)
//AT
- MDRV_PALETTE_LENGTH(256)
- MDRV_COLORTABLE_LENGTH(1024)
+ MDRV_PALETTE_LENGTH(1024)
MDRV_PALETTE_INIT(paddlem)
//ZT
MDRV_VIDEO_UPDATE(alpha68k_I)
@@ -2429,8 +2425,7 @@ static MACHINE_DRIVER_START( tnexspce )
MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
MDRV_GFXDECODE(tnexspce)
- MDRV_PALETTE_LENGTH(256)
- MDRV_COLORTABLE_LENGTH(1024)
+ MDRV_PALETTE_LENGTH(1024)
MDRV_PALETTE_INIT(paddlem)
MDRV_VIDEO_UPDATE(alpha68k_I)
diff --git a/src/mame/drivers/irobot.c b/src/mame/drivers/irobot.c
index fa6883fba45..60aba654e48 100644
--- a/src/mame/drivers/irobot.c
+++ b/src/mame/drivers/irobot.c
@@ -313,8 +313,7 @@ static MACHINE_DRIVER_START( irobot )
MDRV_SCREEN_SIZE(32*8, 32*8)
MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 29*8-1)
MDRV_GFXDECODE(irobot)
- MDRV_PALETTE_LENGTH(64 + 32)
- MDRV_COLORTABLE_LENGTH(64 + 32) /* 64 for polygons, 32 for text */
+ MDRV_PALETTE_LENGTH(64 + 32) /* 64 for polygons, 32 for text */
MDRV_PALETTE_INIT(irobot)
MDRV_VIDEO_START(irobot)
diff --git a/src/mame/video/alpha68k.c b/src/mame/video/alpha68k.c
index a90df61ffe2..17a2f727aaa 100644
--- a/src/mame/video/alpha68k.c
+++ b/src/mame/video/alpha68k.c
@@ -353,7 +353,7 @@ VIDEO_UPDATE( alpha68k_I )
{
int yshift = (alpha68k_microcontroller_id == 0x890a) ? 1 : 0; // The Next Space is 1 pixel off
- fillbitmap(bitmap,machine->pens[0],cliprect);
+ fillbitmap(bitmap,get_black_pen(machine),cliprect);
/* This appears to be correct priority */
draw_sprites_I(machine, bitmap,cliprect,2,0x0800,yshift);
@@ -366,72 +366,56 @@ VIDEO_UPDATE( alpha68k_I )
PALETTE_INIT( kyros )
{
- int i,bit0,bit1,bit2,bit3,r,g,b;
+ int i;
- for (i = 0;i < 256;i++)
+ /* allocate the colortable */
+ machine->colortable = colortable_alloc(machine, 0x100);
+
+ /* create a lookup table for the palette */
+ for (i = 0; i < 0x100; i++)
{
- 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[0x100] >> 0) & 0x01;
- bit1 = (color_prom[0x100] >> 1) & 0x01;
- bit2 = (color_prom[0x100] >> 2) & 0x01;
- bit3 = (color_prom[0x100] >> 3) & 0x01;
- g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
-
- bit0 = (color_prom[0x200] >> 0) & 0x01;
- bit1 = (color_prom[0x200] >> 1) & 0x01;
- bit2 = (color_prom[0x200] >> 2) & 0x01;
- bit3 = (color_prom[0x200] >> 3) & 0x01;
- b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
-
- palette_set_color(machine,i,MAKE_RGB(r,g,b));
- color_prom++;
+ 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 += 0x200;
+ /* color_prom now points to the beginning of the lookup table */
+ color_prom += 0x300;
- for (i = 0;i < 256;i++)
+ for (i = 0; i < 0x100; i++)
{
- *colortable++ = ((color_prom[0] & 0x0f) << 4) | (color_prom[0x100] & 0x0f);
- color_prom++;
+ UINT8 ctabentry = ((color_prom[i] & 0x0f) << 4) | (color_prom[i + 0x100] & 0x0f);
+ colortable_entry_set_value(machine->colortable, i, ctabentry);
}
}
PALETTE_INIT( paddlem )
{
- int i,bit0,bit1,bit2,bit3,r,g,b;
+ int i;
- for (i = 0;i < 256;i++)
+ /* allocate the colortable */
+ machine->colortable = colortable_alloc(machine, 0x100);
+
+ /* create a lookup table for the palette */
+ for (i = 0; i < 0x100; i++)
{
- 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[0x100] >> 0) & 0x01;
- bit1 = (color_prom[0x100] >> 1) & 0x01;
- bit2 = (color_prom[0x100] >> 2) & 0x01;
- bit3 = (color_prom[0x100] >> 3) & 0x01;
- g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
-
- bit0 = (color_prom[0x200] >> 0) & 0x01;
- bit1 = (color_prom[0x200] >> 1) & 0x01;
- bit2 = (color_prom[0x200] >> 2) & 0x01;
- bit3 = (color_prom[0x200] >> 3) & 0x01;
- b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
-
- palette_set_color(machine,i,MAKE_RGB(r,g,b));
- color_prom++;
+ 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));
}
- /* Fill in clut */
- color_prom += 0x200;
- for (i=0; i<1024; i++) colortable[i] = color_prom[i]|(color_prom[i+0x400]<<4);
+ /* color_prom now points to the beginning of the lookup table */
+ color_prom += 0x300;
+
+ for (i = 0; i < 0x400; i++)
+ {
+ UINT8 ctabentry = ((color_prom[i + 0x400] & 0x0f) << 4) | (color_prom[i] & 0x0f);
+ colortable_entry_set_value(machine->colortable, i, ctabentry);
+ }
}
void kyros_video_banking(int *bank, int data)
@@ -495,7 +479,8 @@ static void kyros_draw_sprites(running_machine *machine, mame_bitmap *bitmap, co
VIDEO_UPDATE( kyros )
{
- fillbitmap(bitmap,*videoram16 & 0xff,cliprect); //AT
+ colortable_entry_set_value(machine->colortable, 0x100, *videoram16 & 0xff);
+ fillbitmap(bitmap, machine->pens[0x100], cliprect); //AT
kyros_draw_sprites(machine, bitmap,cliprect,2,0x0800);
kyros_draw_sprites(machine, bitmap,cliprect,3,0x0c00);
@@ -552,7 +537,8 @@ static void sstingry_draw_sprites(running_machine *machine, mame_bitmap *bitmap,
VIDEO_UPDATE( sstingry )
{
- fillbitmap(bitmap,*videoram16 & 0xff,cliprect); //AT
+ colortable_entry_set_value(machine->colortable, 0x100, *videoram16 & 0xff);
+ fillbitmap(bitmap, machine->pens[0x100], cliprect); //AT
sstingry_draw_sprites(machine, bitmap,cliprect,2,0x0800);
sstingry_draw_sprites(machine, bitmap,cliprect,3,0x0c00);
diff --git a/src/mame/video/irobot.c b/src/mame/video/irobot.c
index 9ae04452499..6394b11db36 100644
--- a/src/mame/video/irobot.c
+++ b/src/mame/video/irobot.c
@@ -45,36 +45,19 @@ static int ir_xmin, ir_ymin, ir_xmax, ir_ymax; /* clipping area */
PALETTE_INIT( irobot )
{
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])
- /* Convert the color prom for the text palette */
- for (i = 0;i < 32;i++)
+ /* convert the color prom for the text palette */
+ for (i = 0; i < 32; i++)
{
- int r,g,b;
- int bits,intensity;
- UINT32 color;
-
- color = *color_prom;
- intensity = color & 0x03;
- bits = (color >> 6) & 0x03;
- r = 28 * bits * intensity;
- bits = (color >> 4) & 0x03;
- g = 28 * bits * intensity;
- bits = (color >> 2) & 0x03;
- b = 28 * bits * intensity;
- palette_set_color(machine,i+64,MAKE_RGB(r,g,b));
- color_prom++;
- }
+ int intensity = color_prom[i] & 0x03;
- /* polygons */
- for (i = 0;i < 64;i++)
- colortable[i] = i;
+ int r = 28 * ((color_prom[i] >> 6) & 0x03) * intensity;
+ int g = 28 * ((color_prom[i] >> 4) & 0x03) * intensity;
+ int b = 28 * ((color_prom[i] >> 2) & 0x03) * intensity;
- /* text */
- for (i = 0;i < TOTAL_COLORS(0);i++)
- {
- COLOR(0,i) = ((i & 0x18) | ((i & 0x01) << 2) | ((i & 0x06) >> 1)) + 64;
+ int swapped_i = BITSWAP8(i,7,6,5,4,3,0,1,2);
+
+ palette_set_color(machine, swapped_i + 64, MAKE_RGB(r, g, b));
}
}
@@ -248,22 +231,22 @@ void irobot_run_video(void)
polybitmap = polybitmap1;
lpnt=0;
- while (lpnt < 0x7FF)
+ while (lpnt < 0x7ff)
{
d1 = combase16[lpnt++];
- if (d1 == 0xFFFF) break;
- spnt = d1 & 0x07FF;
- shp = (d1 & 0xF000) >> 12;
+ if (d1 == 0xffff) break;
+ spnt = d1 & 0x07ff;
+ shp = (d1 & 0xf000) >> 12;
- /* Pixel */
+ /* pixel */
if (shp == 0x8)
{
- while (spnt < 0x7FF)
+ while (spnt < 0x7ff)
{
sx = combase16[spnt];
- if (sx == 0xFFFF) break;
+ if (sx == 0xffff) break;
sy = combase16[spnt+1];
- color = sy & 0x3F;
+ color = sy & 0x3f;
sx = ROUND_TO_PIXEL(sx);
sy = ROUND_TO_PIXEL(sy);
if (sx >= ir_xmin && sx < ir_xmax && sy >= ir_ymin && sy < ir_ymax)
@@ -272,16 +255,16 @@ void irobot_run_video(void)
}//while object
}//if point
- /* Line */
- if (shp == 0xC)
+ /* line */
+ if (shp == 0xc)
{
- while (spnt < 0x7FF)
+ while (spnt < 0x7ff)
{
ey = combase16[spnt];
- if (ey == 0xFFFF) break;
+ if (ey == 0xffff) break;
ey = ROUND_TO_PIXEL(ey);
sy = combase16[spnt+1];
- color = sy & 0x3F;
+ color = sy & 0x3f;
sy = ROUND_TO_PIXEL(sy);
sx = combase16[spnt+3];
word1 = (INT16)combase16[spnt+2];
@@ -291,21 +274,21 @@ void irobot_run_video(void)
}//while object
}//if line
- /* Polygon */
+ /* polygon */
if (shp == 0x4)
{
- spnt2 = combase16[spnt] & 0x7FF;
+ spnt2 = combase16[spnt] & 0x7ff;
sx = combase16[spnt+1];
sx2 = combase16[spnt+2];
sy = combase16[spnt+3];
- color = sy & 0x3F;
+ color = sy & 0x3f;
sy = ROUND_TO_PIXEL(sy);
spnt+=4;
word1 = (INT16)combase16[spnt];
ey = combase16[spnt+1];
- if (word1 != -1 || ey != 0xFFFF)
+ if (word1 != -1 || ey != 0xffff)
{
ey = ROUND_TO_PIXEL(ey);
spnt+=2;
@@ -338,7 +321,7 @@ void irobot_run_video(void)
{
word1 = (INT16)combase16[spnt];
ey = combase16[spnt+1];
- if (word1 == -1 && ey == 0xFFFF)
+ if (word1 == -1 && ey == 0xffff)
break;
ey = ROUND_TO_PIXEL(ey);
spnt+=2;
@@ -375,17 +358,15 @@ VIDEO_UPDATE( irobot )
/* redraw the non-zero characters in the alpha layer */
for (y = offs = 0; y < 32; y++)
for (x = 0; x < 32; x++, offs++)
- if (videoram[offs] != 0)
- {
- int code = videoram[offs] & 0x3f;
- int color = ((videoram[offs] & 0xC0) >> 6) | (irobot_alphamap >> 3);
- int transp=color + 64;
-
- drawgfx(bitmap,machine->gfx[0],
- code, color,
- 0,0,
- 8*x,8*y,
- cliprect,TRANSPARENCY_COLOR,transp);
- }
+ {
+ int code = videoram[offs] & 0x3f;
+ int color = ((videoram[offs] & 0xc0) >> 6) | (irobot_alphamap >> 3);
+
+ drawgfx(bitmap,machine->gfx[0],
+ code, color,
+ 0,0,
+ 8*x,8*y,
+ cliprect,TRANSPARENCY_PEN,0);
+ }
return 0;
}