summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Zsolt Vasvari <zsoltvas@mamedev.org>2008-02-01 15:06:05 +0000
committer Zsolt Vasvari <zsoltvas@mamedev.org>2008-02-01 15:06:05 +0000
commitdea8c5257d60e148da6d0a3eecdcbc08f2294bef (patch)
treeb32ed65650502472a9495d829ec2f61fa1e9e554
parenta1e1f436b48756e351d1bd212c09b6ca3b8ed31f (diff)
Another batch of drivers getting their colortable removed
-rw-r--r--src/mame/drivers/bladestl.c9
-rw-r--r--src/mame/drivers/cop01.c6
-rw-r--r--src/mame/drivers/cosmic.c61
-rw-r--r--src/mame/drivers/crbaloon.c3
-rw-r--r--src/mame/drivers/ddrible.c5
-rw-r--r--src/mame/drivers/irobot.c3
-rw-r--r--src/mame/video/bladestl.c39
-rw-r--r--src/mame/video/cop01.c63
-rw-r--r--src/mame/video/cosmic.c255
-rw-r--r--src/mame/video/crbaloon.c28
-rw-r--r--src/mame/video/ddrible.c34
-rw-r--r--src/mame/video/irobot.c30
12 files changed, 254 insertions, 282 deletions
diff --git a/src/mame/drivers/bladestl.c b/src/mame/drivers/bladestl.c
index 091e2c6c341..ac995368b80 100644
--- a/src/mame/drivers/bladestl.c
+++ b/src/mame/drivers/bladestl.c
@@ -35,10 +35,10 @@ Notes:
/* from video */
int bladestl_spritebank;
+PALETTE_INIT( bladestl );
VIDEO_START( bladestl );
VIDEO_UPDATE( bladestl );
WRITE8_HANDLER( bladestl_vreg_w );
-WRITE8_HANDLER( bladestl_palette_ram_w );
static INTERRUPT_GEN( bladestl_interrupt )
{
@@ -125,7 +125,7 @@ static ADDRESS_MAP_START( bladestl_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x1fff) AM_WRITE(K007342_w) /* Color RAM + Video RAM */
AM_RANGE(0x2000, 0x21ff) AM_WRITE(K007420_w) /* Sprite RAM */
AM_RANGE(0x2200, 0x23ff) AM_WRITE(K007342_scroll_w) /* Scroll RAM */
- AM_RANGE(0x2400, 0x245f) AM_WRITE(bladestl_palette_ram_w) AM_BASE(&paletteram)/* palette */
+ AM_RANGE(0x2400, 0x245f) AM_WRITE(MWA8_RAM) AM_BASE(&paletteram)/* palette */
AM_RANGE(0x2600, 0x2607) AM_WRITE(K007342_vreg_w) /* Video Registers */
AM_RANGE(0x2e80, 0x2e80) AM_WRITE(bladestl_sh_irqtrigger_w)/* cause interrupt on audio CPU */
AM_RANGE(0x2ec0, 0x2ec0) AM_WRITE(watchdog_reset_w) /* watchdog reset */
@@ -407,7 +407,7 @@ static const gfx_layout spritelayout =
static GFXDECODE_START( bladestl )
GFXDECODE_ENTRY( REGION_GFX1, 0x000000, charlayout, 0, 2 ) /* colors 00..31 */
- GFXDECODE_ENTRY( REGION_GFX1, 0x040000, spritelayout, 48, 16 ) /* colors 32..47 but using lookup table */
+ GFXDECODE_ENTRY( REGION_GFX1, 0x040000, spritelayout, 32, 16 ) /* colors 32..47 but using lookup table */
GFXDECODE_END
/***************************************************************************
@@ -450,7 +450,8 @@ static MACHINE_DRIVER_START( bladestl )
MDRV_SCREEN_SIZE(32*8, 32*8)
MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
MDRV_GFXDECODE(bladestl)
- MDRV_PALETTE_LENGTH(48 + 16*16)
+ MDRV_PALETTE_INIT(bladestl)
+ MDRV_PALETTE_LENGTH(32 + 16*16)
MDRV_VIDEO_START(bladestl)
MDRV_VIDEO_UPDATE(bladestl)
diff --git a/src/mame/drivers/cop01.c b/src/mame/drivers/cop01.c
index d4987f5172b..ebc9b757272 100644
--- a/src/mame/drivers/cop01.c
+++ b/src/mame/drivers/cop01.c
@@ -434,8 +434,7 @@ static MACHINE_DRIVER_START( cop01 )
MDRV_SCREEN_SIZE(32*8, 32*8)
MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
MDRV_GFXDECODE(cop01)
- MDRV_PALETTE_LENGTH(256)
- MDRV_COLORTABLE_LENGTH(16+8*16+16*16)
+ MDRV_PALETTE_LENGTH(16+8*16+16*16)
MDRV_PALETTE_INIT(cop01)
MDRV_VIDEO_START(cop01)
@@ -476,8 +475,7 @@ static MACHINE_DRIVER_START( mightguy )
MDRV_SCREEN_SIZE(32*8, 32*8)
MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
MDRV_GFXDECODE(cop01)
- MDRV_PALETTE_LENGTH(256)
- MDRV_COLORTABLE_LENGTH(16+8*16+16*16)
+ MDRV_PALETTE_LENGTH(16+8*16+16*16)
MDRV_PALETTE_INIT(cop01)
MDRV_VIDEO_START(cop01)
diff --git a/src/mame/drivers/cosmic.c b/src/mame/drivers/cosmic.c
index 5794d61050d..1d6ae29f83f 100644
--- a/src/mame/drivers/cosmic.c
+++ b/src/mame/drivers/cosmic.c
@@ -21,10 +21,10 @@ Devil Zone - 8022
PALETTE_INIT( panic );
PALETTE_INIT( cosmica );
PALETTE_INIT( cosmicg );
-PALETTE_INIT( magspot2 );
+PALETTE_INIT( magspot );
PALETTE_INIT( nomnlnd );
VIDEO_UPDATE( panic );
-VIDEO_UPDATE( magspot2 );
+VIDEO_UPDATE( magspot );
VIDEO_UPDATE( devzone );
VIDEO_UPDATE( cosmica );
VIDEO_UPDATE( cosmicg );
@@ -225,7 +225,7 @@ static INTERRUPT_GEN( cosmicg_interrupt )
cpunum_set_input_line(machine, 0, 0, CLEAR_LINE);
}
-static INTERRUPT_GEN( magspot2_interrupt )
+static INTERRUPT_GEN( magspot_interrupt )
{
/* Coin 1 causes an IRQ, Coin 2 an NMI */
if (input_port_4_r(0) & 0x01)
@@ -255,7 +255,7 @@ static READ8_HANDLER( cosmicg_port_0_r )
return (input_port_0_r(0) & 0xf0) | ((video_screen_get_vpos(0) & 0xf0) >> 4);
}
-static READ8_HANDLER( magspot2_coinage_dip_r )
+static READ8_HANDLER( magspot_coinage_dip_r )
{
return (input_port_5_r(0) & (1 << (7 - offset))) ? 0 : 1;
}
@@ -354,9 +354,9 @@ static ADDRESS_MAP_START( cosmicg_writeport, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_END
-static ADDRESS_MAP_START( magspot2_readmem, ADDRESS_SPACE_PROGRAM, 8 )
+static ADDRESS_MAP_START( magspot_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x2fff) AM_READ(MRA8_ROM)
- AM_RANGE(0x3800, 0x3807) AM_READ(magspot2_coinage_dip_r)
+ AM_RANGE(0x3800, 0x3807) AM_READ(magspot_coinage_dip_r)
AM_RANGE(0x5000, 0x5000) AM_READ(input_port_0_r)
AM_RANGE(0x5001, 0x5001) AM_READ(input_port_1_r)
AM_RANGE(0x5002, 0x5002) AM_READ(input_port_2_r)
@@ -364,7 +364,7 @@ static ADDRESS_MAP_START( magspot2_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x6000, 0x7fff) AM_READ(MRA8_RAM)
ADDRESS_MAP_END
-static ADDRESS_MAP_START( magspot2_writemem, ADDRESS_SPACE_PROGRAM, 8 )
+static ADDRESS_MAP_START( magspot_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x2fff) AM_WRITE(MWA8_ROM)
AM_RANGE(0x4000, 0x401f) AM_WRITE(MWA8_RAM) AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
AM_RANGE(0x4800, 0x4800) AM_WRITE(DAC_0_data_w)
@@ -538,7 +538,7 @@ static INPUT_PORTS_START( cosmicg )
INPUT_PORTS_END
-static INPUT_PORTS_START( magspot2 )
+static INPUT_PORTS_START( magspot )
PORT_START /* IN0 */
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_2WAY
@@ -923,13 +923,13 @@ static const gfx_layout cosmic_spritelayout32 =
static GFXDECODE_START( panic )
- GFXDECODE_ENTRY( REGION_GFX1, 0, cosmic_spritelayout16, 0, 8 )
- GFXDECODE_ENTRY( REGION_GFX1, 0, cosmic_spritelayout32, 0, 8 )
+ GFXDECODE_ENTRY( REGION_GFX1, 0, cosmic_spritelayout16, 16, 8 )
+ GFXDECODE_ENTRY( REGION_GFX1, 0, cosmic_spritelayout32, 16, 8 )
GFXDECODE_END
static GFXDECODE_START( cosmica )
- GFXDECODE_ENTRY( REGION_GFX1, 0, cosmic_spritelayout16, 0, 16 )
- GFXDECODE_ENTRY( REGION_GFX1, 0, cosmic_spritelayout32, 0, 16 )
+ GFXDECODE_ENTRY( REGION_GFX1, 0, cosmic_spritelayout16, 8, 16 )
+ GFXDECODE_ENTRY( REGION_GFX1, 0, cosmic_spritelayout32, 8, 16 )
GFXDECODE_END
@@ -1010,8 +1010,7 @@ static MACHINE_DRIVER_START( panic )
/* video hardware */
MDRV_GFXDECODE(panic)
- MDRV_PALETTE_LENGTH(16)
- MDRV_COLORTABLE_LENGTH(8*4)
+ MDRV_PALETTE_LENGTH(16+8*4)
MDRV_PALETTE_INIT(panic)
MDRV_VIDEO_UPDATE(panic)
@@ -1039,8 +1038,7 @@ static MACHINE_DRIVER_START( cosmica )
/* video hardware */
MDRV_GFXDECODE(cosmica)
- MDRV_PALETTE_LENGTH(8)
- MDRV_COLORTABLE_LENGTH(16*4)
+ MDRV_PALETTE_LENGTH(8+16*4)
MDRV_PALETTE_INIT(cosmica)
MDRV_VIDEO_UPDATE(cosmica)
@@ -1083,22 +1081,21 @@ static MACHINE_DRIVER_START( cosmicg )
MACHINE_DRIVER_END
-static MACHINE_DRIVER_START( magspot2 )
+static MACHINE_DRIVER_START( magspot )
/* basic machine hardware */
MDRV_IMPORT_FROM(cosmic)
MDRV_CPU_MODIFY("main")
- MDRV_CPU_PROGRAM_MAP(magspot2_readmem,magspot2_writemem)
- MDRV_CPU_VBLANK_INT(magspot2_interrupt,1)
+ MDRV_CPU_PROGRAM_MAP(magspot_readmem,magspot_writemem)
+ MDRV_CPU_VBLANK_INT(magspot_interrupt,1)
/* video hardware */
MDRV_GFXDECODE(panic)
- MDRV_PALETTE_LENGTH(16)
- MDRV_COLORTABLE_LENGTH(8*4)
+ MDRV_PALETTE_LENGTH(16+8*4)
- MDRV_PALETTE_INIT(magspot2)
- MDRV_VIDEO_UPDATE(magspot2)
+ MDRV_PALETTE_INIT(magspot)
+ MDRV_VIDEO_UPDATE(magspot)
/* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono")
@@ -1111,7 +1108,7 @@ MACHINE_DRIVER_END
static MACHINE_DRIVER_START( devzone )
/* basic machine hardware */
- MDRV_IMPORT_FROM(magspot2)
+ MDRV_IMPORT_FROM(magspot)
/* video hardware */
MDRV_VIDEO_UPDATE(devzone)
@@ -1124,13 +1121,12 @@ static MACHINE_DRIVER_START( nomnlnd )
MDRV_IMPORT_FROM(cosmic)
MDRV_CPU_MODIFY("main")
- MDRV_CPU_PROGRAM_MAP(magspot2_readmem,magspot2_writemem)
+ MDRV_CPU_PROGRAM_MAP(magspot_readmem,magspot_writemem)
MDRV_CPU_VBLANK_INT(nomnlnd_interrupt,1)
/* video hardware */
MDRV_GFXDECODE(panic)
- MDRV_PALETTE_LENGTH(8)
- MDRV_COLORTABLE_LENGTH(8*4)
+ MDRV_PALETTE_LENGTH(16+8*4)
MDRV_PALETTE_INIT(nomnlnd)
MDRV_VIDEO_UPDATE(nomnlnd)
@@ -1478,13 +1474,6 @@ static DRIVER_INIT( cosmicg )
memory_region(REGION_CPU1)[offs] = normal;
}
-
-
- /* Patch to avoid crash - Seems like duff romcheck routine */
- /* I would expect it to be bitrot, but have two romsets */
- /* from different sources with the same problem! */
- memory_region(REGION_CPU1)[0x1e9e] = 0x04;
- memory_region(REGION_CPU1)[0x1e9f] = 0xc0;
}
@@ -1511,8 +1500,8 @@ GAME( 1980, panic2, panic, panic, panic, 0, ROT270, "Universal",
GAME( 1980, panic3, panic, panic, panic, 0, ROT270, "Universal", "Space Panic (set 3)", 0 )
GAME( 1980, panich, panic, panic, panic, 0, ROT270, "Universal", "Space Panic (harder)", 0 )
GAME( 1980, panicger, panic, panic, panic, 0, ROT270, "Universal (ADP Automaten license)", "Space Panic (German)", 0 )
-GAME( 1980, magspot, 0, magspot2, magspot2, 0, ROT270, "Universal", "Magical Spot", GAME_IMPERFECT_SOUND )
-GAME( 1980, magspot2, 0, magspot2, magspot2, 0, ROT270, "Universal", "Magical Spot II", GAME_IMPERFECT_SOUND )
+GAME( 1980, magspot, 0, magspot, magspot, 0, ROT270, "Universal", "Magical Spot", GAME_IMPERFECT_SOUND )
+GAME( 1980, magspot2, 0, magspot, magspot, 0, ROT270, "Universal", "Magical Spot II", GAME_IMPERFECT_SOUND )
GAME( 1980, devzone, 0, devzone, devzone, devzone, ROT270, "Universal", "Devil Zone", GAME_IMPERFECT_SOUND )
GAME( 1980, devzone2, devzone, devzone, devzone2, devzone, ROT270, "Universal", "Devil Zone (easier)", GAME_IMPERFECT_SOUND )
GAME( 1980, nomnlnd, 0, nomnlnd, nomnlnd, nomnlnd, ROT270, "Universal", "No Man's Land", GAME_IMPERFECT_SOUND )
diff --git a/src/mame/drivers/crbaloon.c b/src/mame/drivers/crbaloon.c
index 990fdfd5c33..f3488f3aa00 100644
--- a/src/mame/drivers/crbaloon.c
+++ b/src/mame/drivers/crbaloon.c
@@ -375,9 +375,8 @@ static MACHINE_DRIVER_START( crbaloon )
MDRV_VIDEO_UPDATE(crbaloon)
MDRV_GFXDECODE(crbaloon)
- MDRV_PALETTE_LENGTH(16)
+ MDRV_PALETTE_LENGTH(32)
MDRV_PALETTE_INIT(crbaloon)
- MDRV_COLORTABLE_LENGTH(16*2)
MDRV_SCREEN_REFRESH_RATE(60)
MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)
diff --git a/src/mame/drivers/ddrible.c b/src/mame/drivers/ddrible.c
index 693b617402c..61e2af7fe79 100644
--- a/src/mame/drivers/ddrible.c
+++ b/src/mame/drivers/ddrible.c
@@ -136,7 +136,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( writemem_cpu0, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x0004) AM_WRITE(K005885_0_w) /* video registers (005885 #1) */
AM_RANGE(0x0800, 0x0804) AM_WRITE(K005885_1_w) /* video registers (005885 #2) */
- AM_RANGE(0x1800, 0x187f) AM_WRITE(paletteram_xBBBBBGGGGGRRRRR_be_w) AM_BASE(&paletteram)/* seems wrong, MSB is used as well */
+ AM_RANGE(0x1800, 0x187f) AM_WRITE(MWA8_RAM) AM_BASE(&paletteram)
AM_RANGE(0x2000, 0x2fff) AM_WRITE(ddrible_fg_videoram_w) AM_BASE(&ddrible_fg_videoram)/* Video RAM 1 */
AM_RANGE(0x3000, 0x3fff) AM_WRITE(MWA8_RAM) AM_BASE(&ddrible_spriteram_1) /* Object RAM 1 */
AM_RANGE(0x4000, 0x5fff) AM_WRITE(MWA8_RAM) AM_BASE(&ddrible_sharedram) /* shared RAM with CPU #1 */
@@ -363,8 +363,7 @@ static MACHINE_DRIVER_START( ddribble )
/* MDRV_SCREEN_SIZE(64*8, 32*8)
MDRV_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 2*8, 30*8-1) */
MDRV_GFXDECODE(ddrible)
- MDRV_PALETTE_LENGTH(64)
- MDRV_COLORTABLE_LENGTH(64 + 256)
+ MDRV_PALETTE_LENGTH(64 + 256)
MDRV_PALETTE_INIT(ddrible)
MDRV_VIDEO_START(ddrible)
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/bladestl.c b/src/mame/video/bladestl.c
index 0d47558dc2a..d1f378c6661 100644
--- a/src/mame/video/bladestl.c
+++ b/src/mame/video/bladestl.c
@@ -1,29 +1,46 @@
#include "driver.h"
-#include "deprecat.h"
#include "video/konamiic.h"
static int layer_colorbase[2];
extern int bladestl_spritebank;
-WRITE8_HANDLER( bladestl_palette_ram_w )
+PALETTE_INIT( bladestl )
{
- paletteram_xBBBBBGGGGGRRRRR_be_w(offset, data);
+ int i;
- /* if it's a sprite color, modify the pens that reference this color */
- if (offset >= 0x40)
+ /* allocate the colortable */
+ machine->colortable = colortable_alloc(machine, 0x30);
+
+ /* characters use pens 0x00-0x1f, no look-up table */
+ for (i = 0; i < 0x20; i++)
+ colortable_entry_set_value(machine->colortable, i, i);
+
+ /* sprites use pens 0x20-0x2f */
+ for (i = 0x20; i < 0x120; i++)
{
- int i;
+ UINT8 ctabentry = (color_prom[i - 0x20] & 0x0f) | 0x20;
+ colortable_entry_set_value(machine->colortable, i, ctabentry);
+ }
+}
+
- UINT8 *lookup_prom = memory_region(REGION_PROMS);
+static void set_pens(running_machine *machine)
+{
+ int i;
- for (i = 0; i < 0x100; i++)
- if ((lookup_prom[i] & 0x0f) == ((offset >> 1) & 0x0f))
- palette_set_color(Machine, i + 0x30, palette_get_color(Machine, offset >> 1));
+ for (i = 0x00; i < 0x60; i += 2)
+ {
+ UINT16 data = paletteram[i | 1] | (paletteram[i] << 8);
+
+ rgb_t color = MAKE_RGB(pal5bit(data >> 0), pal5bit(data >> 5), pal5bit(data >> 10));
+
+ colortable_palette_set_color(machine->colortable, i >> 1, color);
}
}
+
/***************************************************************************
Callback for the K007342
@@ -73,6 +90,8 @@ VIDEO_START( bladestl )
VIDEO_UPDATE( bladestl )
{
+ set_pens(machine);
+
K007342_tilemap_update();
K007342_tilemap_draw( bitmap, cliprect, 1, TILEMAP_DRAW_OPAQUE ,0);
diff --git a/src/mame/video/cop01.c b/src/mame/video/cop01.c
index 0de69518f79..c6c19890c1c 100644
--- a/src/mame/video/cop01.c
+++ b/src/mame/video/cop01.c
@@ -20,50 +20,43 @@ static tilemap *bg_tilemap,*fg_tilemap;
PALETTE_INIT( cop01 )
{
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])
- 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;
-
- 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;
-
- 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 += 2*machine->drv->total_colors;
- /* color_prom now points to the beginning of the lookup tables */
+ /* color_prom now points to the beginning of the lookup table */
+ color_prom += 0x300;
- /* characters use colors 0-15 (or 0-127, but the eight rows are identical) */
- for (i = 0;i < TOTAL_COLORS(0);i++)
- COLOR(0,i) = i;
+ /* characters use colors 0x00-0x0f (or 0x00-0x7f, but the eight rows are identical) */
+ for (i = 0; i < 0x10; i++)
+ colortable_entry_set_value(machine->colortable, i, i);
- /* background tiles use colors 192-255 */
+ /* background tiles use colors 0xc0-0xff */
/* I don't know how much of the lookup table PROM is hooked up, */
/* I'm only using the first 32 bytes because the rest is empty. */
- for (i = 0;i < TOTAL_COLORS(1);i++)
- COLOR(1,i) = 0xc0 + (i & 0x30) + (color_prom[((i & 0x40) >> 2) + (i & 0x0f)] & 0x0f);
- color_prom += 256;
+ for (i = 0x10; i < 0x90; i++)
+ {
+ UINT8 ctabentry = 0xc0 | ((i - 0x10) & 0x30) |
+ (color_prom[(((i - 0x10) & 0x40) >> 2) | ((i - 0x10) & 0x0f)] & 0x0f);
+ colortable_entry_set_value(machine->colortable, i, ctabentry);
+ }
- /* sprites use colors 128-143 (or 128-191, but the four rows are identical) */
- for (i = 0;i < TOTAL_COLORS(2);i++)
- COLOR(2,i) = 0x80 + (*(color_prom++) & 0x0f);
+ /* sprites use colors 0x80-0x8f (or 0x80-0xbf, but the four rows are identical) */
+ for (i = 0x90; i < 0x190; i++)
+ {
+ UINT8 ctabentry = 0x80 | (color_prom[i - 0x90 + 0x100] & 0x0f);
+ colortable_entry_set_value(machine->colortable, i, ctabentry);
+ }
}
diff --git a/src/mame/video/cosmic.c b/src/mame/video/cosmic.c
index 9771243dd4d..c5719b30a51 100644
--- a/src/mame/video/cosmic.c
+++ b/src/mame/video/cosmic.c
@@ -26,12 +26,8 @@ WRITE8_HANDLER( cosmic_color_register_w )
static pen_t panic_map_color(UINT8 x, UINT8 y)
{
- offs_t offs;
- pen_t pen;
-
-
- offs = (color_registers[0] << 9) | (color_registers[2] << 10) | ((x >> 4) << 5) | (y >> 3);
- pen = memory_region(REGION_USER1)[offs];
+ offs_t offs = (color_registers[0] << 9) | (color_registers[2] << 10) | ((x >> 4) << 5) | (y >> 3);
+ pen_t pen = memory_region(REGION_USER1)[offs];
if (color_registers[1])
pen >>= 4;
@@ -41,12 +37,8 @@ static pen_t panic_map_color(UINT8 x, UINT8 y)
static pen_t cosmica_map_color(UINT8 x, UINT8 y)
{
- offs_t offs;
- pen_t pen;
-
-
- offs = (color_registers[0] << 9) | ((x >> 4) << 5) | (y >> 3);
- pen = memory_region(REGION_USER1)[offs];
+ offs_t offs = (color_registers[0] << 9) | ((x >> 4) << 5) | (y >> 3);
+ pen_t pen = memory_region(REGION_USER1)[offs];
if (color_registers[0]) /* yes, 0 again according to the schematics */
pen >>= 4;
@@ -56,26 +48,18 @@ static pen_t cosmica_map_color(UINT8 x, UINT8 y)
static pen_t cosmicg_map_color(UINT8 x, UINT8 y)
{
- offs_t offs;
- pen_t pen;
-
-
- offs = (color_registers[0] << 8) | (color_registers[1] << 9) | ((y >> 4) << 4) | (x >> 4);
- pen = memory_region(REGION_USER1)[offs];
+ offs_t offs = (color_registers[0] << 8) | (color_registers[1] << 9) | ((y >> 4) << 4) | (x >> 4);
+ pen_t pen = memory_region(REGION_USER1)[offs];
/* the upper 4 bits are for cocktail mode support */
return pen & 0x0f;
}
-static pen_t magspot2_map_color(UINT8 x, UINT8 y)
+static pen_t magspot_map_color(UINT8 x, UINT8 y)
{
- offs_t offs;
- pen_t pen;
-
-
- offs = (color_registers[0] << 9) | ((x >> 3) << 4) | (y >> 4);
- pen = memory_region(REGION_USER1)[offs];
+ offs_t offs = (color_registers[0] << 9) | ((x >> 3) << 4) | (y >> 4);
+ pen_t pen = memory_region(REGION_USER1)[offs];
if (color_registers[1])
pen >>= 4;
@@ -99,25 +83,30 @@ static pen_t magspot2_map_color(UINT8 x, UINT8 y)
PALETTE_INIT( panic )
{
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])
- for (i = 0;i < machine->drv->total_colors;i++)
+ /* allocate the colortable */
+ machine->colortable = colortable_alloc(machine, 0x10);
+
+ /* create a lookup table for the palette */
+ for (i = 0; i < 0x10; i++)
{
- int r = 0xff * ((i >> 0) & 1);
- int g = 0xff * ((i >> 1) & 1);
- int b;
- if ((i & 0x0c) == 0x08)
- b = 0xaa;
- else
- b = 0xff * ((i >> 2) & 1);
- palette_set_color(machine,i,MAKE_RGB(r,g,b));
- }
+ int r = pal1bit(i >> 0);
+ int g = pal1bit(i >> 1);
+ int b = ((i & 0x0c) == 0x08) ? 0xaa : pal1bit(i >> 2);
+ colortable_palette_set_color(machine->colortable, i, MAKE_RGB(r, g, b));
+ }
- for (i = 0;i < TOTAL_COLORS(0);i++)
- COLOR(0,i) = *(color_prom++) & 0x07;
+ /* background uses colors 0x00-0x0f */
+ for (i = 0; i < 0x0f; i++)
+ colortable_entry_set_value(machine->colortable, i, i);
+ /* sprites use colors 0x00-0x07 */
+ for (i = 0x10; i < 0x30; i++)
+ {
+ UINT8 ctabentry = color_prom[i - 0x10] & 0x07;
+ colortable_entry_set_value(machine->colortable, i, ctabentry);
+ }
map_color = panic_map_color;
}
@@ -136,19 +125,30 @@ PALETTE_INIT( cosmica )
{
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, 0x08);
- for (i = 0;i < machine->drv->total_colors;i++)
- palette_set_color_rgb(machine,i,pal1bit(i >> 0),pal1bit(i >> 1),pal1bit(i >> 2));
+ /* create a lookup table for the palette */
+ for (i = 0; i < 0x08; i++)
+ {
+ rgb_t color = MAKE_RGB(pal1bit(i >> 0), pal1bit(i >> 1), pal1bit(i >> 2));
+ colortable_palette_set_color(machine->colortable, i, color);
+ }
+ /* background and sprites use colors 0x00-0x07 */
+ for (i = 0; i < 0x08; i++)
+ colortable_entry_set_value(machine->colortable, i, i);
- for (i = 0;i < TOTAL_COLORS(0)/2;i++)
+ for (i = 0x08; i < 0x28; i++)
{
- COLOR(0,i) = * color_prom & 0x07;
- COLOR(0,i+(TOTAL_COLORS(0)/2)) = (*(color_prom++) >> 4) & 0x07;
- }
+ UINT8 ctabentry;
+ ctabentry = (color_prom[i - 0x08] >> 0) & 0x07;
+ colortable_entry_set_value(machine->colortable, i + 0x00, ctabentry);
+
+ ctabentry = (color_prom[i - 0x08] >> 4) & 0x07;
+ colortable_entry_set_value(machine->colortable, i + 0x20, ctabentry);
+ }
map_color = cosmica_map_color;
}
@@ -163,56 +163,52 @@ PALETTE_INIT( cosmica )
* It's possible that the background is dark gray and not black, as the
* resistor chain would never drop to zero, Anybody know ?
*/
-
PALETTE_INIT( cosmicg )
{
int i;
- for (i = 0;i < machine->drv->total_colors;i++)
+ for (i = 0; i < machine->drv->total_colors; i++)
{
- int r,g,b;
-
- if (i > 8) r = 0xff;
- else r = 0xaa * ((i >> 0) & 1);
+ int r = (i > 8) ? 0xff : 0xaa * ((i >> 0) & 1);
+ int g = 0xaa * ((i >> 1) & 1);
+ int b = 0xaa * ((i >> 2) & 1);
- g = 0xaa * ((i >> 1) & 1);
- b = 0xaa * ((i >> 2) & 1);
- palette_set_color(machine,i,MAKE_RGB(r,g,b));
+ palette_set_color(machine, i, MAKE_RGB(r, g, b));
}
-
map_color = cosmicg_map_color;
}
-PALETTE_INIT( magspot2 )
+
+PALETTE_INIT( magspot )
{
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 r,g,b;
-
- if ((i & 0x09) == 0x08)
- r = 0xaa;
- else
- r = 0xff * ((i >> 0) & 1);
+ int r = ((i & 0x09) == 0x08) ? 0xaa : pal1bit(i >> 0);
+ int g = pal1bit(i >> 1);
+ int b = pal1bit(i >> 2);
- g = 0xff * ((i >> 1) & 1);
- b = 0xff * ((i >> 2) & 1);
- palette_set_color(machine,i,MAKE_RGB(r,g,b));
+ colortable_palette_set_color(machine->colortable, i, MAKE_RGB(r, g, b));
}
+ /* background uses colors 0x00-0x0f */
+ for (i = 0; i < 0x0f; i++)
+ colortable_entry_set_value(machine->colortable, i, i);
- for (i = 0;i < TOTAL_COLORS(0);i++)
+ /* sprites use colors 0x00-0x0f */
+ for (i = 0x10; i < 0x30; i++)
{
- COLOR(0,i) = *(color_prom++) & 0x0f;
+ UINT8 ctabentry = color_prom[i - 0x10] & 0x0f;
+ colortable_entry_set_value(machine->colortable, i, ctabentry);
}
-
- map_color = magspot2_map_color;
+ map_color = magspot_map_color;
magspot_pen_mask = 0x0f;
}
@@ -220,21 +216,29 @@ PALETTE_INIT( magspot2 )
PALETTE_INIT( nomnlnd )
{
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++)
- palette_set_color_rgb(machine,i,pal1bit(i >> 0),pal1bit(i >> 1),pal1bit(i >> 2));
+ /* create a lookup table for the palette */
+ for (i = 0; i < 0x10; i++)
+ {
+ rgb_t color = MAKE_RGB(pal1bit(i >> 0), pal1bit(i >> 1), pal1bit(i >> 2));
+ colortable_palette_set_color(machine->colortable, i, color);
+ }
+ /* background uses colors 0x00-0x07 */
+ for (i = 0; i < 0x07; i++)
+ colortable_entry_set_value(machine->colortable, i, i);
- for (i = 0;i < TOTAL_COLORS(0);i++)
+ /* sprites use colors 0x00-0x07 */
+ for (i = 0x10; i < 0x30; i++)
{
- COLOR(0,i) = *(color_prom++) & 0x07;
+ UINT8 ctabentry = color_prom[i - 0x10] & 0x07;
+ colortable_entry_set_value(machine->colortable, i, ctabentry);
}
-
- map_color = magspot2_map_color;
+ map_color = magspot_map_color;
magspot_pen_mask = 0x07;
}
@@ -249,33 +253,28 @@ static void draw_bitmap(running_machine *machine, mame_bitmap *bitmap, const rec
{
offs_t offs;
-
for (offs = 0; offs < videoram_size; offs++)
{
+ int i;
UINT8 data = videoram[offs];
- if (data != 0) /* optimization, not absolutely neccessary */
- {
- int i;
- UINT8 x = offs << 3;
- UINT8 y = offs >> 5;
-
- pen_t pen = machine->pens[map_color(x, y)];
+ UINT8 x = offs << 3;
+ UINT8 y = offs >> 5;
+ pen_t pen = machine->pens[map_color(x, y)];
- for (i = 0; i < 8; i++)
+ for (i = 0; i < 8; i++)
+ {
+ if (data & 0x80)
{
- if (data & 0x80)
- {
- if (flip_screen)
- *BITMAP_ADDR16(bitmap, 255-y, 255-x) = pen;
- else
- *BITMAP_ADDR16(bitmap, y, x) = pen;
- }
-
- x++;
- data <<= 1;
+ if (flip_screen)
+ *BITMAP_ADDR16(bitmap, 255-y, 255-x) = pen;
+ else
+ *BITMAP_ADDR16(bitmap, y, x) = pen;
}
+
+ x++;
+ data <<= 1;
}
}
}
@@ -285,7 +284,6 @@ static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const re
{
int offs;
-
for (offs = spriteram_size - 4;offs >= 0;offs -= 4)
{
if (spriteram[offs] != 0)
@@ -296,30 +294,22 @@ static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const re
color = ~spriteram[offs+3] & color_mask;
if (extra_sprites)
- {
code |= (spriteram[offs+3] & 0x08) << 3;
- }
if (spriteram[offs] & 0x80)
- {
/* 16x16 sprite */
-
drawgfx(bitmap,machine->gfx[0],
code, color,
0, ~spriteram[offs] & 0x40,
256-spriteram[offs+2],spriteram[offs+1],
cliprect,TRANSPARENCY_PEN,0);
- }
else
- {
/* 32x32 sprite */
-
drawgfx(bitmap,machine->gfx[1],
code >> 2, color,
0, ~spriteram[offs] & 0x40,
256-spriteram[offs+2],spriteram[offs+1],
cliprect,TRANSPARENCY_PEN,0);
- }
}
}
}
@@ -331,13 +321,11 @@ static void cosmica_draw_starfield(running_machine *machine, mame_bitmap *bitmap
UINT8 map = 0;
UINT8 *PROM = memory_region(REGION_USER2);
-
while (1)
{
int va = y & 0x01;
int vb = (y >> 1) & 0x01;
-
UINT8 x = 0;
while (1)
@@ -345,23 +333,17 @@ static void cosmica_draw_starfield(running_machine *machine, mame_bitmap *bitmap
UINT8 x1;
int hc, hb_;
-
if (flip_screen)
x1 = x - cpu_getcurrentframe();
else
x1 = x + cpu_getcurrentframe();
-
hc = (x1 >> 2) & 0x01;
hb_ = (x >> 5) & 0x01; /* not a bug, this one is the real x */
-
if ((x1 & 0x1f) == 0)
- {
// flip-flop at IC11 is clocked
map = PROM[(x1 >> 5) | (y >> 1 << 3)];
- }
-
if ((!(hc & va) & (vb ^ hb_)) && /* right network */
(((x1 ^ map) & (hc | 0x1e)) == 0x1e)) /* left network */
@@ -372,12 +354,10 @@ static void cosmica_draw_starfield(running_machine *machine, mame_bitmap *bitmap
*BITMAP_ADDR16(bitmap, y, x) = machine->pens[col];
}
-
x++;
if (x == 0) break;
}
-
y++;
if (y == 0) break;
}
@@ -395,38 +375,29 @@ static void devzone_draw_grid(running_machine *machine, mame_bitmap *bitmap, con
UINT8 horz_data = 0;
UINT8 vert_data;
-
for (y = 32; y < 224; y++)
{
UINT8 x = 0;
-
while (1)
{
int x1;
-
/* for the vertical lines, each bit indicates
if there should be a line at the x position */
vert_data = vert_PROM[x >> 3];
-
/* the horizontal (perspective) lines are RLE encoded.
When the screen is flipped, the address should be
decrementing. But since it's just a mirrored image,
this is easier. */
if (count == 0)
- {
count = horz_PROM[horz_addr++];
- }
count++;
if (count == 0)
- {
horz_data = horz_PROM[horz_addr++];
- }
-
for (x1 = 0; x1 < 8; x1++)
{
@@ -446,7 +417,6 @@ static void devzone_draw_grid(running_machine *machine, mame_bitmap *bitmap, con
x++;
}
-
if (x == 0) break;
}
}
@@ -459,11 +429,9 @@ static void nomnlnd_draw_background(running_machine *machine, mame_bitmap *bitma
UINT8 water = cpu_getcurrentframe();
UINT8 *PROM = memory_region(REGION_USER2);
-
/* all positioning is via logic gates:
tree is displayed where
-
__ __
HD' ^ HC' ^ HB'
@@ -471,13 +439,12 @@ static void nomnlnd_draw_background(running_machine *machine, mame_bitmap *bitma
__ __ __
(VB' ^ VC' ^ VD') X (VB' ^ VC' ^ VD')
-
water is displayed where
__ __
HD' ^ HC' ^ HB ^ HA'
and vertically the same equation as the trees,
- but final result inverted.
+ but the final result is inverted.
The colors are coded in logic gates:
@@ -488,7 +455,6 @@ static void nomnlnd_draw_background(running_machine *machine, mame_bitmap *bitma
G = Plane2 0 1 010
B = Plane1 ^ ~Plane2 1 0 100
1 1 011
-
water:
P1 P2 BGR or
R = Plane1 ^ Plane2 0 0 100 000
@@ -498,7 +464,6 @@ static void nomnlnd_draw_background(running_machine *machine, mame_bitmap *bitma
Not sure about B, the logic seems convulated for such
a simple result.
-
*/
while (1)
@@ -509,7 +474,6 @@ static void nomnlnd_draw_background(running_machine *machine, mame_bitmap *bitma
UINT8 x = 0;
-
while (1)
{
int color = 0;
@@ -520,7 +484,6 @@ static void nomnlnd_draw_background(running_machine *machine, mame_bitmap *bitma
int hc_ = (x >> 6) & 0x01;
int hd_ = x >> 7;
-
if ((!vb_ & vc_ & !vd_) ^ (vb_ & !vc_ & vd_))
{
/* tree */
@@ -559,7 +522,6 @@ static void nomnlnd_draw_background(running_machine *machine, mame_bitmap *bitma
}
}
-
if (color != 0)
{
pen_t pen = machine->pens[color];
@@ -570,7 +532,6 @@ static void nomnlnd_draw_background(running_machine *machine, mame_bitmap *bitma
*BITMAP_ADDR16(bitmap, y, x) = pen;
}
-
x++;
if (x == 0) break;
}
@@ -578,10 +539,7 @@ static void nomnlnd_draw_background(running_machine *machine, mame_bitmap *bitma
// this is obviously wrong
// if (vb_)
-// {
water++;
-// }
-
y++;
if (y == 0) break;
@@ -622,7 +580,7 @@ VIDEO_UPDATE( cosmica )
}
-VIDEO_UPDATE( magspot2 )
+VIDEO_UPDATE( magspot )
{
fillbitmap(bitmap, machine->pens[0], cliprect);
@@ -638,9 +596,7 @@ VIDEO_UPDATE( devzone )
fillbitmap(bitmap, machine->pens[0], cliprect);
if (background_enable)
- {
devzone_draw_grid(machine, bitmap, cliprect);
- }
draw_bitmap(machine, bitmap, cliprect);
@@ -660,9 +616,8 @@ VIDEO_UPDATE( nomnlnd )
draw_sprites(machine, bitmap, cliprect, 0x07, 0);
- if (background_enable)
- {
- nomnlnd_draw_background(machine, bitmap, cliprect);
- }
+ if (background_enable)
+ nomnlnd_draw_background(machine, bitmap, cliprect);
+
return 0;
}
diff --git a/src/mame/video/crbaloon.c b/src/mame/video/crbaloon.c
index 7de366d305a..6381d57468e 100644
--- a/src/mame/video/crbaloon.c
+++ b/src/mame/video/crbaloon.c
@@ -35,25 +35,23 @@ static tilemap *bg_tilemap;
PALETTE_INIT( crbaloon )
{
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])
-
for (i = 0; i < machine->drv->total_colors; i++)
{
- int h = (~i & 0x08) ? 0xff : 0x55;
+ UINT8 pen;
+ int h, r, g, b;
- int r = h * ((~i >> 0) & 1);
- int g = h * ((~i >> 1) & 1);
- int b = h * ((~i >> 2) & 1);
+ if (i & 0x01)
+ pen = i >> 1;
+ else
+ pen = 0x0f;
- palette_set_color(machine, i, MAKE_RGB(r, g, b));
- }
+ h = (~pen & 0x08) ? 0xff : 0x55;
+ r = h * ((~pen >> 0) & 1);
+ g = h * ((~pen >> 1) & 1);
+ b = h * ((~pen >> 2) & 1);
- for (i = 0; i < TOTAL_COLORS(0); i += 2)
- {
- COLOR(0, i + 0) = 0x0f; /* black background */
- COLOR(0, i + 1) = i / 2; /* colored foreground */
+ palette_set_color(machine, i, MAKE_RGB(r, g, b));
}
}
@@ -135,12 +133,12 @@ static void draw_sprite_and_check_collision(running_machine *machine, mame_bitma
/* draw the current pixel, but check collision first */
if (bit)
{
- if (*BITMAP_ADDR16(bitmap, sy, sx) != 0x0f)
+ if (*BITMAP_ADDR16(bitmap, sy, sx) & 0x01)
/* compute the collision address -- the +1 is via observation
of the game code, probably wrong for cocktail mode */
crbaloon_collision_address = ((((sy ^ 0xff) >> 3) << 5) | ((sx ^ 0xff) >> 3)) + 1;
- *BITMAP_ADDR16(bitmap, sy, sx) = color;
+ *BITMAP_ADDR16(bitmap, sy, sx) = (color << 1) | 1;
}
sx = sx + 1;
diff --git a/src/mame/video/ddrible.c b/src/mame/video/ddrible.c
index acc6588505b..42fe8391190 100644
--- a/src/mame/video/ddrible.c
+++ b/src/mame/video/ddrible.c
@@ -25,15 +25,37 @@ static tilemap *fg_tilemap,*bg_tilemap;
PALETTE_INIT( ddrible )
{
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, 0x40);
- /* build the lookup table for sprites. Palette is dynamic. */
- for (i = 0;i < TOTAL_COLORS(3);i++)
- COLOR(3,i) = (*(color_prom++) & 0x0f);
+ 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);
+ }
}
+
+static void set_pens(running_machine *machine)
+{
+ int i;
+
+ for (i = 0x00; i < 0x80; i += 2)
+ {
+ UINT16 data = paletteram[i | 1] | (paletteram[i] << 8);
+
+ rgb_t color = MAKE_RGB(pal5bit(data >> 0), pal5bit(data >> 5), pal5bit(data >> 10));
+
+ colortable_palette_set_color(machine->colortable, i >> 1, color);
+ }
+}
+
+
WRITE8_HANDLER( K005885_0_w )
{
switch (offset){
@@ -230,6 +252,8 @@ static void draw_sprites(running_machine* machine, mame_bitmap *bitmap, const re
VIDEO_UPDATE( ddrible )
{
+ set_pens(machine);
+
tilemap_set_flip(fg_tilemap, (ddribble_vregs[0][4] & 0x08) ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
tilemap_set_flip(bg_tilemap, (ddribble_vregs[1][4] & 0x08) ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
diff --git a/src/mame/video/irobot.c b/src/mame/video/irobot.c
index 9ae04452499..fb7b21025a4 100644
--- a/src/mame/video/irobot.c
+++ b/src/mame/video/irobot.c
@@ -73,9 +73,7 @@ PALETTE_INIT( irobot )
/* text */
for (i = 0;i < TOTAL_COLORS(0);i++)
- {
COLOR(0,i) = ((i & 0x18) | ((i & 0x01) << 2) | ((i & 0x06) >> 1)) + 64;
- }
}
@@ -93,7 +91,7 @@ WRITE8_HANDLER( irobot_paletteram_w )
g = 12 * bits * intensity;
bits = (color >> 7) & 0x03;
r = 12 * bits * intensity;
- palette_set_color(Machine,(offset >> 1) & 0x3F,MAKE_RGB(r,g,b));
+ palette_set_color(Machine,(offset >> 1) & 0x3f,MAKE_RGB(r,g,b));
}
@@ -372,20 +370,20 @@ VIDEO_UPDATE( irobot )
for (y = cliprect->min_y; y <= cliprect->max_y; y++)
draw_scanline8(bitmap, 0, y, BITMAP_WIDTH, &bitmap_base[y * BITMAP_WIDTH], machine->pens, -1);
- /* redraw the non-zero characters in the alpha layer */
+ /* redraw the 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);
+ int transp = color + 64;
+
+ drawgfx(bitmap,machine->gfx[0],
+ code, color,
+ 0,0,
+ 8*x,8*y,
+ cliprect,TRANSPARENCY_COLOR,transp);
+ }
+
return 0;
}