Color table removal

This commit is contained in:
Zsolt Vasvari 2008-02-04 12:42:11 +00:00
parent 190247c1fb
commit f32808362d
11 changed files with 181 additions and 264 deletions

View File

@ -201,7 +201,6 @@ static MACHINE_DRIVER_START( dambustr )
MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
MDRV_GFXDECODE(dambustr)
MDRV_PALETTE_LENGTH(32+2+64+8) /* 32 for the characters, 2 for the bullets, 64 for the stars, 8 for the background */
MDRV_COLORTABLE_LENGTH(8*4)
MDRV_PALETTE_INIT(dambustr)
MDRV_VIDEO_START(dambustr)

View File

@ -28,14 +28,12 @@ TODO:
#include "audio/t5182.h"
READ8_HANDLER(darkmist_palette_r);
WRITE8_HANDLER(darkmist_palette_w);
WRITE8_HANDLER(darkmist_spritebank_w);
VIDEO_START(darkmist);
VIDEO_UPDATE(darkmist);
PALETTE_INIT(darkmist);
UINT8 * darkmist_scroll;
extern UINT8 *darkmist_scroll;
extern UINT8 *darkmist_spritebank;
static UINT8 * darkmist_workram;
int darkmist_hw;
@ -66,11 +64,11 @@ static ADDRESS_MAP_START( memmap, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xc802, 0xc802) AM_READ(input_port_1_r)
AM_RANGE(0xc803, 0xc803) AM_READ(input_port_2_r)
AM_RANGE(0xc804, 0xc804) AM_WRITE(darkmist_hw_w)
AM_RANGE(0xc805, 0xc805) AM_WRITE(darkmist_spritebank_w)
AM_RANGE(0xc805, 0xc805) AM_WRITE(MWA8_RAM) AM_BASE(&darkmist_spritebank)
AM_RANGE(0xc806, 0xc806) AM_READ(input_port_3_r)
AM_RANGE(0xc807, 0xc807) AM_READ(input_port_4_r)
AM_RANGE(0xc808, 0xc808) AM_READ(input_port_5_r)
AM_RANGE(0xd000, 0xd3ff) AM_WRITE(darkmist_palette_w) AM_READ(darkmist_palette_r) AM_BASE(&paletteram)
AM_RANGE(0xd000, 0xd3ff) AM_RAM AM_BASE(&paletteram)
AM_RANGE(0xd400, 0xd41f) AM_RAM AM_BASE(&darkmist_scroll)
AM_RANGE(0xd600, 0xd67f) AM_READWRITE(t5182shared_r, t5182shared_w)
AM_RANGE(0xd680, 0xd680) AM_WRITE(t5182_sound_irq_w)
@ -266,9 +264,8 @@ static MACHINE_DRIVER_START( darkmist )
MDRV_SCREEN_SIZE(256, 256)
MDRV_SCREEN_VISIBLE_AREA(0, 256-1, 16, 256-16-1)
MDRV_GFXDECODE(darkmist)
MDRV_PALETTE_LENGTH(0x100+1)
MDRV_PALETTE_INIT(darkmist)
MDRV_COLORTABLE_LENGTH(0x100*4)
MDRV_PALETTE_LENGTH(0x100*4)
MDRV_VIDEO_START(darkmist)
MDRV_VIDEO_UPDATE(darkmist)

View File

@ -269,7 +269,6 @@ static MACHINE_DRIVER_START( dday )
MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 28*8-1)
MDRV_GFXDECODE(dday)
MDRV_PALETTE_LENGTH(256)
MDRV_COLORTABLE_LENGTH(256)//8*8+8*4+8*4,
MDRV_PALETTE_INIT(dday)
MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER | VIDEO_HAS_SHADOWS)

View File

