Color table removal -- done

This commit is contained in:
Zsolt Vasvari 2008-02-19 04:01:17 +00:00
parent 6e1e95866d
commit a8fae84505
20 changed files with 342 additions and 359 deletions

View File

@ -282,9 +282,9 @@ static const gfx_layout obj_layout =
static GFXDECODE_START( tunhunt )
GFXDECODE_ENTRY( REGION_GFX1, 0x000, alpha_layout, 0, 4 )
GFXDECODE_ENTRY( REGION_GFX2, 0x200, obj_layout, 8, 1 )
GFXDECODE_ENTRY( REGION_GFX2, 0x000, obj_layout, 8, 1 ) /* second bank, or second bitplane? */
GFXDECODE_ENTRY( REGION_GFX1, 0x000, alpha_layout, 0x10, 4 )
GFXDECODE_ENTRY( REGION_GFX2, 0x200, obj_layout, 0x18, 1 )
GFXDECODE_ENTRY( REGION_GFX2, 0x000, obj_layout, 0x18, 1 ) /* second bank, or second bitplane? */
GFXDECODE_END
@ -330,8 +330,7 @@ static MACHINE_DRIVER_START( tunhunt )
MDRV_SCREEN_SIZE(256, 256-16)
MDRV_SCREEN_VISIBLE_AREA(0, 255, 0, 255-16)
MDRV_GFXDECODE(tunhunt)
MDRV_PALETTE_LENGTH(16)
MDRV_COLORTABLE_LENGTH(16)
MDRV_PALETTE_LENGTH(0x1a)
MDRV_PALETTE_INIT(tunhunt)
MDRV_VIDEO_START(tunhunt)

View File

@ -713,8 +713,7 @@ static MACHINE_DRIVER_START( tx1 )
MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
MDRV_GFXDECODE(tx1)
MDRV_PALETTE_LENGTH(256)
MDRV_COLORTABLE_LENGTH(256+(256*4)+(2048*4))
MDRV_PALETTE_LENGTH(256+(256*4)+(2048*4))
MDRV_PALETTE_INIT(tx1)
MDRV_VIDEO_EOF(tx1)
@ -784,8 +783,7 @@ static MACHINE_DRIVER_START( buggyboy )
MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
MDRV_SCREEN_RAW_PARAMS(BB_PIXEL_CLOCK, BB_HTOTAL, BB_HBEND, BB_HBSTART, BB_VTOTAL, BB_VBEND, BB_VBSTART)
MDRV_PALETTE_LENGTH(256)
MDRV_COLORTABLE_LENGTH(256+(256*4)+(2048*4))
MDRV_PALETTE_LENGTH(256+(256*4)+(2048*4))
MDRV_PALETTE_INIT(buggyboy)
MDRV_VIDEO_START(buggyboy)
MDRV_VIDEO_UPDATE(buggyboy)
@ -836,10 +834,8 @@ static MACHINE_DRIVER_START( buggybjr )
MDRV_SCREEN_SIZE(256, 256)
MDRV_SCREEN_VISIBLE_AREA(0, 255, 0, 239)
#endif
MDRV_GFXDECODE(buggyboy)
MDRV_PALETTE_LENGTH(256)
MDRV_COLORTABLE_LENGTH(256)
MDRV_PALETTE_INIT(buggyboy)
MDRV_PALETTE_LENGTH(512)
MDRV_PALETTE_INIT(buggybjr)
MDRV_VIDEO_START(buggybjr)
MDRV_VIDEO_UPDATE(buggybjr)
MDRV_VIDEO_EOF(buggyboy)

View File

@ -305,8 +305,7 @@ static MACHINE_DRIVER_START( ultratnk )
MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
MDRV_SCREEN_RAW_PARAMS(PIXEL_CLOCK, HTOTAL, 0, 256, VTOTAL, 0, 224)
MDRV_GFXDECODE(ultratnk)
MDRV_PALETTE_LENGTH(4)
MDRV_COLORTABLE_LENGTH(10)
MDRV_PALETTE_LENGTH(10)
MDRV_PALETTE_INIT(ultratnk)
MDRV_VIDEO_START(ultratnk)

View File

@ -304,8 +304,7 @@ static MACHINE_DRIVER_START( usg32 )
MDRV_SCREEN_SIZE(64*8, 32*8)
MDRV_SCREEN_VISIBLE_AREA(7*8, 57*8-1, 0*8, 31*8-1)
MDRV_GFXDECODE(usgames)
MDRV_PALETTE_LENGTH(16)
MDRV_COLORTABLE_LENGTH(2*256)
MDRV_PALETTE_LENGTH(2*256)
MDRV_PALETTE_INIT(usgames)
MDRV_VIDEO_START(usgames)

View File

@ -129,7 +129,7 @@ TODO:
#include "driver.h"
#include "deprecat.h"
#include "sound/custom.h"
#include "includes/warpwarp.h"
#include "warpwarp.h"
#include "geebee.lh"
#include "sos.lh"
@ -848,8 +848,7 @@ static MACHINE_DRIVER_START( geebee )
MDRV_SCREEN_SIZE(34*8, 28*8)
MDRV_SCREEN_VISIBLE_AREA(0*8, 34*8-1, 0*8, 28*8-1)
MDRV_GFXDECODE(1k)
MDRV_PALETTE_LENGTH(3)
MDRV_COLORTABLE_LENGTH(4*2)
MDRV_PALETTE_LENGTH(4*2)
MDRV_PALETTE_INIT(geebee)
MDRV_VIDEO_START(geebee)
@ -869,10 +868,11 @@ static MACHINE_DRIVER_START( navarone )
MDRV_IMPORT_FROM(geebee)
MDRV_GFXDECODE(2k)
MDRV_COLORTABLE_LENGTH(2*2)
MDRV_PALETTE_LENGTH(2*2+1)
MDRV_PALETTE_INIT(navarone)
MDRV_VIDEO_START(navarone)
MDRV_VIDEO_UPDATE(navarone)
MACHINE_DRIVER_END
static MACHINE_DRIVER_START( bombbee )
@ -891,8 +891,7 @@ static MACHINE_DRIVER_START( bombbee )
MDRV_SCREEN_SIZE(34*8, 28*8)
MDRV_SCREEN_VISIBLE_AREA(0*8, 34*8-1, 0*8, 28*8-1)
MDRV_GFXDECODE(color)
MDRV_PALETTE_LENGTH(256)
MDRV_COLORTABLE_LENGTH(2*256)
MDRV_PALETTE_LENGTH(2*256+1)
MDRV_PALETTE_INIT(warpwarp)
MDRV_VIDEO_START(warpwarp)

