diff --git a/.gitattributes b/.gitattributes index 1cd061c2692..13af088c46c 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1216,7 +1216,7 @@ src/mame/drivers/bigstrkb.c svneol=native#text/plain src/mame/drivers/bionicc.c svneol=native#text/plain src/mame/drivers/bishi.c svneol=native#text/plain src/mame/drivers/bishjan.c svneol=native#text/plain -src/mame/drivers/bking2.c svneol=native#text/plain +src/mame/drivers/bking.c svneol=native#text/plain src/mame/drivers/bladestl.c svneol=native#text/plain src/mame/drivers/blktiger.c svneol=native#text/plain src/mame/drivers/blmbycar.c svneol=native#text/plain @@ -2623,7 +2623,7 @@ src/mame/video/bigevglf.c svneol=native#text/plain src/mame/video/bigstrkb.c svneol=native#text/plain src/mame/video/bionicc.c svneol=native#text/plain src/mame/video/bishi.c svneol=native#text/plain -src/mame/video/bking2.c svneol=native#text/plain +src/mame/video/bking.c svneol=native#text/plain src/mame/video/bladestl.c svneol=native#text/plain src/mame/video/blktiger.c svneol=native#text/plain src/mame/video/blmbycar.c svneol=native#text/plain diff --git a/src/mame/drivers/appoooh.c b/src/mame/drivers/appoooh.c index 698ae456568..24e7738faf2 100644 --- a/src/mame/drivers/appoooh.c +++ b/src/mame/drivers/appoooh.c @@ -241,8 +241,7 @@ static MACHINE_DRIVER_START( appoooh ) MDRV_SCREEN_SIZE(32*8, 32*8) MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) MDRV_GFXDECODE(appoooh) - MDRV_PALETTE_LENGTH(32) - MDRV_COLORTABLE_LENGTH(32*8+32*8) + MDRV_PALETTE_LENGTH(32*8+32*8) MDRV_PALETTE_INIT(appoooh) MDRV_VIDEO_START(appoooh) @@ -486,8 +485,7 @@ static MACHINE_DRIVER_START( robowres ) MDRV_SCREEN_SIZE(32*8, 32*8) MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) MDRV_GFXDECODE(robowres) - MDRV_PALETTE_LENGTH(32) - MDRV_COLORTABLE_LENGTH(32*8+32*8) + MDRV_PALETTE_LENGTH(32*8+32*8) MDRV_PALETTE_INIT(robowres) MDRV_VIDEO_START(appoooh) diff --git a/src/mame/drivers/bking2.c b/src/mame/drivers/bking.c similarity index 89% rename from src/mame/drivers/bking2.c rename to src/mame/drivers/bking.c index 2d4ac904f81..db3bc1b20a2 100644 --- a/src/mame/drivers/bking2.c +++ b/src/mame/drivers/bking.c @@ -34,46 +34,46 @@ extern WRITE8_HANDLER( buggychl_mcu_w ); extern READ8_HANDLER( buggychl_mcu_r ); extern READ8_HANDLER( buggychl_mcu_status_r ); -extern PALETTE_INIT( bking2 ); +extern PALETTE_INIT( bking ); -extern VIDEO_START( bking2 ); -extern VIDEO_UPDATE( bking2 ); -extern VIDEO_EOF( bking2 ); +extern VIDEO_START( bking ); +extern VIDEO_UPDATE( bking ); +extern VIDEO_EOF( bking ); -extern WRITE8_HANDLER( bking2_xld1_w ); -extern WRITE8_HANDLER( bking2_yld1_w ); -extern WRITE8_HANDLER( bking2_xld2_w ); -extern WRITE8_HANDLER( bking2_yld2_w ); -extern WRITE8_HANDLER( bking2_xld3_w ); -extern WRITE8_HANDLER( bking2_yld3_w ); -extern WRITE8_HANDLER( bking2_msk_w ); -extern WRITE8_HANDLER( bking2_cont1_w ); -extern WRITE8_HANDLER( bking2_cont2_w ); -extern WRITE8_HANDLER( bking2_cont3_w ); -extern WRITE8_HANDLER( bking2_hitclr_w ); -extern WRITE8_HANDLER( bking2_playfield_w ); +extern WRITE8_HANDLER( bking_xld1_w ); +extern WRITE8_HANDLER( bking_yld1_w ); +extern WRITE8_HANDLER( bking_xld2_w ); +extern WRITE8_HANDLER( bking_yld2_w ); +extern WRITE8_HANDLER( bking_xld3_w ); +extern WRITE8_HANDLER( bking_yld3_w ); +extern WRITE8_HANDLER( bking_msk_w ); +extern WRITE8_HANDLER( bking_cont1_w ); +extern WRITE8_HANDLER( bking_cont2_w ); +extern WRITE8_HANDLER( bking_cont3_w ); +extern WRITE8_HANDLER( bking_hitclr_w ); +extern WRITE8_HANDLER( bking_playfield_w ); -extern READ8_HANDLER( bking2_input_port_5_r ); -extern READ8_HANDLER( bking2_input_port_6_r ); -extern READ8_HANDLER( bking2_pos_r ); +extern READ8_HANDLER( bking_input_port_5_r ); +extern READ8_HANDLER( bking_input_port_6_r ); +extern READ8_HANDLER( bking_pos_r ); -UINT8 *bking2_playfield_ram; +UINT8 *bking_playfield_ram; static int bking3_addr_h, bking3_addr_l; static int sndnmi_enable = 1; -static READ8_HANDLER( bking2_sndnmi_disable_r ) +static READ8_HANDLER( bking_sndnmi_disable_r ) { sndnmi_enable = 0; return 0; } -static WRITE8_HANDLER( bking2_sndnmi_enable_w ) +static WRITE8_HANDLER( bking_sndnmi_enable_w ) { sndnmi_enable = 1; } -static WRITE8_HANDLER( bking2_soundlatch_w ) +static WRITE8_HANDLER( bking_soundlatch_w ) { int i,code; @@ -114,48 +114,48 @@ static READ8_HANDLER( bking3_ext_check_r ) return 0x31; //no "bad rom.", no "bad ext." } -static ADDRESS_MAP_START( bking2_map, ADDRESS_SPACE_PROGRAM, 8 ) +static ADDRESS_MAP_START( bking_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0x8000, 0x83ff) AM_RAM - AM_RANGE(0x9000, 0x97ff) AM_RAM AM_WRITE(bking2_playfield_w) AM_BASE(&bking2_playfield_ram) + AM_RANGE(0x9000, 0x97ff) AM_RAM AM_WRITE(bking_playfield_w) AM_BASE(&bking_playfield_ram) ADDRESS_MAP_END -static ADDRESS_MAP_START( bking2_io_map, ADDRESS_SPACE_IO, 8 ) +static ADDRESS_MAP_START( bking_io_map, ADDRESS_SPACE_IO, 8 ) ADDRESS_MAP_FLAGS( AMEF_ABITS(8) ) - AM_RANGE(0x00, 0x00) AM_READWRITE(input_port_0_r, bking2_xld1_w) - AM_RANGE(0x01, 0x01) AM_READWRITE(input_port_1_r, bking2_yld1_w) - AM_RANGE(0x02, 0x02) AM_READWRITE(input_port_2_r, bking2_xld2_w) - AM_RANGE(0x03, 0x03) AM_READWRITE(input_port_3_r, bking2_yld2_w) - AM_RANGE(0x04, 0x04) AM_READWRITE(input_port_4_r, bking2_xld3_w) - AM_RANGE(0x05, 0x05) AM_READWRITE(bking2_input_port_5_r, bking2_yld3_w) - AM_RANGE(0x06, 0x06) AM_READWRITE(bking2_input_port_6_r, bking2_msk_w) + AM_RANGE(0x00, 0x00) AM_READWRITE(input_port_0_r, bking_xld1_w) + AM_RANGE(0x01, 0x01) AM_READWRITE(input_port_1_r, bking_yld1_w) + AM_RANGE(0x02, 0x02) AM_READWRITE(input_port_2_r, bking_xld2_w) + AM_RANGE(0x03, 0x03) AM_READWRITE(input_port_3_r, bking_yld2_w) + AM_RANGE(0x04, 0x04) AM_READWRITE(input_port_4_r, bking_xld3_w) + AM_RANGE(0x05, 0x05) AM_READWRITE(bking_input_port_5_r, bking_yld3_w) + AM_RANGE(0x06, 0x06) AM_READWRITE(bking_input_port_6_r, bking_msk_w) AM_RANGE(0x07, 0x07) AM_WRITE(watchdog_reset_w) - AM_RANGE(0x08, 0x08) AM_WRITE(bking2_cont1_w) - AM_RANGE(0x09, 0x09) AM_WRITE(bking2_cont2_w) - AM_RANGE(0x0a, 0x0a) AM_WRITE(bking2_cont3_w) - AM_RANGE(0x0b, 0x0b) AM_WRITE(bking2_soundlatch_w) -// AM_RANGE(0x0c, 0x0c) AM_WRITE(bking2_eport2_w) this is not shown to be connected anywhere - AM_RANGE(0x0d, 0x0d) AM_WRITE(bking2_hitclr_w) - AM_RANGE(0x07, 0x1f) AM_READ(bking2_pos_r) + AM_RANGE(0x08, 0x08) AM_WRITE(bking_cont1_w) + AM_RANGE(0x09, 0x09) AM_WRITE(bking_cont2_w) + AM_RANGE(0x0a, 0x0a) AM_WRITE(bking_cont3_w) + AM_RANGE(0x0b, 0x0b) AM_WRITE(bking_soundlatch_w) +// AM_RANGE(0x0c, 0x0c) AM_WRITE(bking_eport2_w) this is not shown to be connected anywhere + AM_RANGE(0x0d, 0x0d) AM_WRITE(bking_hitclr_w) + AM_RANGE(0x07, 0x1f) AM_READ(bking_pos_r) ADDRESS_MAP_END static ADDRESS_MAP_START( bking3_io_map, ADDRESS_SPACE_IO, 8 ) ADDRESS_MAP_FLAGS( AMEF_ABITS(8) ) - AM_RANGE(0x00, 0x00) AM_READWRITE(input_port_0_r, bking2_xld1_w) - AM_RANGE(0x01, 0x01) AM_READWRITE(input_port_1_r, bking2_yld1_w) - AM_RANGE(0x02, 0x02) AM_READWRITE(input_port_2_r, bking2_xld2_w) - AM_RANGE(0x03, 0x03) AM_READWRITE(input_port_3_r, bking2_yld2_w) - AM_RANGE(0x04, 0x04) AM_READWRITE(input_port_4_r, bking2_xld3_w) - AM_RANGE(0x05, 0x05) AM_READWRITE(bking2_input_port_5_r, bking2_yld3_w) - AM_RANGE(0x06, 0x06) AM_READWRITE(bking2_input_port_6_r, bking2_msk_w) + AM_RANGE(0x00, 0x00) AM_READWRITE(input_port_0_r, bking_xld1_w) + AM_RANGE(0x01, 0x01) AM_READWRITE(input_port_1_r, bking_yld1_w) + AM_RANGE(0x02, 0x02) AM_READWRITE(input_port_2_r, bking_xld2_w) + AM_RANGE(0x03, 0x03) AM_READWRITE(input_port_3_r, bking_yld2_w) + AM_RANGE(0x04, 0x04) AM_READWRITE(input_port_4_r, bking_xld3_w) + AM_RANGE(0x05, 0x05) AM_READWRITE(bking_input_port_5_r, bking_yld3_w) + AM_RANGE(0x06, 0x06) AM_READWRITE(bking_input_port_6_r, bking_msk_w) AM_RANGE(0x07, 0x07) AM_WRITE(watchdog_reset_w) - AM_RANGE(0x08, 0x08) AM_WRITE(bking2_cont1_w) - AM_RANGE(0x09, 0x09) AM_WRITE(bking2_cont2_w) - AM_RANGE(0x0a, 0x0a) AM_WRITE(bking2_cont3_w) - AM_RANGE(0x0b, 0x0b) AM_WRITE(bking2_soundlatch_w) -// AM_RANGE(0x0c, 0x0c) AM_WRITE(bking2_eport2_w) this is not shown to be connected anywhere - AM_RANGE(0x0d, 0x0d) AM_WRITE(bking2_hitclr_w) - AM_RANGE(0x07, 0x1f) AM_READ(bking2_pos_r) + AM_RANGE(0x08, 0x08) AM_WRITE(bking_cont1_w) + AM_RANGE(0x09, 0x09) AM_WRITE(bking_cont2_w) + AM_RANGE(0x0a, 0x0a) AM_WRITE(bking_cont3_w) + AM_RANGE(0x0b, 0x0b) AM_WRITE(bking_soundlatch_w) +// AM_RANGE(0x0c, 0x0c) AM_WRITE(bking_eport2_w) this is not shown to be connected anywhere + AM_RANGE(0x0d, 0x0d) AM_WRITE(bking_hitclr_w) + AM_RANGE(0x07, 0x1f) AM_READ(bking_pos_r) AM_RANGE(0x2f, 0x2f) AM_READWRITE(buggychl_mcu_r, buggychl_mcu_w) AM_RANGE(0x4f, 0x4f) AM_READWRITE(buggychl_mcu_status_r, unk_w) AM_RANGE(0x60, 0x60) AM_READ(bking3_extrarom_r) @@ -163,7 +163,7 @@ static ADDRESS_MAP_START( bking3_io_map, ADDRESS_SPACE_IO, 8 ) AM_RANGE(0x8f, 0x8f) AM_WRITE(bking3_addr_l_w) ADDRESS_MAP_END -static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 ) +static ADDRESS_MAP_START( bking_audio_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x1fff) AM_ROM AM_RANGE(0x2000, 0x2fff) AM_ROM //only bking3 AM_RANGE(0x4000, 0x43ff) AM_RAM @@ -172,7 +172,7 @@ static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x4402, 0x4402) AM_WRITE(AY8910_control_port_1_w) AM_RANGE(0x4403, 0x4403) AM_READWRITE(AY8910_read_port_1_r, AY8910_write_port_1_w) AM_RANGE(0x4800, 0x4800) AM_READ(soundlatch_r) - AM_RANGE(0x4802, 0x4802) AM_READWRITE(bking2_sndnmi_disable_r, bking2_sndnmi_enable_w) + AM_RANGE(0x4802, 0x4802) AM_READWRITE(bking_sndnmi_disable_r, bking_sndnmi_enable_w) AM_RANGE(0xe000, 0xefff) AM_ROM /* Space for diagnostic ROM */ ADDRESS_MAP_END @@ -523,7 +523,7 @@ static const gfx_layout balllayout = 16*8 /* every sprite takes 16 consecutive bytes */ }; -static GFXDECODE_START( bking2 ) +static GFXDECODE_START( bking ) GFXDECODE_ENTRY( REGION_GFX1, 0, charlayout, 0, 4 ) /* playfield */ GFXDECODE_ENTRY( REGION_GFX2, 0, crowlayout, 4*8, 4 ) /* crow */ GFXDECODE_ENTRY( REGION_GFX3, 0, balllayout, 4*8+4*4, 4 ) /* ball 1 */ @@ -545,21 +545,21 @@ static const struct AY8910interface ay8910_interface = portb_w }; -static MACHINE_DRIVER_START( bking2 ) +static MACHINE_DRIVER_START( bking ) /* basic machine hardware */ MDRV_CPU_ADD_TAG("main_cpu", Z80, XTAL_12MHz/4) /* 3 MHz */ - MDRV_CPU_PROGRAM_MAP(bking2_map,0) - MDRV_CPU_IO_MAP(bking2_io_map,0) + MDRV_CPU_PROGRAM_MAP(bking_map,0) + MDRV_CPU_IO_MAP(bking_io_map,0) MDRV_CPU_VBLANK_INT(irq0_line_hold,1) MDRV_CPU_ADD(Z80, XTAL_6MHz/2) /* 3 MHz */ /* audio CPU */ - MDRV_CPU_PROGRAM_MAP(sound_map,0) - /* interrupts (from Jungle King hardware, might be wrong): */ - /* - no interrupts synced with vblank */ - /* - NMI triggered by the main CPU */ - /* - periodic IRQ, with frequency 6000000/(4*16*16*10*16) = 36.621 Hz, */ + MDRV_CPU_PROGRAM_MAP(bking_audio_map,0) + /* interrupts (from Jungle King hardware, might be wrong): */ + /* - no interrupts synced with vblank */ + /* - NMI triggered by the main CPU */ + /* - periodic IRQ, with frequency 6000000/(4*16*16*10*16) = 36.621 Hz, */ MDRV_CPU_PERIODIC_INT(irq0_line_hold, (double)6000000/(4*16*16*10*16)) MDRV_SCREEN_REFRESH_RATE(60) @@ -570,14 +570,13 @@ static MACHINE_DRIVER_START( bking2 ) MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) MDRV_SCREEN_SIZE(32*8, 32*8) MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) - MDRV_GFXDECODE(bking2) - MDRV_PALETTE_LENGTH(512) - MDRV_COLORTABLE_LENGTH(4*8+4*4+4*2+4*2) + MDRV_GFXDECODE(bking) + MDRV_PALETTE_LENGTH(4*8+4*4+4*2+4*2) - MDRV_PALETTE_INIT(bking2) - MDRV_VIDEO_START(bking2) - MDRV_VIDEO_UPDATE(bking2) - MDRV_VIDEO_EOF(bking2) + MDRV_PALETTE_INIT(bking) + MDRV_VIDEO_START(bking) + MDRV_VIDEO_UPDATE(bking) + MDRV_VIDEO_EOF(bking) /* sound hardware */ MDRV_SPEAKER_STANDARD_MONO("mono") @@ -594,7 +593,7 @@ static MACHINE_DRIVER_START( bking2 ) MACHINE_DRIVER_END static MACHINE_DRIVER_START( bking3 ) - MDRV_IMPORT_FROM(bking2) + MDRV_IMPORT_FROM(bking) MDRV_CPU_MODIFY("main_cpu") MDRV_CPU_IO_MAP(bking3_io_map,0) @@ -895,6 +894,6 @@ ROM_START( bking3 ) ROM_LOAD( "a24-21.25", 0x0000, 0x1000, CRC(3106fcac) SHA1(08454adfb58e5df84140d86ed52fa4ef684df9f1) ) /* extra rom on the same SUB PCB where is the mcu */ ROM_END -GAME( 1982, bking, 0, bking2, bking, 0, ROT270, "Taito Corporation", "Birdie King", 0 ) -GAME( 1983, bking2, 0, bking2, bking2, 0, ROT90, "Taito Corporation", "Birdie King 2", 0 ) +GAME( 1982, bking, 0, bking, bking, 0, ROT270, "Taito Corporation", "Birdie King", 0 ) +GAME( 1983, bking2, 0, bking, bking2, 0, ROT90, "Taito Corporation", "Birdie King 2", 0 ) GAME( 1984, bking3, 0, bking3, bking2, 0, ROT90, "Taito Corporation", "Birdie King 3", GAME_WRONG_COLORS ) diff --git a/src/mame/mame.mak b/src/mame/mame.mak index bfe9cd46001..7053f864b90 100644 --- a/src/mame/mame.mak +++ b/src/mame/mame.mak @@ -1289,7 +1289,7 @@ $(MAMEOBJ)/taito.a: \ $(DRIVERS)/ashnojoe.o $(VIDEO)/ashnojoe.o \ $(DRIVERS)/asuka.o $(MACHINE)/bonzeadv.o $(VIDEO)/asuka.o \ $(DRIVERS)/bigevglf.o $(MACHINE)/bigevglf.o $(VIDEO)/bigevglf.o \ - $(DRIVERS)/bking2.o $(VIDEO)/bking2.o \ + $(DRIVERS)/bking.o $(VIDEO)/bking.o \ $(DRIVERS)/bublbobl.o $(MACHINE)/bublbobl.o $(VIDEO)/bublbobl.o \ $(DRIVERS)/buggychl.o $(MACHINE)/buggychl.o $(VIDEO)/buggychl.o \ $(DRIVERS)/chaknpop.o $(MACHINE)/chaknpop.o $(VIDEO)/chaknpop.o \ diff --git a/src/mame/video/1943.c b/src/mame/video/1943.c index 6daea092c4f..dce19791954 100644 --- a/src/mame/video/1943.c +++ b/src/mame/video/1943.c @@ -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->drv->gfxdecodeinfo[gfxn].color_codes_start + offs]) - UINT8 *c1943_scrollx; UINT8 *c1943_scrolly; UINT8 *c1943_bgscrollx; diff --git a/src/mame/video/appoooh.c b/src/mame/video/appoooh.c index e1c56bf6a3f..b8b03644f24 100644 --- a/src/mame/video/appoooh.c +++ b/src/mame/video/appoooh.c @@ -33,83 +33,71 @@ static int priority; PALETTE_INIT( appoooh ) { 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++) + for (i = 0; i < machine->drv->total_colors; i++) { - int bit0,bit1,bit2,r,g,b; + UINT8 pen; + int bit0, bit1, bit2, r, g, b; + + if (i < 0x100) + /* charset #1 */ + pen = (color_prom[0x020 + (i - 0x000)] & 0x0f) | 0x00; + else + /* charset #2 */ + pen = (color_prom[0x120 + (i - 0x100)] & 0x0f) | 0x10; /* red component */ - bit0 = (*color_prom >> 0) & 0x01; - bit1 = (*color_prom >> 1) & 0x01; - bit2 = (*color_prom >> 2) & 0x01; + bit0 = (color_prom[pen] >> 0) & 0x01; + bit1 = (color_prom[pen] >> 1) & 0x01; + bit2 = (color_prom[pen] >> 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[pen] >> 3) & 0x01; + bit1 = (color_prom[pen] >> 4) & 0x01; + bit2 = (color_prom[pen] >> 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[pen] >> 6) & 0x01; + bit2 = (color_prom[pen] >> 7) & 0x01; b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - palette_set_color(machine,i,MAKE_RGB(r,g,b)); - color_prom++; + palette_set_color(machine, i, MAKE_RGB(r, g, b)); } - - /* color_prom now points to the beginning of the lookup table */ - - /* charset #1 lookup table */ - for (i = 0;i < TOTAL_COLORS(0);i++) - COLOR(0,i) = (*(color_prom++) & 0x0f)|CHR1_OFST; - - /* charset #2 lookup table */ - for (i = 0;i < TOTAL_COLORS(1);i++) - COLOR(1,i) = (*(color_prom++) & 0x0f)|CHR2_OFST; - - /* TODO: the driver currently uses only 16 of the 32 color codes. */ - /* 16-31 might be unused, but there might be a palette bank selector */ - /* to use them somewhere in the game. */ } PALETTE_INIT( robowres ) { 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++) + for (i = 0; i < machine->drv->total_colors; i++) { - int bit0,bit1,bit2,r,g,b; + int bit0, bit1, bit2, r, g, b; + + UINT8 pen = color_prom[0x020 + i] & 0x0f; /* red component */ - bit0 = (*color_prom >> 0) & 0x01; - bit1 = (*color_prom >> 1) & 0x01; - bit2 = (*color_prom >> 2) & 0x01; + bit0 = (color_prom[pen] >> 0) & 0x01; + bit1 = (color_prom[pen] >> 1) & 0x01; + bit2 = (color_prom[pen] >> 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[pen] >> 3) & 0x01; + bit1 = (color_prom[pen] >> 4) & 0x01; + bit2 = (color_prom[pen] >> 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[pen] >> 6) & 0x01; + bit2 = (color_prom[pen] >> 7) & 0x01; b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - palette_set_color(machine,i,MAKE_RGB(r,g,b)); - color_prom++; + palette_set_color(machine, i, MAKE_RGB(r, g, b)); } - - /* color_prom now points to the beginning of the lookup table */ - - for (i = 0;i < 32*8;i++) - colortable[i]=(*(color_prom++) & 0x0f); - } diff --git a/src/mame/video/bking2.c b/src/mame/video/bking.c similarity index 73% rename from src/mame/video/bking2.c rename to src/mame/video/bking.c index cea0d46e1b3..e44193b8aa5 100644 --- a/src/mame/video/bking2.c +++ b/src/mame/video/bking.c @@ -1,6 +1,6 @@ /*************************************************************************** - bking2.c + bking.c Functions to emulate the video hardware of the machine. @@ -8,7 +8,7 @@ #include "driver.h" -extern UINT8* bking2_playfield_ram; +extern UINT8* bking_playfield_ram; static int pc3259_output[4]; @@ -51,93 +51,85 @@ static tilemap* bg_tilemap; bit 0 -- 220 ohm resistor -- RED ***************************************************************************/ -PALETTE_INIT( bking2 ) + +PALETTE_INIT( bking ) { 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++) + for (i = 0; i < machine->drv->total_colors; i++) { - int bit0,bit1,bit2,r,g,b; + UINT8 pen; + int bit0, bit1, bit2, r, g, b; + /* color PROM A7-A8 is the palette select */ + if (i < 0x20) + /* characters - image bits go to A0-A2 of the color PROM */ + pen = (((i - 0x00) << 4) & 0x180) | ((i - 0x00) & 0x07); + else if (i < 0x30) + /* crow - image bits go to A5-A6. */ + pen = (((i - 0x20) << 5) & 0x180) | (((i - 0x20) & 0x03) << 5); + else if (i < 0x38) + /* ball #1 - image bit goes to A3 */ + pen = (((i - 0x30) << 6) & 0x180) | (((i - 0x30) & 0x01) << 3); + else + /* ball #2 - image bit goes to A4 */ + pen = (((i - 0x38) << 6) & 0x180) | (((i - 0x38) & 0x01) << 4); /* red component */ - bit0 = (*color_prom >> 0) & 0x01; - bit1 = (*color_prom >> 1) & 0x01; - bit2 = (*color_prom >> 2) & 0x01; + bit0 = (color_prom[pen] >> 0) & 0x01; + bit1 = (color_prom[pen] >> 1) & 0x01; + bit2 = (color_prom[pen] >> 2) & 0x01; r = 0x92 * bit0 + 0x46 * bit1 + 0x27 * bit2; + /* green component */ - bit0 = (*color_prom >> 3) & 0x01; - bit1 = (*color_prom >> 4) & 0x01; - bit2 = (*color_prom >> 5) & 0x01; + bit0 = (color_prom[pen] >> 3) & 0x01; + bit1 = (color_prom[pen] >> 4) & 0x01; + bit2 = (color_prom[pen] >> 5) & 0x01; g = 0x92 * bit0 + 0x46 * bit1 + 0x27 * bit2; + /* blue component */ - bit0 = (*color_prom >> 6) & 0x01; - bit1 = (*color_prom >> 7) & 0x01; + bit0 = (color_prom[pen] >> 6) & 0x01; + bit1 = (color_prom[pen] >> 7) & 0x01; bit2 = 0; b = 0x92 * bit0 + 0x46 * bit1 + 0x27 * bit2; - palette_set_color(machine,i,MAKE_RGB(r,g,b)); - color_prom++; - } - - /* color PROM A7-A8 is the palette select */ - - /* character colors. Image bits go to A0-A2 of the color PROM */ - for (i = 0; i < TOTAL_COLORS(0); i++) - { - COLOR(0,i) = ((i << 4) & 0x180) | (i & 0x07); - } - - /* crow colors. Image bits go to A5-A6. */ - for (i = 0; i < TOTAL_COLORS(1); i++) - { - COLOR(1,i) = ((i << 5) & 0x180) | ((i & 0x03) << 5); - } - - /* ball colors. Ball 1 image bit goes to A3. Ball 2 to A4. */ - for (i = 0; i < TOTAL_COLORS(2); i++) - { - COLOR(2,i) = ((i << 6) & 0x180) | ((i & 0x01) << 3); - COLOR(3,i) = ((i << 6) & 0x180) | ((i & 0x01) << 4); + palette_set_color(machine, i, MAKE_RGB(r, g, b)); } } -WRITE8_HANDLER( bking2_xld1_w ) +WRITE8_HANDLER( bking_xld1_w ) { xld1 = -data; } -WRITE8_HANDLER( bking2_yld1_w ) +WRITE8_HANDLER( bking_yld1_w ) { yld1 = -data; } -WRITE8_HANDLER( bking2_xld2_w ) +WRITE8_HANDLER( bking_xld2_w ) { xld2 = -data; } -WRITE8_HANDLER( bking2_yld2_w ) +WRITE8_HANDLER( bking_yld2_w ) { yld2 = -data; } -WRITE8_HANDLER( bking2_xld3_w ) +WRITE8_HANDLER( bking_xld3_w ) { xld3 = -data; } -WRITE8_HANDLER( bking2_yld3_w ) +WRITE8_HANDLER( bking_yld3_w ) { yld3 = -data; } -WRITE8_HANDLER( bking2_cont1_w ) +WRITE8_HANDLER( bking_cont1_w ) { /* D0 = COIN LOCK */ /* D1 = BALL 5 (Controller selection) */ @@ -156,7 +148,7 @@ WRITE8_HANDLER( bking2_cont1_w ) crow_pic = (data >> 4) & 0x0f; } -WRITE8_HANDLER( bking2_cont2_w ) +WRITE8_HANDLER( bking_cont2_w ) { /* D0-D2 = BALL10 - BALL12 (Selects player 1 ball picture) */ /* D3-D5 = BALL20 - BALL22 (Selects player 2 ball picture) */ @@ -169,7 +161,7 @@ WRITE8_HANDLER( bking2_cont2_w ) hit = data >> 6; } -WRITE8_HANDLER( bking2_cont3_w ) +WRITE8_HANDLER( bking_cont3_w ) { /* D0 = CROW INV (inverts Crow picture and coordinates) */ /* D1-D2 = COLOR 0 - COLOR 1 (switches 4 color palettes, global across all graphics) */ @@ -188,13 +180,13 @@ WRITE8_HANDLER( bking2_cont3_w ) } -WRITE8_HANDLER( bking2_msk_w ) +WRITE8_HANDLER( bking_msk_w ) { pc3259_mask++; } -WRITE8_HANDLER( bking2_hitclr_w ) +WRITE8_HANDLER( bking_hitclr_w ) { pc3259_mask = 0; @@ -205,24 +197,24 @@ WRITE8_HANDLER( bking2_hitclr_w ) } -WRITE8_HANDLER( bking2_playfield_w ) +WRITE8_HANDLER( bking_playfield_w ) { - bking2_playfield_ram[offset] = data; + bking_playfield_ram[offset] = data; tilemap_mark_tile_dirty(bg_tilemap, offset / 2); } -READ8_HANDLER( bking2_input_port_5_r ) +READ8_HANDLER( bking_input_port_5_r ) { return readinputport(controller ? 7 : 5); } -READ8_HANDLER( bking2_input_port_6_r ) +READ8_HANDLER( bking_input_port_6_r ) { return readinputport(controller ? 8 : 6); } -READ8_HANDLER( bking2_pos_r ) +READ8_HANDLER( bking_pos_r ) { return pc3259_output[offset / 8] << 4; } @@ -230,8 +222,8 @@ READ8_HANDLER( bking2_pos_r ) static TILE_GET_INFO( get_tile_info ) { - UINT8 code0 = bking2_playfield_ram[2 * tile_index + 0]; - UINT8 code1 = bking2_playfield_ram[2 * tile_index + 1]; + UINT8 code0 = bking_playfield_ram[2 * tile_index + 0]; + UINT8 code1 = bking_playfield_ram[2 * tile_index + 1]; int flags = 0; @@ -242,7 +234,7 @@ static TILE_GET_INFO( get_tile_info ) } -VIDEO_START( bking2 ) +VIDEO_START( bking ) { bg_tilemap = tilemap_create(get_tile_info, tilemap_scan_rows, 0, 8, 8, 32, 32); helper0 = auto_bitmap_alloc(machine->screen[0].width, machine->screen[0].height, machine->screen[0].format); @@ -250,7 +242,7 @@ VIDEO_START( bking2 ) } -VIDEO_UPDATE( bking2 ) +VIDEO_UPDATE( bking ) { tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0); @@ -282,7 +274,7 @@ VIDEO_UPDATE( bking2 ) } -VIDEO_EOF( bking2 ) +VIDEO_EOF( bking ) { static const rectangle rect = { 0, 7, 0, 15 };