@ -6649,7 +6649,6 @@ static MACHINE_DRIVER_START( quizchq )
MDRV_SCREEN_SIZE(336, 256)
MDRV_SCREEN_VISIBLE_AREA(0, 336-1, 5, 256-16+5-1)
MDRV_PALETTE_LENGTH(0x100)
MDRV_COLORTABLE_LENGTH(0x100)
MDRV_VIDEO_START(ddenlovr)
MDRV_VIDEO_EOF(ddenlovr)
@ -6725,7 +6724,6 @@ static MACHINE_DRIVER_START( mmpanic )
MDRV_SCREEN_SIZE(336, 256)
MDRV_SCREEN_VISIBLE_AREA(0, 336-1, 5, 256-16+5-1)
MDRV_PALETTE_LENGTH(0x100)
MDRV_COLORTABLE_LENGTH(0x100)
MDRV_VIDEO_START(mmpanic) // extra layers
MDRV_VIDEO_EOF(ddenlovr)

View File

@ -21,7 +21,6 @@ VIDEO_UPDATE( drmicro );
WRITE8_HANDLER( drmicro_flipscreen_w );
WRITE8_HANDLER( drmicro_priority_w );
READ8_HANDLER( drmicro_videoram_r );
WRITE8_HANDLER( drmicro_videoram_w );
extern void drmicro_flip_w( int flip );
@ -77,7 +76,7 @@ static WRITE8_HANDLER( pcm_set_w )
static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xbfff) AM_READ(MRA8_ROM)
AM_RANGE(0xc000, 0xdfff) AM_READ(MRA8_RAM)
AM_RANGE(0xe000, 0xefff) AM_READ(drmicro_videoram_r)
AM_RANGE(0xe000, 0xefff) AM_READ(MRA8_RAM)
AM_RANGE(0xf000, 0xffff) AM_READ(MRA8_RAM)
ADDRESS_MAP_END
@ -245,8 +244,7 @@ static MACHINE_DRIVER_START( drmicro )
MDRV_SCREEN_SIZE(32*8, 32*8)
MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
MDRV_GFXDECODE(drmicro)
MDRV_PALETTE_LENGTH(32)
MDRV_COLORTABLE_LENGTH(512)
MDRV_PALETTE_LENGTH(512)
MDRV_PALETTE_INIT(drmicro)
MDRV_VIDEO_START(drmicro)

View File

@ -244,7 +244,6 @@ static MACHINE_DRIVER_START( ettrivia )
MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 28*8-1)
MDRV_GFXDECODE(ettrivia)
MDRV_PALETTE_LENGTH(256)
MDRV_COLORTABLE_LENGTH(32*4+32*4)
MDRV_PALETTE_INIT(naughtyb)
MDRV_VIDEO_START(ettrivia)

View File

@ -393,7 +393,6 @@ static MACHINE_DRIVER_START( naughtyb )
MDRV_SCREEN_VISIBLE_AREA(0*8, 36*8-1, 0*8, 28*8-1)
MDRV_GFXDECODE(naughtyb)
MDRV_PALETTE_LENGTH(256)
MDRV_COLORTABLE_LENGTH(32*4+32*4)
MDRV_PALETTE_INIT(naughtyb)
MDRV_VIDEO_START(naughtyb)
@ -431,7 +430,6 @@ static MACHINE_DRIVER_START( popflame )
MDRV_SCREEN_VISIBLE_AREA(0*8, 36*8-1, 0*8, 28*8-1)
MDRV_GFXDECODE(naughtyb)
MDRV_PALETTE_LENGTH(256)
MDRV_COLORTABLE_LENGTH(32*4+32*4)
MDRV_PALETTE_INIT(naughtyb)
MDRV_VIDEO_START(naughtyb)

View File