View File

@ -16,22 +16,23 @@ extern int wolfpack_collision;
extern UINT8* wolfpack_alpha_num_ram;
extern VIDEO_UPDATE( wolfpack );
extern VIDEO_START( wolfpack );
extern VIDEO_EOF( wolfpack );
PALETTE_INIT( wolfpack );
VIDEO_UPDATE( wolfpack );
VIDEO_START( wolfpack );
VIDEO_EOF( wolfpack );
extern WRITE8_HANDLER( wolfpack_video_invert_w );
extern WRITE8_HANDLER( wolfpack_ship_reflect_w );
extern WRITE8_HANDLER( wolfpack_pt_pos_select_w );
extern WRITE8_HANDLER( wolfpack_pt_horz_w );
extern WRITE8_HANDLER( wolfpack_pt_pic_w );
extern WRITE8_HANDLER( wolfpack_ship_h_w );
extern WRITE8_HANDLER( wolfpack_torpedo_pic_w );
extern WRITE8_HANDLER( wolfpack_ship_size_w );
extern WRITE8_HANDLER( wolfpack_ship_h_precess_w );
extern WRITE8_HANDLER( wolfpack_ship_pic_w );
extern WRITE8_HANDLER( wolfpack_torpedo_h_w );
extern WRITE8_HANDLER( wolfpack_torpedo_v_w );
WRITE8_HANDLER( wolfpack_video_invert_w );
WRITE8_HANDLER( wolfpack_ship_reflect_w );
WRITE8_HANDLER( wolfpack_pt_pos_select_w );
WRITE8_HANDLER( wolfpack_pt_horz_w );
WRITE8_HANDLER( wolfpack_pt_pic_w );
WRITE8_HANDLER( wolfpack_ship_h_w );
WRITE8_HANDLER( wolfpack_torpedo_pic_w );
WRITE8_HANDLER( wolfpack_ship_size_w );
WRITE8_HANDLER( wolfpack_ship_h_precess_w );
WRITE8_HANDLER( wolfpack_ship_pic_w );
WRITE8_HANDLER( wolfpack_torpedo_h_w );
WRITE8_HANDLER( wolfpack_torpedo_v_w );
static TIMER_CALLBACK( periodic_callback )
@ -57,36 +58,6 @@ static MACHINE_RESET( wolfpack )
}
static PALETTE_INIT( wolfpack )
{
int i;
palette_set_color(machine, 0, MAKE_RGB(0x00, 0x00, 0x00));
palette_set_color(machine, 1, MAKE_RGB(0xc1, 0xc1, 0xc1));
palette_set_color(machine, 2, MAKE_RGB(0x81, 0x81, 0x81));
palette_set_color(machine, 3, MAKE_RGB(0x48, 0x48, 0x48));
for (i = 0; i < 4; i++)
{
rgb_t color = palette_get_color(machine, i);
palette_set_color_rgb(machine, 4 + i,
RGB_RED(color) < 0xb8 ? RGB_RED(color) + 0x48 : 0xff,
RGB_GREEN(color) < 0xb8 ? RGB_GREEN(color) + 0x48 : 0xff,
RGB_BLUE(color) < 0xb8 ? RGB_BLUE(color) + 0x48 : 0xff);
}
colortable[0] = 0;
colortable[1] = 1;
colortable[2] = 1;
colortable[3] = 0;
colortable[4] = 0;
colortable[5] = 2;
colortable[6] = 0;
colortable[7] = 3;
}
static READ8_HANDLER( wolfpack_input_r )
{
UINT8 val = readinputport(0);
@ -378,8 +349,7 @@ static MACHINE_DRIVER_START(wolfpack)
MDRV_SCREEN_SIZE(512, 262)
MDRV_SCREEN_VISIBLE_AREA(0, 511, 16, 239)
MDRV_GFXDECODE(wolfpack)
MDRV_PALETTE_LENGTH(8)
MDRV_COLORTABLE_LENGTH(8)
MDRV_PALETTE_LENGTH(12)
MDRV_PALETTE_INIT(wolfpack)
MDRV_VIDEO_START(wolfpack)
MDRV_VIDEO_UPDATE(wolfpack)

View File

@ -683,8 +683,7 @@ static MACHINE_DRIVER_START( zaccaria )
MDRV_SCREEN_SIZE(32*8, 32*8)
MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
MDRV_GFXDECODE(zaccaria)
MDRV_PALETTE_LENGTH(512)
MDRV_COLORTABLE_LENGTH(32*8+32*8)
MDRV_PALETTE_LENGTH(32*8+32*8)
MDRV_PALETTE_INIT(zaccaria)
MDRV_VIDEO_START(zaccaria)

View File

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

View File

@ -91,6 +91,7 @@ extern UINT16 *buggyboy_rcram;
extern UINT16 *buggyboy_vram;
extern size_t buggyboy_objram_size;
extern size_t buggyboy_rcram_size;
PALETTE_INIT( buggybjr );
PALETTE_INIT( buggyboy );
WRITE16_HANDLER( buggyboy_vram_w );
VIDEO_START( buggyboy );

View File

@ -16,6 +16,7 @@ VIDEO_START( geebee );
VIDEO_START( navarone );
VIDEO_START( warpwarp );
VIDEO_UPDATE( geebee );
VIDEO_UPDATE( navarone );
VIDEO_UPDATE( warpwarp );
WRITE8_HANDLER( warpwarp_videoram_w );
WRITE8_HANDLER( geebee_videoram_w );

View File

@ -1,8 +1,5 @@
#include "driver.h"
#define TOTAL_COLORS(gfxn) (machine->gfx[gfxn]->total_colors * machine->gfx[gfxn]->color_granularity)
#define COLOR(gfxn,offs) (colortable[machine->config->gfxdecodeinfo[gfxn].color_codes_start + offs])
UINT8 *gunsmoke_scrollx;
UINT8 *gunsmoke_scrolly;

View File

@ -49,8 +49,6 @@ static int flipscreen;
PALETTE_INIT( mrdo )
{
int i;
#define TOTAL_COLORS(gfxn) (machine->gfx[gfxn]->total_colors * machine->gfx[gfxn]->color_granularity)
#define COLOR(gfxn,offs) (colortable[machine->config->gfxdecodeinfo[gfxn].color_codes_start + offs])
const int R1 = 150;
const int R2 = 120;

View File

@ -74,8 +74,7 @@ VIDEO_START( tunhunt )
*/
tmpbitmap = auto_bitmap_alloc( 256, 64, machine->screen[0].format );
fg_tilemap = tilemap_create(get_fg_tile_info, tilemap_scan_cols,
8, 8, 32, 32);
fg_tilemap = tilemap_create(get_fg_tile_info, tilemap_scan_cols, 8, 8, 32, 32);
tilemap_set_transparent_pen(fg_tilemap, 0);
tilemap_set_scrollx(fg_tilemap, 0, 64);
@ -83,11 +82,20 @@ VIDEO_START( tunhunt )
PALETTE_INIT( tunhunt )
{
int i;
/* Tunnel Hunt uses a combination of color proms and palette RAM to specify a 16 color
* palette. Here, we manage only the mappings for alphanumeric characters and SHELL
* graphics, which are unpacked ahead of time and drawn using MAME's drawgfx primitives.
*/
/* allocate the colortable */
machine->colortable = colortable_alloc(machine, 0x10);
/* motion objects/box */
for (i = 0; i < 0x10; i++)
colortable_entry_set_value(machine->colortable, i, i);
/* AlphaNumerics (1bpp)
* 2 bits of hilite select from 4 different background colors
* Foreground color is always pen#4
@ -95,28 +103,26 @@ PALETTE_INIT( tunhunt )
*/
/* alpha hilite#0 */
colortable[0] = 0x0; /* background color#0 (transparent) */
colortable[1] = 0x4; /* foreground color */
colortable_entry_set_value(machine->colortable, 0x10, 0x0); /* background color#0 (transparent) */
colortable_entry_set_value(machine->colortable, 0x11, 0x4); /* foreground color */
/* alpha hilite#1 */
colortable[2] = 0x5; /* background color#1 */
colortable[3] = 0x4; /* foreground color */
colortable_entry_set_value(machine->colortable, 0x12, 0x5); /* background color#1 */
colortable_entry_set_value(machine->colortable, 0x13, 0x4); /* foreground color */
/* alpha hilite#2 */
colortable[4] = 0x6; /* background color#2 */
colortable[5] = 0x4; /* foreground color */
colortable_entry_set_value(machine->colortable, 0x14, 0x6); /* background color#2 */
colortable_entry_set_value(machine->colortable, 0x15, 0x4); /* foreground color */
/* alpha hilite#3 */
colortable[6] = 0xf; /* background color#3 */
colortable[7] = 0x4; /* foreground color */
colortable_entry_set_value(machine->colortable, 0x16, 0xf); /* background color#3 */
colortable_entry_set_value(machine->colortable, 0x17, 0x4); /* foreground color */
/* shell graphics; these are either 1bpp (2 banks) or 2bpp. It isn't clear which.
* In any event, the following pens are associated with the shell graphics:
*/
colortable[0x8] = 0;
colortable[0x9] = 4;//1;
colortable[0xa] = 2;
colortable[0xb] = 4;
colortable_entry_set_value(machine->colortable, 0x18, 0);
colortable_entry_set_value(machine->colortable, 0x19, 4);//1;
}
/*
@ -132,7 +138,7 @@ Color Array Ram Assignments:
8-E Lines (as normal) background
F Hilight 3
*/
static void update_palette(running_machine *machine)
static void set_pens(colortable_t *colortable)
{
// const UINT8 *color_prom = memory_region( REGION_PROMS );
/*
@ -186,7 +192,7 @@ static void update_palette(running_machine *machine)
green = APPLY_SHADE(green,shade);
blue = APPLY_SHADE(blue,shade);
palette_set_color( machine,i,MAKE_RGB(red,green,blue) );
colortable_palette_set_color( colortable,i,MAKE_RGB(red,green,blue) );
}
}
@ -365,7 +371,7 @@ static void draw_shell(running_machine *machine,
VIDEO_UPDATE( tunhunt )
{
update_palette(machine);
set_pens(machine->colortable);
draw_box(machine, bitmap, cliprect);

View File

@ -123,36 +123,27 @@ PALETTE_INIT( tx1 )
{
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++)
{
int bit0, bit1, bit2, bit3;
int r, g, b;
int r = pal4bit(color_prom[i + 0x000]);
int g = pal4bit(color_prom[i + 0x100]);
int b = pal4bit(color_prom[i + 0x200]);
bit0 = BIT(color_prom[i], 0);
bit1 = BIT(color_prom[i], 1);
bit2 = BIT(color_prom[i], 2);
bit3 = BIT(color_prom[i], 3);
r = 0x0d * bit0 + 0x1e * bit1 + 0x41 * bit2 + 0x8a * bit3;
bit0 = BIT(color_prom[i + 0x100], 0);
bit1 = BIT(color_prom[i + 0x100], 1);
bit2 = BIT(color_prom[i + 0x100], 2);
bit3 = BIT(color_prom[i + 0x100], 3);
g = 0x0d * bit0 + 0x1e * bit1 + 0x41 * bit2 + 0x8a * bit3;
bit0 = BIT(color_prom[i + 0x200], 0);
bit1 = BIT(color_prom[i + 0x200], 1);
bit2 = BIT(color_prom[i + 0x200], 2);
bit3 = BIT(color_prom[i + 0x200], 3);
b = 0x0d * bit0 + 0x1e * bit1 + 0x41 * bit2 + 0x8a * bit3;
palette_set_color(machine, i, MAKE_RGB(r, g, b));
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 += 0x300;
/* TODO */
for (i = 0; i < 256; ++i)
for (i = 0; i < 0x100; i++)
{
colortable[i] = (color_prom[i + 0x900] & 0xf) + 0x00;
UINT8 ctabentry = (color_prom[i + 0x600] & 0x0f) | 0x00;
colortable_entry_set_value(machine->colortable, i, ctabentry);
}
}
@ -451,7 +442,7 @@ static void tx1_draw_objects(mame_bitmap *bitmap, const rectangle *cliprect)
else
color = ~ic162[prom_addr] & 0x3f;
*BITMAP_ADDR16(bitmap, y, x) = Machine->pens[TX1_COLORS_OBJ + color];
*BITMAP_ADDR16(bitmap, y, x) = TX1_COLORS_OBJ + color;
}
}
@ -590,19 +581,19 @@ static UINT8 *rod_bmp;
bit 2 -- 4.7kohm resistor -- RED
***************************************************************************/
PALETTE_INIT( buggyboy )
PALETTE_INIT( buggybjr )
{
int i;
for (i = 0; i < 256; ++i)
for (i = 0; i < 0x100; i++)
{
int bit0, bit1, bit2, bit3, bit4;
int r, g, b;
bit0 = BIT(color_prom[i], 0);
bit1 = BIT(color_prom[i], 1);
bit2 = BIT(color_prom[i], 2);
bit3 = BIT(color_prom[i], 3);
bit0 = BIT(color_prom[i + 0x000], 0);
bit1 = BIT(color_prom[i + 0x000], 1);
bit2 = BIT(color_prom[i + 0x000], 2);
bit3 = BIT(color_prom[i + 0x000], 3);
bit4 = BIT(color_prom[i + 0x300], 2);
r = 0x06 * bit4 + 0x0d * bit0 + 0x1e * bit1 + 0x41 * bit2 + 0x8a * bit3;
@ -620,13 +611,55 @@ PALETTE_INIT( buggyboy )
bit4 = BIT(color_prom[i + 0x300], 0);
b = 0x06 * bit4 + 0x0d * bit0 + 0x1e * bit1 + 0x41 * bit2 + 0x8a * bit3;
palette_set_color(machine, i, MAKE_RGB(r,g,b));
palette_set_color(machine, i, MAKE_RGB(r, g, b));
}
}
PALETTE_INIT( buggyboy )
{
int 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, bit4;
int r, g, b;
bit0 = BIT(color_prom[i + 0x000], 0);
bit1 = BIT(color_prom[i + 0x000], 1);
bit2 = BIT(color_prom[i + 0x000], 2);
bit3 = BIT(color_prom[i + 0x000], 3);
bit4 = BIT(color_prom[i + 0x300], 2);
r = 0x06 * bit4 + 0x0d * bit0 + 0x1e * bit1 + 0x41 * bit2 + 0x8a * bit3;
bit0 = BIT(color_prom[i + 0x100], 0);
bit1 = BIT(color_prom[i + 0x100], 1);
bit2 = BIT(color_prom[i + 0x100], 2);
bit3 = BIT(color_prom[i + 0x100], 3);
bit4 = BIT(color_prom[i + 0x300], 1);
g = 0x06 * bit4 + 0x0d * bit0 + 0x1e * bit1 + 0x41 * bit2 + 0x8a * bit3;
bit0 = BIT(color_prom[i + 0x200], 0);
bit1 = BIT(color_prom[i + 0x200], 1);
bit2 = BIT(color_prom[i + 0x200], 2);
bit3 = BIT(color_prom[i + 0x200], 3);
bit4 = BIT(color_prom[i + 0x300], 0);
b = 0x06 * bit4 + 0x0d * bit0 + 0x1e * bit1 + 0x41 * bit2 + 0x8a * bit3;
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 += 0x400;
/* Characters use colours 192-255 */
for (i = 0; i < 256; ++i)
for (i = 0; i < 0x100; i++)
{
colortable[i] = 192 + color_prom[i + 0x400] + ((i & 0xc0) >> 2);
UINT8 ctabentry = 0xc0 | (((i & 0xc0) >> 2)) | (color_prom[i] & 0x0f);
colortable_entry_set_value(machine->colortable, i, ctabentry);
}
}

View File

@ -17,22 +17,25 @@ int ultratnk_collision[4];
PALETTE_INIT( ultratnk )
{
palette_set_color(machine, 0, MAKE_RGB(0x00, 0x00, 0x00));
palette_set_color(machine, 1, MAKE_RGB(0xa4, 0xa4, 0xa4));
palette_set_color(machine, 2, MAKE_RGB(0x5b, 0x5b, 0x5b));
palette_set_color(machine, 3, MAKE_RGB(0xff, 0xff, 0xff));
/* allocate the colortable */
machine->colortable = colortable_alloc(machine, 4);
colortable[0] = color_prom[0x00] & 3;
colortable[2] = color_prom[0x00] & 3;
colortable[4] = color_prom[0x00] & 3;
colortable[6] = color_prom[0x00] & 3;
colortable[8] = color_prom[0x00] & 3;
colortable_palette_set_color(machine->colortable, 0, MAKE_RGB(0x00, 0x00, 0x00));
colortable_palette_set_color(machine->colortable, 1, MAKE_RGB(0xa4, 0xa4, 0xa4));
colortable_palette_set_color(machine->colortable, 2, MAKE_RGB(0x5b, 0x5b, 0x5b));
colortable_palette_set_color(machine->colortable, 3, MAKE_RGB(0xff, 0xff, 0xff));
colortable[1] = color_prom[0x01] & 3;
colortable[3] = color_prom[0x02] & 3;
colortable[5] = color_prom[0x04] & 3;
colortable[7] = color_prom[0x08] & 3;
colortable[9] = color_prom[0x10] & 3;
colortable_entry_set_value(machine->colortable, 0, color_prom[0x00] & 3);
colortable_entry_set_value(machine->colortable, 2, color_prom[0x00] & 3);
colortable_entry_set_value(machine->colortable, 4, color_prom[0x00] & 3);
colortable_entry_set_value(machine->colortable, 6, color_prom[0x00] & 3);
colortable_entry_set_value(machine->colortable, 8, color_prom[0x00] & 3);
colortable_entry_set_value(machine->colortable, 1, color_prom[0x01] & 3);
colortable_entry_set_value(machine->colortable, 3, color_prom[0x02] & 3);
colortable_entry_set_value(machine->colortable, 5, color_prom[0x04] & 3);
colortable_entry_set_value(machine->colortable, 7, color_prom[0x08] & 3);
colortable_entry_set_value(machine->colortable, 9, color_prom[0x10] & 3);
}
@ -41,13 +44,9 @@ static TILE_GET_INFO( ultratnk_tile_info )
UINT8 code = videoram[tile_index];
if (code & 0x20)
{
SET_TILE_INFO(0, code, code >> 6, 0);
}
else
{
SET_TILE_INFO(0, code, 4, 0);
}
}
@ -75,9 +74,7 @@ VIDEO_UPDATE( ultratnk )
UINT8 code = videoram[0x398 + 2 * i + 1];
if (code & 4)
{
bank = 32;
}
if (!(attr & 0x80))
{
@ -97,9 +94,8 @@ VIDEO_UPDATE( ultratnk )
VIDEO_EOF( ultratnk )
{
UINT16 BG = machine->remapped_colortable[machine->gfx[0]->color_base];
int i;
UINT16 BG = colortable_entry_get_value(machine->colortable, 0);
/* check for sprite-playfield collisions */
@ -126,9 +122,7 @@ VIDEO_EOF( ultratnk )
tilemap_draw(helper, &rect, playfield, 0, 0);
if (code & 4)
{
bank = 32;
}
drawgfx(helper, machine->gfx[1],
(code >> 3) | bank,
@ -139,15 +133,9 @@ VIDEO_EOF( ultratnk )
&rect, TRANSPARENCY_PEN, 1);
for (y = rect.min_y; y <= rect.max_y; y++)
{
for (x = rect.min_x; x <= rect.max_x; x++)
{
if (*BITMAP_ADDR16(helper, y, x) != BG)
{
if (colortable_entry_get_value(machine->colortable, *BITMAP_ADDR16(helper, y, x)) != BG)
ultratnk_collision[i] = 1;
}
}
}
}
/* update sound status */

View File

@ -14,24 +14,26 @@ PALETTE_INIT(usgames)
{
int j;
for (j = 0;j < 16;j++)
for (j = 0; j < 0x200; j++)
{
int r = (j & 1) >> 0;
int g = (j & 2) >> 1;
int b = (j & 4) >> 2;
int i = (j & 8) >> 3;
int data;
int r, g, b, i;
if (j & 0x01)
data = (j >> 5) & 0x0f;
else
data = (j >> 1) & 0x0f;
r = (data & 1) >> 0;
g = (data & 2) >> 1;
b = (data & 4) >> 2;
i = (data & 8) >> 3;
r = 0xff * r;
g = 0x7f * g * (i + 1);
b = 0x7f * b * (i + 1);
palette_set_color(machine,j,MAKE_RGB(r,g,b));
}
for (j = 0;j < 256;j++)
{
colortable[2*j] = j & 0x0f;
colortable[2*j+1] = j >> 4;
palette_set_color(machine,j,MAKE_RGB(r, g, b));
}
}

View File

@ -7,7 +7,8 @@
***************************************************************************/
#include "driver.h"
#include "includes/warpwarp.h"
#include "video/resnet.h"
#include "warpwarp.h"
UINT8 *geebee_videoram,*warpwarp_videoram;
@ -27,37 +28,25 @@ static const rgb_t geebee_palette[] =
MAKE_RGB(0x7f,0x7f,0x7f) /* grey */
};
static const UINT16 geebee_colortable[] =
{
0, 1,
1, 0,
0, 2,
2, 0
};
static const UINT16 navarone_colortable[] =
{
0, 2,
2, 0,
};
/* Initialise the palette */
PALETTE_INIT( geebee )
{
int i;
for (i = 0; i < sizeof(geebee_palette)/sizeof(geebee_palette[0]); i++)
palette_set_color(machine,i,geebee_palette[i]);
memcpy(colortable, geebee_colortable, sizeof (geebee_colortable));
palette_set_color(machine, 0, geebee_palette[0]);
palette_set_color(machine, 1, geebee_palette[1]);
palette_set_color(machine, 2, geebee_palette[1]);
palette_set_color(machine, 3, geebee_palette[0]);
palette_set_color(machine, 4, geebee_palette[0]);
palette_set_color(machine, 5, geebee_palette[2]);
palette_set_color(machine, 6, geebee_palette[2]);
palette_set_color(machine, 7, geebee_palette[0]);
}
/* Initialise the palette */
PALETTE_INIT( navarone )
{
int i;
for (i = 0; i < sizeof(geebee_palette)/sizeof(geebee_palette[0]); i++)
palette_set_color(machine,i,geebee_palette[i]);
memcpy(colortable, navarone_colortable, sizeof (navarone_colortable));
palette_set_color(machine, 0, geebee_palette[0]);
palette_set_color(machine, 1, geebee_palette[2]);
palette_set_color(machine, 2, geebee_palette[2]);
palette_set_color(machine, 3, geebee_palette[0]);
palette_set_color(machine, 4, geebee_palette[1]);
}
@ -66,15 +55,14 @@ PALETTE_INIT( navarone )
Warp Warp doesn't use PROMs - the 8-bit code is directly converted into a
color.
The color RAM is connected to the RGB output this way (I think - schematics
are fuzzy):
The color RAM is connected to the RGB output this way:
bit 7 -- 300 ohm resistor -- BLUE
bit 7 -- 390 ohm resistor -- BLUE
-- 820 ohm resistor -- BLUE
-- 300 ohm resistor -- GREEN
-- 390 ohm resistor -- GREEN
-- 820 ohm resistor -- GREEN
-- 1.6kohm resistor -- GREEN
-- 300 ohm resistor -- RED
-- 390 ohm resistor -- RED
-- 820 ohm resistor -- RED
bit 0 -- 1.6kohm resistor -- RED
@ -85,36 +73,44 @@ PALETTE_INIT( navarone )
PALETTE_INIT( warpwarp )
{
int i;
static const int resistances_tiles_rg[] = { 1600, 820, 390 };
static const int resistances_tiles_b[] = { 820, 390 };
static const int resistance_ball[] = { 220 };
for (i = 0;i < machine->config->total_colors;i++)
double weights_tiles_rg[3], weights_tiles_b[2], weight_ball[1];
compute_resistor_weights(0, 0xff, -1.0,
3, resistances_tiles_rg, weights_tiles_rg, 150, 0,
2, resistances_tiles_b, weights_tiles_b, 150, 0,
1, resistance_ball, weight_ball, 150, 0);
for (i = 0; i < 0x100; i++)
{
int bit0,bit1,bit2,r,g,b;
int bit0, bit1, bit2;
int r,g,b;
/* red component */
bit0 = (i >> 0) & 0x01;
bit1 = (i >> 1) & 0x01;
bit2 = (i >> 2) & 0x01;
r = 0x1f * bit0 + 0x3c * bit1 + 0xa4 * bit2;
r = combine_3_weights(weights_tiles_rg, bit0, bit1, bit2);
/* green component */
bit0 = (i >> 3) & 0x01;
bit1 = (i >> 4) & 0x01;
bit2 = (i >> 5) & 0x01;
g = 0x1f * bit0 + 0x3c * bit1 + 0xa4 * bit2;
g = combine_3_weights(weights_tiles_rg, bit0, bit1, bit2);
/* blue component */
bit0 = 0;
bit1 = (i >> 6) & 0x01;
bit2 = (i >> 7) & 0x01;
b = 0x1f * bit0 + 0x3c * bit1 + 0xa4 * bit2;
bit0 = (i >> 6) & 0x01;
bit1 = (i >> 7) & 0x01;
b = combine_2_weights(weights_tiles_b, bit0, bit1);
palette_set_color(machine,i,MAKE_RGB(r,g,b));
palette_set_color(machine, (i * 2) + 0, RGB_BLACK);
palette_set_color(machine, (i * 2) + 1, MAKE_RGB(r, g, b));
}
for (i = 0;i < machine->config->color_table_len;i += 2)
{
colortable[i] = 0; /* black background */
colortable[i + 1] = i / 2; /* colored foreground */
}
palette_set_color(machine, 0x200, MAKE_RGB(weight_ball[0], weight_ball[0], weight_ball[0]));
}
@ -222,13 +218,13 @@ WRITE8_HANDLER( warpwarp_videoram_w )
***************************************************************************/
INLINE void geebee_plot(mame_bitmap *bitmap, const rectangle *cliprect, int x, int y, int pen)
INLINE void geebee_plot(mame_bitmap *bitmap, const rectangle *cliprect, int x, int y, pen_t pen)
{
if (x >= cliprect->min_x && x <= cliprect->max_x && y >= cliprect->min_y && y <= cliprect->max_y)
*BITMAP_ADDR16(bitmap, y, x) = pen;
}
static void draw_ball(mame_bitmap *bitmap, const rectangle *cliprect,int color)
static void draw_ball(mame_bitmap *bitmap, const rectangle *cliprect,pen_t pen)
{
if (warpwarp_ball_on)
{
@ -237,12 +233,8 @@ static void draw_ball(mame_bitmap *bitmap, const rectangle *cliprect,int color)
int i,j;
for (i = warpwarp_ball_sizey;i > 0;i--)
{
for (j = warpwarp_ball_sizex;j > 0;j--)
{
geebee_plot(bitmap, cliprect, x-j, y-i, color);
}
}
geebee_plot(bitmap, cliprect, x-j, y-i, pen);
}
}
@ -259,11 +251,19 @@ VIDEO_UPDATE( geebee )
}
VIDEO_UPDATE( navarone )
{
tilemap_draw(bitmap,cliprect,bg_tilemap,0,0);
draw_ball(bitmap,cliprect,4);
return 0;
}
VIDEO_UPDATE( warpwarp )
{
tilemap_draw(bitmap,cliprect,bg_tilemap,0,0);
draw_ball(bitmap,cliprect,0xf6);
draw_ball(bitmap,cliprect,0x200);
return 0;
}