@ -1,12 +1,11 @@
#include "driver.h"
#include "deprecat.h"
/*defined in drivers/darkmist.c */
extern UINT8 * darkmist_scroll;
extern int darkmist_hw;
static int spritebank;
UINT8 *darkmist_scroll;
UINT8 *darkmist_spritebank;
/* vis. flags */
@ -77,64 +76,49 @@ PALETTE_INIT(darkmist)
{
int i;
/* black color */
palette_set_color(machine, 0x100, MAKE_RGB(0,0,0));
/* allocate the colortable */
machine->colortable = colortable_alloc(machine, 0x101);
/* color lookup tables */
for (i = 0;i < 256;i++)
for (i = 0; i < 0x400; i++)
{
if (*color_prom & 0x40)
*(colortable++) = 0x100;
else
*(colortable++) = (*color_prom & 0x3f) + 0x80;
color_prom++;
}
int ctabentry;
for (i = 0;i < 256;i++)
{
if (*color_prom & 0x40)
*(colortable++) = 0x100;
if (color_prom[i] & 0x40)
ctabentry = 0x100;
else
*(colortable++) = (*color_prom & 0x3f) + 0x00;
color_prom++;
}
{
ctabentry = (color_prom[i] & 0x3f);
for (i = 0;i < 256;i++)
{
if (*color_prom & 0x40)
*(colortable++) = 0x100;
else
*(colortable++) = (*color_prom & 0x3f) + 0x40;
color_prom++;
}
switch (i & 0x300)
{
case 0x000: ctabentry = ctabentry | 0x80; break;
case 0x100: ctabentry = ctabentry | 0x00; break;
case 0x200: ctabentry = ctabentry | 0x40; break;
case 0x300: ctabentry = ctabentry | 0xc0; break;
}
}
for (i = 0;i < 256;i++)
{
if (*color_prom & 0x40)
*(colortable++) = 0x100;
else
*(colortable++) = (*color_prom & 0x3f) + 0xc0;
color_prom++;
colortable_entry_set_value(machine->colortable, i, ctabentry);
}
}
WRITE8_HANDLER(darkmist_palette_w)
static void set_pens(running_machine *machine)
{
paletteram[offset]=data;
offset&=0xff;
palette_set_color_rgb(Machine, offset, pal4bit(paletteram[offset+0x200]), pal4bit(paletteram[offset] >> 4), pal4bit(paletteram[offset]));
int i;
for (i = 0; i < 0x100; i++)
{
int r = pal4bit(paletteram[i | 0x200] >> 0);
int g = pal4bit(paletteram[i | 0x000] >> 4);
int b = pal4bit(paletteram[i | 0x000] >> 0);
colortable_palette_set_color(machine->colortable, i, MAKE_RGB(r, g, b));
}
colortable_palette_set_color(machine->colortable, 0x100, RGB_BLACK);
}
READ8_HANDLER(darkmist_palette_r)
{
return paletteram[offset];
}
WRITE8_HANDLER(darkmist_spritebank_w)
{
spritebank=data<<8;
}
VIDEO_START(darkmist)
{
@ -150,6 +134,8 @@ VIDEO_UPDATE( darkmist)
#define DM_GETSCROLL(n) (((darkmist_scroll[(n)]<<1)&0xff) + ((darkmist_scroll[(n)]&0x80)?1:0) +( ((darkmist_scroll[(n)-1]<<4) | (darkmist_scroll[(n)-1]<<12) )&0xff00))
set_pens(machine);
tilemap_set_scrollx(bgtilemap, 0, DM_GETSCROLL(0x2));
tilemap_set_scrolly(bgtilemap, 0, DM_GETSCROLL(0x6));
tilemap_set_scrollx(fgtilemap, 0, DM_GETSCROLL(0xa));
@ -158,15 +144,10 @@ VIDEO_UPDATE( darkmist)
fillbitmap(bitmap, get_black_pen(machine), cliprect);
if(darkmist_hw & DISPLAY_BG)
{
tilemap_draw(bitmap,cliprect,bgtilemap, 0,0);
}
if(darkmist_hw & DISPLAY_FG)
{
tilemap_draw(bitmap,cliprect,fgtilemap, 0,0);
}
if(darkmist_hw & DISPLAY_SPR)
{
@ -190,9 +171,7 @@ VIDEO_UPDATE( darkmist)
tile=spriteram[i+0];
if(spriteram[i+1]&0x20)
{
tile+=spritebank;
}
tile += (*darkmist_spritebank << 8);
palette=((spriteram[i+1])>>1)&0xf;
@ -222,5 +201,3 @@ VIDEO_UPDATE( darkmist)
return 0;
}

View File

@ -31,7 +31,7 @@ static int timer_value;
READ8_HANDLER( dday_countdown_timer_r )
{
return ((timer_value / 10) << 4) | (timer_value % 10);
return ((timer_value / 10) << 4) | (timer_value % 10);
}
static TIMER_CALLBACK( countdown_timer_callback )
@ -39,9 +39,7 @@ static TIMER_CALLBACK( countdown_timer_callback )
timer_value--;
if (timer_value < 0)
{
timer_value = 99;
}
}
static void start_countdown_timer(void)
@ -62,111 +60,97 @@ PALETTE_INIT( dday )
{
int i;
palette_set_shadow_factor(machine, 1.0 / 8);
palette_set_shadow_factor(machine, 1.0/8); /* this matches the previous version of the driver (>>3) */
/* allocate the colortable */
machine->colortable = colortable_alloc(machine, 0x100);
for (i = 0; i < machine->drv->total_colors; i++)
/* create a lookup table for the palette */
for (i = 0; i < 0x100; i++)
{
int bit0,bit1,bit2,bit3,r,g,b;
int r = pal4bit(color_prom[i + 0x000]);
int g = pal4bit(color_prom[i + 0x100]);
int b = pal4bit(color_prom[i + 0x200]);
/* red component */
bit0 = (color_prom[i] >> 0) & 0x01;
bit1 = (color_prom[i] >> 1) & 0x01;
bit2 = (color_prom[i] >> 2) & 0x01;
bit3 = (color_prom[i] >> 3) & 0x01;
r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
/* green component */
bit0 = (color_prom[i + machine->drv->total_colors] >> 0) & 0x01;
bit1 = (color_prom[i + machine->drv->total_colors] >> 1) & 0x01;
bit2 = (color_prom[i + machine->drv->total_colors] >> 2) & 0x01;
bit3 = (color_prom[i + machine->drv->total_colors] >> 3) & 0x01;
g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
/* blue component */
bit0 = (color_prom[i + 2*machine->drv->total_colors] >> 0) & 0x01;
bit1 = (color_prom[i + 2*machine->drv->total_colors] >> 1) & 0x01;
bit2 = (color_prom[i + 2*machine->drv->total_colors] >> 2) & 0x01;
bit3 = (color_prom[i + 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));
colortable_palette_set_color(machine->colortable, i, MAKE_RGB(r, g, b));
}
for (i = 0; i < 0x100; i++)
colortable_entry_set_value(machine->colortable, i, i);
/* HACK!!! This table is handgenerated, but it matches the screenshot.
I have no clue how it really works */
colortable_entry_set_value(machine->colortable, 0*8+0+0, 0x00);
colortable_entry_set_value(machine->colortable, 0*8+0+1, 0x01);
colortable_entry_set_value(machine->colortable, 0*8+0+2, 0x15);
colortable_entry_set_value(machine->colortable, 0*8+0+3, 0x02);
colortable_entry_set_value(machine->colortable, 0*8+4+0, 0x00);
colortable_entry_set_value(machine->colortable, 0*8+4+1, 0x01);
colortable_entry_set_value(machine->colortable, 0*8+4+2, 0x15);
colortable_entry_set_value(machine->colortable, 0*8+4+3, 0x02);
colortable[0*8+0] = 0;
colortable[0*8+1] = 1;
colortable[0*8+2] = 21;
colortable[0*8+3] = 2;
colortable[0*8+4+0] = 0;
colortable[0*8+4+1] = 1;
colortable[0*8+4+2] = 21;
colortable[0*8+4+3] = 2;
colortable_entry_set_value(machine->colortable, 1*8+0+0, 0x04);
colortable_entry_set_value(machine->colortable, 1*8+0+1, 0x05);
colortable_entry_set_value(machine->colortable, 1*8+0+2, 0x03);
colortable_entry_set_value(machine->colortable, 1*8+0+3, 0x07);
colortable_entry_set_value(machine->colortable, 1*8+4+0, 0x04);
colortable_entry_set_value(machine->colortable, 1*8+4+1, 0x05);
colortable_entry_set_value(machine->colortable, 1*8+4+2, 0x03);
colortable_entry_set_value(machine->colortable, 1*8+4+3, 0x07);
colortable[1*8+0] = 4;
colortable[1*8+1] = 5;
colortable[1*8+2] = 3;
colortable[1*8+3] = 7;
colortable[1*8+4+0] = 4;
colortable[1*8+4+1] = 5;
colortable[1*8+4+2] = 3;
colortable[1*8+4+3] = 7;
colortable_entry_set_value(machine->colortable, 2*8+0+0, 0x08);
colortable_entry_set_value(machine->colortable, 2*8+0+1, 0x15);
colortable_entry_set_value(machine->colortable, 2*8+0+2, 0x0a);
colortable_entry_set_value(machine->colortable, 2*8+0+3, 0x03);
colortable_entry_set_value(machine->colortable, 2*8+4+0, 0x08);
colortable_entry_set_value(machine->colortable, 2*8+4+1, 0x15);
colortable_entry_set_value(machine->colortable, 2*8+4+2, 0x0a);
colortable_entry_set_value(machine->colortable, 2*8+4+3, 0x03);
colortable[2*8+0] = 8;
colortable[2*8+1] = 21;
colortable[2*8+2] = 10;
colortable[2*8+3] = 3;
colortable[2*8+4+0] = 8;
colortable[2*8+4+1] = 21;
colortable[2*8+4+2] = 10;
colortable[2*8+4+3] = 3;
colortable_entry_set_value(machine->colortable, 3*8+0+0, 0x08);
colortable_entry_set_value(machine->colortable, 3*8+0+1, 0x15);
colortable_entry_set_value(machine->colortable, 3*8+0+2, 0x0a);
colortable_entry_set_value(machine->colortable, 3*8+0+3, 0x03);
colortable_entry_set_value(machine->colortable, 3*8+4+0, 0x08);
colortable_entry_set_value(machine->colortable, 3*8+4+1, 0x15);
colortable_entry_set_value(machine->colortable, 3*8+4+2, 0x0a);
colortable_entry_set_value(machine->colortable, 3*8+4+3, 0x03);
colortable[3*8+0] = 8;
colortable[3*8+1] = 21;
colortable[3*8+2] = 10;
colortable[3*8+3] = 3;
colortable[3*8+4+0] = 8;
colortable[3*8+4+1] = 21;
colortable[3*8+4+2] = 10;
colortable[3*8+4+3] = 3;
colortable_entry_set_value(machine->colortable, 4*8+0+0, 0x10);
colortable_entry_set_value(machine->colortable, 4*8+0+1, 0x11);
colortable_entry_set_value(machine->colortable, 4*8+0+2, 0x12);
colortable_entry_set_value(machine->colortable, 4*8+0+3, 0x07);
colortable_entry_set_value(machine->colortable, 4*8+4+0, 0x10);
colortable_entry_set_value(machine->colortable, 4*8+4+1, 0x11);
colortable_entry_set_value(machine->colortable, 4*8+4+2, 0x12);
colortable_entry_set_value(machine->colortable, 4*8+4+3, 0x07);
colortable[4*8+0] = 16;
colortable[4*8+1] = 17;
colortable[4*8+2] = 18;
colortable[4*8+3] = 7;
colortable[4*8+4+0] = 16;
colortable[4*8+4+1] = 17;
colortable[4*8+4+2] = 18;
colortable[4*8+4+3] = 7;
colortable_entry_set_value(machine->colortable, 5*8+0+0, 0x1d);
colortable_entry_set_value(machine->colortable, 5*8+0+1, 0x15);
colortable_entry_set_value(machine->colortable, 5*8+0+2, 0x16);
colortable_entry_set_value(machine->colortable, 5*8+0+3, 0x1b);
colortable_entry_set_value(machine->colortable, 5*8+4+0, 0x1d);
colortable_entry_set_value(machine->colortable, 5*8+4+1, 0x15);
colortable_entry_set_value(machine->colortable, 5*8+4+2, 0x16);
colortable_entry_set_value(machine->colortable, 5*8+4+3, 0x1b);
colortable[5*8+0] = 29;
colortable[5*8+1] = 21;
colortable[5*8+2] = 22;
colortable[5*8+3] = 27;
colortable[5*8+4+0] = 29;
colortable[5*8+4+1] = 21;
colortable[5*8+4+2] = 22;
colortable[5*8+4+3] = 27;
colortable_entry_set_value(machine->colortable, 6*8+0+0, 0x1d);
colortable_entry_set_value(machine->colortable, 6*8+0+1, 0x15);
colortable_entry_set_value(machine->colortable, 6*8+0+2, 0x1a);
colortable_entry_set_value(machine->colortable, 6*8+0+3, 0x1b);
colortable_entry_set_value(machine->colortable, 6*8+4+0, 0x1d);
colortable_entry_set_value(machine->colortable, 6*8+4+1, 0x15);
colortable_entry_set_value(machine->colortable, 6*8+4+2, 0x1a);
colortable_entry_set_value(machine->colortable, 6*8+4+3, 0x1b);
colortable[6*8+0] = 29;
colortable[6*8+1] = 21;
colortable[6*8+2] = 26;
colortable[6*8+3] = 27;
colortable[6*8+4+0] = 29;
colortable[6*8+4+1] = 21;
colortable[6*8+4+2] = 26;
colortable[6*8+4+3] = 27;
colortable[7*8+0] = 29;
colortable[7*8+1] = 2;
colortable[7*8+2] = 4;
colortable[7*8+3] = 27;
colortable[7*8+4+0] = 29;
colortable[7*8+4+1] = 2;
colortable[7*8+4+2] = 4;
colortable[7*8+4+3] = 27;
colortable_entry_set_value(machine->colortable, 7*8+0+0, 0x1d);
colortable_entry_set_value(machine->colortable, 7*8+0+1, 0x02);
colortable_entry_set_value(machine->colortable, 7*8+0+2, 0x04);
colortable_entry_set_value(machine->colortable, 7*8+0+3, 0x1b);
colortable_entry_set_value(machine->colortable, 7*8+4+0, 0x1d);
colortable_entry_set_value(machine->colortable, 7*8+4+1, 0x02);
colortable_entry_set_value(machine->colortable, 7*8+4+2, 0x04);
colortable_entry_set_value(machine->colortable, 7*8+4+3, 0x1b);
}
@ -216,14 +200,9 @@ static TILE_GET_INFO( get_sl_tile_info )
code = sl_map[flipx ? tile_index ^ 0x0f : tile_index];
if (sl_flipx != flipx)
{
if (code & 0x80)
{
/* no mirroring, draw dark spot */
code = 1;
}
}
if ((sl_flipx != flipx) && (code & 0x80))
/* no mirroring, draw dark spot */
code = 1;
SET_TILE_INFO(3, code & 0x3f, 0, flipx ? TILE_FLIPX : 0);
}
@ -280,20 +259,17 @@ WRITE8_HANDLER( dday_colorram_w )
{
int i;
offset &= 0x03e0;
dday_colorram[offset & 0x3e0] = data;
dday_colorram[offset & 0x3e0] = data;
for (i = 0; i < 0x20; i++)
{
for (i = 0; i < 0x20; i++)
tilemap_mark_tile_dirty(fg_tilemap, offset + i);
}
}
READ8_HANDLER( dday_colorram_r )
{
return dday_colorram[offset & 0x03e0];
return dday_colorram[offset & 0x03e0];
}