View File

@ -5,7 +5,6 @@ Atari Wolf Pack (prototype) video emulation
***************************************************************************/
#include "driver.h"
#include "deprecat.h"
int wolfpack_collision;
@ -31,28 +30,47 @@ static UINT8* LFSR;
static mame_bitmap* helper;
WRITE8_HANDLER( wolfpack_ship_size_w )
PALETTE_INIT( wolfpack )
{
UINT8 color;
int i;
color = 0x48;
/* allocate the colortable */
machine->colortable = colortable_alloc(machine, 8);
if (data & 0x10) color += 0x13;
if (data & 0x20) color += 0x22;
if (data & 0x40) color += 0x3A;
if (data & 0x80) color += 0x48;
colortable_palette_set_color(machine->colortable, 0, MAKE_RGB(0x00, 0x00, 0x00));
colortable_palette_set_color(machine->colortable, 1, MAKE_RGB(0xc1, 0xc1, 0xc1));
colortable_palette_set_color(machine->colortable, 2, MAKE_RGB(0x81, 0x81, 0x81));
colortable_palette_set_color(machine->colortable, 3, MAKE_RGB(0x48, 0x48, 0x48));
palette_set_color(Machine,3,MAKE_RGB(color,color,color));
for (i = 0; i < 4; i++)
{
rgb_t color = colortable_palette_get_color(machine->colortable, i);
palette_set_color_rgb(Machine,7,
color < 0xb8 ? color + 0x48 : 0xff,
color < 0xb8 ? color + 0x48 : 0xff,
color < 0xb8 ? color + 0x48 : 0xff);
colortable_palette_set_color(machine->colortable, 4 + i,
MAKE_RGB(RGB_RED(color) < 0xb8 ? RGB_RED(color) + 0x48 : 0xff,
RGB_GREEN(color) < 0xb8 ? RGB_GREEN(color) + 0x48 : 0xff,
RGB_BLUE(color) < 0xb8 ? RGB_BLUE(color) + 0x48 : 0xff));
}
wolfpack_ship_size = data >> 2;
colortable_entry_set_value(machine->colortable, 0x00, 0);
colortable_entry_set_value(machine->colortable, 0x01, 1);
colortable_entry_set_value(machine->colortable, 0x02, 1);
colortable_entry_set_value(machine->colortable, 0x03, 0);
colortable_entry_set_value(machine->colortable, 0x04, 0);
colortable_entry_set_value(machine->colortable, 0x05, 2);
colortable_entry_set_value(machine->colortable, 0x06, 0);
colortable_entry_set_value(machine->colortable, 0x07, 3);
colortable_entry_set_value(machine->colortable, 0x08, 4);
colortable_entry_set_value(machine->colortable, 0x09, 5);
colortable_entry_set_value(machine->colortable, 0x0a, 6);
colortable_entry_set_value(machine->colortable, 0x0b, 7);
}
WRITE8_HANDLER( wolfpack_ship_size_w )
{
wolfpack_ship_size = data;
}
WRITE8_HANDLER( wolfpack_video_invert_w )
{
wolfpack_video_invert = data & 1;
@ -111,9 +129,7 @@ VIDEO_START( wolfpack )
for (i = 0; i < 0x8000; i++)
{
int bit =
(val >> 0x0) ^
(val >> 0xE) ^ 1;
int bit = (val >> 0x0) ^ (val >> 0xe) ^ 1;
val = (val << 1) | (bit & 1);
@ -128,25 +144,25 @@ static void draw_ship(running_machine *machine, mame_bitmap* bitmap, const recta
{
static const UINT32 scaler[] =
{
0x00000, 0x00500, 0x00A00, 0x01000,
0x00000, 0x00500, 0x00a00, 0x01000,
0x01000, 0x01200, 0x01500, 0x01800,
0x01800, 0x01D00, 0x02200, 0x02800,
0x01800, 0x01d00, 0x02200, 0x02800,
0x02800, 0x02800, 0x02800, 0x02800,
0x02800, 0x03000, 0x03800, 0x04000,
0x04000, 0x04500, 0x04A00, 0x05000,
0x05000, 0x05500, 0x05A00, 0x06000,
0x06000, 0x06A00, 0x07500, 0x08000,
0x08000, 0x08A00, 0x09500, 0x0A000,
0x0A000, 0x0B000, 0x0C000, 0x0D000,
0x0D000, 0x0E000, 0x0F000, 0x10000,
0x10000, 0x11A00, 0x13500, 0x15000,
0x15000, 0x17500, 0x19A00, 0x1C000,
0x1C000, 0x1EA00, 0x21500, 0x24000,
0x24000, 0x26A00, 0x29500, 0x2C000,
0x2C000, 0x2FA00, 0x33500, 0x37000
0x04000, 0x04500, 0x04a00, 0x05000,
0x05000, 0x05500, 0x05a00, 0x06000,
0x06000, 0x06a00, 0x07500, 0x08000,
0x08000, 0x08a00, 0x09500, 0x0a000,
0x0a000, 0x0b000, 0x0c000, 0x0d000,
0x0d000, 0x0e000, 0x0f000, 0x10000,
0x10000, 0x11a00, 0x13500, 0x15000,
0x15000, 0x17500, 0x19a00, 0x1c000,
0x1c000, 0x1ea00, 0x21500, 0x24000,
0x24000, 0x26a00, 0x29500, 0x2c000,
0x2c000, 0x2fa00, 0x33500, 0x37000
};
int chop = (scaler[wolfpack_ship_size] * wolfpack_ship_h_precess) >> 16;
int chop = (scaler[wolfpack_ship_size >> 2] * wolfpack_ship_h_precess) >> 16;
drawgfxzoom(bitmap, machine->gfx[1],
wolfpack_ship_pic,
@ -156,7 +172,7 @@ static void draw_ship(running_machine *machine, mame_bitmap* bitmap, const recta
128,
cliprect,
TRANSPARENCY_PEN, 0,
2 * scaler[wolfpack_ship_size], scaler[wolfpack_ship_size]);
2 * scaler[wolfpack_ship_size >> 2], scaler[wolfpack_ship_size >> 2]);
}
@ -182,20 +198,14 @@ static void draw_torpedo(running_machine *machine, mame_bitmap* bitmap, const re
int x2;
if (y % 16 == 1)
{
count = (count - 1) & 7;
}
x1 = 248 - wolfpack_torpedo_h - count;
x2 = 248 - wolfpack_torpedo_h + count;
for (x = 2 * x1; x < 2 * x2; x++)
{
if (LFSR[(current_index + 0x300 * y + x) % 0x8000])
{
*BITMAP_ADDR16(bitmap, y, x) = 1;
}
}
}
}
@ -205,13 +215,10 @@ static void draw_pt(running_machine *machine, mame_bitmap* bitmap, const rectang
rectangle rect = *cliprect;
if (!(wolfpack_pt_pic & 0x20))
{
rect.min_x = 256;
}
if (!(wolfpack_pt_pic & 0x10))
{
rect.max_x = 255;
}
drawgfx(bitmap, machine->gfx[2],
wolfpack_pt_pic,
@ -233,7 +240,7 @@ static void draw_pt(running_machine *machine, mame_bitmap* bitmap, const rectang
}
static void draw_water(mame_bitmap* bitmap, const rectangle* cliprect)
static void draw_water(colortable_t *colortable, mame_bitmap* bitmap, const rectangle* cliprect)
{
rectangle rect = *cliprect;
@ -241,18 +248,14 @@ static void draw_water(mame_bitmap* bitmap, const rectangle* cliprect)
int y;
if (rect.max_y > 127)
{
rect.max_y = 127;
}
for (y = rect.min_y; y <= rect.max_y; y++)
{
UINT16* p = BITMAP_ADDR16(bitmap, y, 0);
for (x = rect.min_x; x <= rect.max_x; x++)
{
p[x] |= 4;
}
p[x] = colortable_entry_get_value(colortable, p[x]) | 0x08;
}
}
@ -262,10 +265,20 @@ VIDEO_UPDATE( wolfpack )
int i;
int j;
UINT8 color = 0x48;
if (wolfpack_ship_size & 0x10) color += 0x13;
if (wolfpack_ship_size & 0x20) color += 0x22;
if (wolfpack_ship_size & 0x40) color += 0x3a;
if (wolfpack_ship_size & 0x80) color += 0x48;
colortable_palette_set_color(machine->colortable, 3, MAKE_RGB(color,color,color));
colortable_palette_set_color(machine->colortable, 7, MAKE_RGB(color < 0xb8 ? color + 0x48 : 0xff,
color < 0xb8 ? color + 0x48 : 0xff,
color < 0xb8 ? color + 0x48 : 0xff));
fillbitmap(bitmap, wolfpack_video_invert, cliprect);
for (i = 0; i < 8; i++)
{
for (j = 0; j < 32; j++)
{
int code = wolfpack_alpha_num_ram[32 * i + j];
@ -279,12 +292,11 @@ VIDEO_UPDATE( wolfpack )
cliprect,
TRANSPARENCY_NONE, 0);
}
}
draw_pt(machine, bitmap, cliprect);
draw_ship(machine, bitmap, cliprect);
draw_torpedo(machine, bitmap, cliprect);
draw_water(bitmap, cliprect);
draw_water(machine->colortable, bitmap, cliprect);
return 0;
}
@ -318,9 +330,7 @@ VIDEO_EOF( wolfpack )
continue;
if (*BITMAP_ADDR16(helper, y, x))
{
wolfpack_collision = 1;
}
}
}