View File

@ -33,10 +33,6 @@ WRITE8_HANDLER( drmicro_videoram_w )
tilemap_mark_tile_dirty(drmicro_bg1,(offset & 0x3ff));
}
READ8_HANDLER( drmicro_videoram_r )
{
return drmicro_videoram[offset];
}
/****************************************************************************/
@ -74,29 +70,44 @@ PALETTE_INIT( drmicro )
{
int i;
for (i = 0;i < machine->drv->total_colors;i++)
{
int bit0,bit1,bit2,r,g,b;
/* allocate the colortable */
machine->colortable = colortable_alloc(machine, 0x20);
bit0 = (*color_prom >> 0) & 0x01;
bit1 = (*color_prom >> 1) & 0x01;
bit2 = (*color_prom >> 2) & 0x01;
/* create a lookup table for the palette */
for (i = 0; i < 0x20; i++)
{
int bit0, bit1, bit2;
int r, g, b;
/* red component */
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;
bit0 = (*color_prom >> 3) & 0x01;
bit1 = (*color_prom >> 4) & 0x01;
bit2 = (*color_prom >> 5) & 0x01;
/* green component */
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));
}
for (i=0; i<machine->drv->color_table_len; i++)
colortable[i] = color_prom[i] & 0x0f;
/* color_prom now points to the beginning of the lookup table */
color_prom += 0x20;
for (i = 0; i < 0x200; i++)
{
UINT8 ctabentry = color_prom[i] & 0x0f;
colortable_entry_set_value(machine->colortable, i, ctabentry);
}
}
VIDEO_START( drmicro)