View File

@ -7,6 +7,7 @@
***************************************************************************/
#include "driver.h"
#include "video/resnet.h"
@ -51,14 +52,22 @@ Here's the hookup from the proms (82s131) to the r-g-b-outputs
***************************************************************************/
PALETTE_INIT( zaccaria )
{
int i,j,k;
#define COLOR(gfxn,offs) (colortable[machine->config->gfxdecodeinfo[gfxn].color_codes_start + offs])
int i, j, k;
static const int resistances_rg[] = { 1200, 1000, 820 };
static const int resistances_b[] = { 1000, 820 };
for (i = 0;i < machine->config->total_colors;i++)
double weights_rg[3], weights_b[2];
compute_resistor_weights(0, 0xff, -1.0,
3, resistances_rg, weights_rg, 390, 0,
2, resistances_b, weights_b, 470, 0,
0, 0, 0, 0, 0);
/* allocate the colortable */
machine->colortable = colortable_alloc(machine, 0x200);
for (i = 0; i < 0x200; i++)
{
int bit0,bit1,bit2,r,g,b;
/*
TODO: I'm not sure, but I think that pen 0 must always be black, otherwise
there's some junk brown background in Jack Rabbit.
@ -68,29 +77,31 @@ PALETTE_INIT( zaccaria )
black anyway.
*/
if (((i % 64) / 8) == 0)
{
palette_set_color(machine,i,MAKE_RGB(0,0,0));
}
colortable_palette_set_color(machine->colortable, i, RGB_BLACK);
else
{
/* red component */
bit0 = (color_prom[0] >> 3) & 0x01;
bit1 = (color_prom[0] >> 2) & 0x01;
bit2 = (color_prom[0] >> 1) & 0x01;
r = 0x46 * bit0 + 0x53 * bit1 + 0x66 * bit2;
/* green component */
bit0 = (color_prom[0] >> 0) & 0x01;
bit1 = (color_prom[machine->config->total_colors] >> 3) & 0x01;
bit2 = (color_prom[machine->config->total_colors] >> 2) & 0x01;
g = 0x46 * bit0 + 0x53 * bit1 + 0x66 * bit2;
/* blue component */
bit0 = (color_prom[machine->config->total_colors] >> 1) & 0x01;
bit1 = (color_prom[machine->config->total_colors] >> 0) & 0x01;
b = 0x66 * bit0 + 0x96 * bit1;
palette_set_color(machine,i,MAKE_RGB(r,g,b));
}
int bit0, bit1, bit2;
int r, g, b;
color_prom++;
/* red component */
bit0 = (color_prom[i + 0x000] >> 3) & 0x01;
bit1 = (color_prom[i + 0x000] >> 2) & 0x01;
bit2 = (color_prom[i + 0x000] >> 1) & 0x01;
r = combine_3_weights(weights_rg, bit0, bit1, bit2);
/* green component */
bit0 = (color_prom[i + 0x000] >> 0) & 0x01;
bit1 = (color_prom[i + 0x200] >> 3) & 0x01;
bit2 = (color_prom[i + 0x200] >> 2) & 0x01;
g = combine_3_weights(weights_rg, bit0, bit1, bit2);
/* blue component */
bit0 = (color_prom[i + 0x200] >> 1) & 0x01;
bit1 = (color_prom[i + 0x200] >> 0) & 0x01;
b = combine_2_weights(weights_b, bit0, bit1);
colortable_palette_set_color(machine->colortable, i, MAKE_RGB(r, g, b));
}
}
/* There are 512 unique colors, which seem to be organized in 8 blocks */
@ -98,27 +109,16 @@ PALETTE_INIT( zaccaria )
/* but in interleaved order, like Phoenix. Additionally, colors for */
/* background and sprites are interleaved. */
for (i = 0;i < 8;i++)
{
for (j = 0;j < 4;j++)
{
for (k = 0;k < 8;k++)
{
/* swap j and k to make the colors sequential */
COLOR(0,32 * i + 8 * j + k) = 64 * i + 8 * k + 2*j;
}
}
}
colortable_entry_set_value(machine->colortable, 0 + 32 * i + 8 * j + k, 64 * i + 8 * k + 2*j);
for (i = 0;i < 8;i++)
{
for (j = 0;j < 4;j++)
{
for (k = 0;k < 8;k++)
{
/* swap j and k to make the colors sequential */
COLOR(1,32 * i + 8 * j + k) = 64 * i + 8 * k + 2*j+1;
}
}
}
colortable_entry_set_value(machine->colortable, 256 + 32 * i + 8 * j + k, 64 * i + 8 * k + 2*j+1);
}

View File

@ -57,61 +57,52 @@ PALETTE_INIT( zodiack )
{
int i;
#define TOTAL_COLORS(gfxn) (machine->gfx[gfxn]->total_colors * machine->gfx[gfxn]->color_granularity)
#define COLOR(gfxn,offs) (colortable[machine->config->gfxdecodeinfo[gfxn].color_codes_start + offs])
/* allocate the colortable */
machine->colortable = colortable_alloc(machine, 0x31);
/* first, the character/sprite palette */
for (i = 0;i < machine->config->total_colors-1; i++)
/* create a lookup table for the palette */
for (i = 0; i < 0x30; 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));
}
/* white for bullets */
colortable_palette_set_color(machine->colortable, 0x30, RGB_WHITE);
palette_set_color(machine,machine->config->total_colors-1,MAKE_RGB(0xff,0xff,0xff));
for (i = 0; i < 0x20; i++)
if ((i & 3) == 0)
colortable_entry_set_value(machine->colortable, i, 0);
for (i = 0;i < TOTAL_COLORS(0);i+=2)
for (i = 0; i < 0x10; i += 2)
{
COLOR(0,i ) = (32 + (i / 2));
COLOR(0,i+1) = (40 + (i / 2));
}
for (i = 0;i < TOTAL_COLORS(3);i++)
{
if ((i & 3) == 0) COLOR(3,i) = 0;
colortable_entry_set_value(machine->colortable, 0x20 + i, 32 + (i / 2));
colortable_entry_set_value(machine->colortable, 0x21 + i, 40 + (i / 2));
}
/* bullet */
COLOR(2, 0) = 0;
COLOR(2, 1) = 48;
colortable_entry_set_value(machine->colortable, 0x30, 0);
colortable_entry_set_value(machine->colortable, 0x31, 0x30);
}
static TILE_GET_INFO( get_bg_tile_info )
@ -132,11 +123,9 @@ static TILE_GET_INFO( get_fg_tile_info )
VIDEO_START( zodiack )
{
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);
fg_tilemap = tilemap_create(get_fg_tile_info, tilemap_scan_rows,
8, 8, 32, 32);
fg_tilemap = tilemap_create(get_fg_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
tilemap_set_transparent_pen(fg_tilemap, 0);
tilemap_set_scroll_cols(fg_tilemap, 32);
@ -207,9 +196,7 @@ VIDEO_UPDATE( zodiack )
int i;
for (i = 0; i < 32; i++)
{
tilemap_set_scrolly(fg_tilemap, i, zodiack_attributesram[i * 2]);
}
tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
tilemap_draw(bitmap, cliprect, fg_tilemap, 0, 0);