View File

@ -67,75 +67,40 @@ static const rectangle rightvisiblearea =
***************************************************************************/
PALETTE_INIT( naughtyb )
{
int i;
#define COLOR(gfxn,offs) (colortable[machine->drv->gfxdecodeinfo[gfxn].color_codes_start + offs])
/* note: there is no resistor on second PROM so we define second resistance as 0 */
static const int resistances[2] = { 270, 0 };
double weights_r[2], weights_g[2], weights_b[2];
double rweights[2], gweights[2], bweights[2];
int i;
/* compute the color output resistor weights */
compute_resistor_weights(0, 255, -1.0,
2, resistances, rweights, 270, 270,
2, resistances, gweights, 270, 270,
2, resistances, bweights, 270, 270);
compute_resistor_weights(0, 255, -1.0,
2, resistances, weights_r, 270, 270,
2, resistances, weights_g, 270, 270,
2, resistances, weights_b, 270, 270);
for (i = 0;i < machine->drv->total_colors;i++)
for (i = 0; i < 0x100; i++)
{
int bit0,bit1,r,g,b;
int bit0, bit1;
int r, g, b;
int swapped_i;
/* red component */
bit0 = (color_prom[i | 0x000] >> 0) & 0x01;
bit1 = (color_prom[i | 0x100] >> 0) & 0x01;
r = combine_2_weights(rweights, bit0, bit1);
bit0 = (color_prom[0] >> 0) & 0x01;
bit1 = (color_prom[machine->drv->total_colors] >> 0) & 0x01;
/* green component */
bit0 = (color_prom[i | 0x000] >> 2) & 0x01;
bit1 = (color_prom[i | 0x100] >> 2) & 0x01;
g = combine_2_weights(gweights, bit0, bit1);
/*r = 0x55 * bit0 + 0xaa * bit1;*/
r = combine_2_weights(weights_r, bit0, bit1);
/* blue component */
bit0 = (color_prom[i | 0x000] >> 1) & 0x01;
bit1 = (color_prom[i | 0x100] >> 1) & 0x01;
b = combine_2_weights(bweights, bit0, bit1);
bit0 = (color_prom[0] >> 2) & 0x01;
bit1 = (color_prom[machine->drv->total_colors] >> 2) & 0x01;
/*g = 0x55 * bit0 + 0xaa * bit1;*/
g = combine_2_weights(weights_g, bit0, bit1);
bit0 = (color_prom[0] >> 1) & 0x01;
bit1 = (color_prom[machine->drv->total_colors] >> 1) & 0x01;
/*b = 0x55 * bit0 + 0xaa * bit1;*/
b = combine_2_weights(weights_b, bit0, bit1);
palette_set_color(machine,i,MAKE_RGB(r,g,b));
color_prom++;
}
/* first bank of characters use colors 0-31, 64-95, 128-159 and 192-223 */
for (i = 0;i < 8;i++)
{
int j;
for (j = 0;j < 4;j++)
{
COLOR(0,4*i + j*4*8) = i + j*64;
COLOR(0,4*i + j*4*8 + 1) = 8 + i + j*64;
COLOR(0,4*i + j*4*8 + 2) = 2*8 + i + j*64;
COLOR(0,4*i + j*4*8 + 3) = 3*8 + i + j*64;
}
}
/* second bank of characters use colors 32-63, 96-127, 160-191 and 224-255 */
for (i = 0;i < 8;i++)
{
int j;
for (j = 0;j < 4;j++)
{
COLOR(1,4*i + j*4*8) = i + 32 + j*64;
COLOR(1,4*i + j*4*8 + 1) = 8 + i + 32 + j*64;
COLOR(1,4*i + j*4*8 + 2) = 2*8 + i + 32 + j*64;
COLOR(1,4*i + j*4*8 + 3) = 3*8 + i + 32 + j*64;
}
swapped_i = BITSWAP8(i,5,7,6,2,1,0,4,3);
palette_set_color(machine, swapped_i, MAKE_RGB(r, g, b));
}
}