diff --git a/.gitattributes b/.gitattributes index ff86f47d203..10454f17e67 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1572,6 +1572,7 @@ src/mame/drivers/ltcasino.c svneol=native#text/plain src/mame/drivers/lucky8.c svneol=native#text/plain src/mame/drivers/lvcards.c svneol=native#text/plain src/mame/drivers/lwings.c svneol=native#text/plain +src/mame/drivers/m10.c svneol=native#text/plain src/mame/drivers/m107.c svneol=native#text/plain src/mame/drivers/m52.c svneol=native#text/plain src/mame/drivers/m57.c svneol=native#text/plain @@ -1861,7 +1862,6 @@ src/mame/drivers/simpl156.c svneol=native#text/plain src/mame/drivers/simpsons.c svneol=native#text/plain src/mame/drivers/skullxbo.c svneol=native#text/plain src/mame/drivers/skyarmy.c svneol=native#text/plain -src/mame/drivers/skychut.c svneol=native#text/plain src/mame/drivers/skydiver.c svneol=native#text/plain src/mame/drivers/skyfox.c svneol=native#text/plain src/mame/drivers/skykid.c svneol=native#text/plain @@ -2202,6 +2202,7 @@ src/mame/includes/lethalj.h svneol=native#text/plain src/mame/includes/liberatr.h svneol=native#text/plain src/mame/includes/lockon.h svneol=native#text/plain src/mame/includes/lwings.h svneol=native#text/plain +src/mame/includes/m10.h svneol=native#text/plain src/mame/includes/m107.h svneol=native#text/plain src/mame/includes/m52.h svneol=native#text/plain src/mame/includes/m57.h svneol=native#text/plain @@ -2260,7 +2261,6 @@ src/mame/includes/segas32.h svneol=native#text/plain src/mame/includes/seta.h svneol=native#text/plain src/mame/includes/shuuz.h svneol=native#text/plain src/mame/includes/skullxbo.h svneol=native#text/plain -src/mame/includes/skychut.h svneol=native#text/plain src/mame/includes/skydiver.h svneol=native#text/plain src/mame/includes/slapstic.h svneol=native#text/plain src/mame/includes/snes.h svneol=native#text/plain @@ -2878,6 +2878,7 @@ src/mame/video/lordgun.c svneol=native#text/plain src/mame/video/lsasquad.c svneol=native#text/plain src/mame/video/lvcards.c svneol=native#text/plain src/mame/video/lwings.c svneol=native#text/plain +src/mame/video/m10.c svneol=native#text/plain src/mame/video/m107.c svneol=native#text/plain src/mame/video/m3raster.c svneol=native#text/plain src/mame/video/m52.c svneol=native#text/plain @@ -3078,7 +3079,6 @@ src/mame/video/silkroad.c svneol=native#text/plain src/mame/video/simpl156.c svneol=native#text/plain src/mame/video/simpsons.c svneol=native#text/plain src/mame/video/skullxbo.c svneol=native#text/plain -src/mame/video/skychut.c svneol=native#text/plain src/mame/video/skydiver.c svneol=native#text/plain src/mame/video/skyfox.c svneol=native#text/plain src/mame/video/skykid.c svneol=native#text/plain diff --git a/src/mame/drivers/cherrym.c b/src/mame/drivers/cherrym.c index 5f3c03f24c8..5bad4d39b32 100644 --- a/src/mame/drivers/cherrym.c +++ b/src/mame/drivers/cherrym.c @@ -89,7 +89,7 @@ static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const re int flipy = attr & 0x20; drawgfx(bitmap, machine->gfx[1], code, color, flipx, flipy, sx, sy, - cliprect, TRANSPARENCY_COLOR, 0); + cliprect, TRANSPARENCY_PEN, 0); } } } diff --git a/src/mame/drivers/exctsccr.c b/src/mame/drivers/exctsccr.c index 3d658e2c913..6c354eeda7f 100644 --- a/src/mame/drivers/exctsccr.c +++ b/src/mame/drivers/exctsccr.c @@ -364,8 +364,8 @@ static const gfx_layout spritelayout = }; static GFXDECODE_START( exctsccr ) - GFXDECODE_ENTRY( REGION_GFX1, 0x0000, charlayout1, 0, 32 ) /* chars */ - GFXDECODE_ENTRY( REGION_GFX1, 0x2000, charlayout2, 0, 32 ) /* chars */ + GFXDECODE_ENTRY( REGION_GFX1, 0x0000, charlayout1, 0, 16 ) /* chars */ + GFXDECODE_ENTRY( REGION_GFX1, 0x2000, charlayout2, 0, 16 ) /* chars */ GFXDECODE_ENTRY( REGION_GFX1, 0x1000, spritelayout1, 16*8, 32 ) /* sprites */ GFXDECODE_ENTRY( REGION_GFX1, 0x3000, spritelayout2, 16*8, 32 ) /* sprites */ GFXDECODE_ENTRY( REGION_GFX2, 0x0000, spritelayout, 16*8, 32 ) /* sprites */ @@ -406,8 +406,7 @@ static MACHINE_DRIVER_START( exctsccr ) MDRV_SCREEN_SIZE(32*8, 32*8) MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) MDRV_GFXDECODE(exctsccr) - MDRV_PALETTE_LENGTH(32) - MDRV_COLORTABLE_LENGTH(64*8) + MDRV_PALETTE_LENGTH(48*8) MDRV_PALETTE_INIT(exctsccr) MDRV_VIDEO_START(exctsccr) @@ -455,8 +454,7 @@ static MACHINE_DRIVER_START( exctsccb ) MDRV_SCREEN_SIZE(32*8, 32*8) MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) MDRV_GFXDECODE(exctsccr) - MDRV_PALETTE_LENGTH(32) - MDRV_COLORTABLE_LENGTH(64*8) + MDRV_PALETTE_LENGTH(48*8) MDRV_PALETTE_INIT(exctsccr) MDRV_VIDEO_START(exctsccr) diff --git a/src/mame/drivers/exedexes.c b/src/mame/drivers/exedexes.c index 3d380e5b0c7..4c7b4b83719 100644 --- a/src/mame/drivers/exedexes.c +++ b/src/mame/drivers/exedexes.c @@ -241,8 +241,7 @@ static MACHINE_DRIVER_START( exedexes ) MDRV_SCREEN_SIZE(32*8, 32*8) MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) MDRV_GFXDECODE(exedexes) - MDRV_PALETTE_LENGTH(256) - MDRV_COLORTABLE_LENGTH(64*4+64*4+16*16+16*16) + MDRV_PALETTE_LENGTH(64*4+64*4+16*16+16*16) MDRV_PALETTE_INIT(exedexes) MDRV_VIDEO_START(exedexes) diff --git a/src/mame/drivers/gberet.c b/src/mame/drivers/gberet.c index 57ceae2d594..af9086642ab 100644 --- a/src/mame/drivers/gberet.c +++ b/src/mame/drivers/gberet.c @@ -563,8 +563,7 @@ static MACHINE_DRIVER_START( gberet ) MDRV_SCREEN_SIZE(32*8, 32*8) MDRV_SCREEN_VISIBLE_AREA(1*8, 31*8-1, 2*8, 30*8-1) MDRV_GFXDECODE(gberet) - MDRV_PALETTE_LENGTH(32) - MDRV_COLORTABLE_LENGTH(2*16*16) + MDRV_PALETTE_LENGTH(2*16*16) MDRV_PALETTE_INIT(gberet) MDRV_VIDEO_START(gberet) @@ -625,8 +624,8 @@ ROM_START( gberet ) ROM_REGION( 0x0220, REGION_PROMS, 0 ) ROM_LOAD( "577h09.2f", 0x0000, 0x0020, CRC(c15e7c80) SHA1(c0e8a01e63ed8cf20b33456b68890313b387ad23) ) // palette - ROM_LOAD( "577h10.5f", 0x0020, 0x0100, CRC(e9de1e53) SHA1(406b8dfe54e6176082005cc5545e79c098672547) ) // sprites - ROM_LOAD( "577h11.6f", 0x0120, 0x0100, CRC(2a1a992b) SHA1(77cff7c9c8433f999a87776021935864cf9dccb4) ) // characters + ROM_LOAD( "577h11.6f", 0x0020, 0x0100, CRC(2a1a992b) SHA1(77cff7c9c8433f999a87776021935864cf9dccb4) ) // characters + ROM_LOAD( "577h10.5f", 0x0120, 0x0100, CRC(e9de1e53) SHA1(406b8dfe54e6176082005cc5545e79c098672547) ) // sprites ROM_END ROM_START( rushatck ) @@ -646,8 +645,8 @@ ROM_START( rushatck ) ROM_REGION( 0x0220, REGION_PROMS, 0 ) ROM_LOAD( "577h09.2f", 0x0000, 0x0020, CRC(c15e7c80) SHA1(c0e8a01e63ed8cf20b33456b68890313b387ad23) ) // palette - ROM_LOAD( "577h10.5f", 0x0020, 0x0100, CRC(e9de1e53) SHA1(406b8dfe54e6176082005cc5545e79c098672547) ) // sprites - ROM_LOAD( "577h11.6f", 0x0120, 0x0100, CRC(2a1a992b) SHA1(77cff7c9c8433f999a87776021935864cf9dccb4) ) // characters + ROM_LOAD( "577h11.6f", 0x0020, 0x0100, CRC(2a1a992b) SHA1(77cff7c9c8433f999a87776021935864cf9dccb4) ) // characters + ROM_LOAD( "577h10.5f", 0x0120, 0x0100, CRC(e9de1e53) SHA1(406b8dfe54e6176082005cc5545e79c098672547) ) // sprites ROM_END ROM_START( gberetb ) @@ -666,8 +665,8 @@ ROM_START( gberetb ) ROM_REGION( 0x0220, REGION_PROMS, 0 ) ROM_LOAD( "577h09", 0x0000, 0x0020, CRC(c15e7c80) SHA1(c0e8a01e63ed8cf20b33456b68890313b387ad23) ) // palette - ROM_LOAD( "577h10", 0x0020, 0x0100, CRC(e9de1e53) SHA1(406b8dfe54e6176082005cc5545e79c098672547) ) // sprites - ROM_LOAD( "577h11", 0x0120, 0x0100, CRC(2a1a992b) SHA1(77cff7c9c8433f999a87776021935864cf9dccb4) ) // characters + ROM_LOAD( "577h11.6f", 0x0020, 0x0100, CRC(2a1a992b) SHA1(77cff7c9c8433f999a87776021935864cf9dccb4) ) // characters + ROM_LOAD( "577h10.5f", 0x0120, 0x0100, CRC(e9de1e53) SHA1(406b8dfe54e6176082005cc5545e79c098672547) ) // sprites ROM_END ROM_START( mrgoemon ) @@ -685,8 +684,8 @@ ROM_START( mrgoemon ) ROM_REGION( 0x0220, REGION_PROMS, 0 ) ROM_LOAD( "621a06.5f", 0x0000, 0x0020, CRC(7c90de5f) SHA1(8ac5708e72e32f3d79ccde0cbaedefc34f8ac57e) ) // palette - ROM_LOAD( "621a07.6f", 0x0020, 0x0100, CRC(3980acdc) SHA1(f4e0bd74bccd77b84096c38bc70cf488a42d9562) ) // sprites - ROM_LOAD( "621a08.7f", 0x0120, 0x0100, CRC(2fb244dd) SHA1(ceb909ad96c0dabc8684e69b028f4287e227c351) ) // characters + ROM_LOAD( "621a08.7f", 0x0020, 0x0100, CRC(2fb244dd) SHA1(ceb909ad96c0dabc8684e69b028f4287e227c351) ) // characters + ROM_LOAD( "621a07.6f", 0x0120, 0x0100, CRC(3980acdc) SHA1(f4e0bd74bccd77b84096c38bc70cf488a42d9562) ) // sprites ROM_END /* Game Drivers */ diff --git a/src/mame/drivers/gunsmoke.c b/src/mame/drivers/gunsmoke.c index f971835a056..9d402b1d493 100644 --- a/src/mame/drivers/gunsmoke.c +++ b/src/mame/drivers/gunsmoke.c @@ -303,8 +303,7 @@ static MACHINE_DRIVER_START( gunsmoke ) MDRV_SCREEN_SIZE(32*8, 32*8) MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) MDRV_GFXDECODE(gunsmoke) - MDRV_PALETTE_LENGTH(256) - MDRV_COLORTABLE_LENGTH(32*4+16*16+16*16) + MDRV_PALETTE_LENGTH(32*4+16*16+16*16) MDRV_PALETTE_INIT(gunsmoke) MDRV_VIDEO_START(gunsmoke) diff --git a/src/mame/drivers/skychut.c b/src/mame/drivers/m10.c similarity index 82% rename from src/mame/drivers/skychut.c rename to src/mame/drivers/m10.c index 56a5ba55312..09c8f0df124 100644 --- a/src/mame/drivers/skychut.c +++ b/src/mame/drivers/m10.c @@ -1,9 +1,8 @@ /*************************************************************************** - IPM Invader (M10 m10 hardware) - Sky Chuter By IREM - Space Beam (M15 m15 hardware) - Green Beret (?M15 ?m15 hardware) + Irem M10/M11/M15 hardware + +**************************************************************************** (c) 12/2/1998 Lee Taylor @@ -104,8 +103,8 @@ Notes (couriersud) #include "driver.h" #include "deprecat.h" #include "sound/samples.h" +#include "m10.h" -#include "skychut.h" /************************************* * @@ -121,29 +120,26 @@ Notes (couriersud) * *************************************/ -static PALETTE_INIT( skychut ) +static PALETTE_INIT( m10 ) { int i; - palette_set_color(machine,0,MAKE_RGB(0xff,0xff,0xff)); - palette_set_color(machine,1,MAKE_RGB(0xff,0xff,0x00)); - palette_set_color(machine,2,MAKE_RGB(0xff,0x00,0xff)); - palette_set_color(machine,3,MAKE_RGB(0xff,0x00,0x00)); - palette_set_color(machine,4,MAKE_RGB(0x00,0xff,0xff)); - palette_set_color(machine,5,MAKE_RGB(0x00,0xff,0x00)); - palette_set_color(machine,6,MAKE_RGB(0x00,0x00,0xff)); - palette_set_color(machine,7,MAKE_RGB(0x00,0x00,0x00)); - - for (i = 0;i < 8;i++) + for (i = 0; i < 0x10; i++) { - colortable[2*i+0] = 7; - colortable[2*i+1] = i; + rgb_t color; + + if (i & 0x01) + color = MAKE_RGB(pal1bit(~i >> 3), pal1bit(~i >> 2), pal1bit(~i >> 1)); + else + color = RGB_BLACK; + + palette_set_color(machine, i, color); } } static MACHINE_RESET( irem ) { - irem_state *state = Machine->driver_data; + m10_state *state = Machine->driver_data; state_save_register_global(state->bottomline); state_save_register_global(state->flip); @@ -174,9 +170,9 @@ static MACHINE_RESET( irem ) * 0x06: SAUCER HIT */ -static WRITE8_HANDLER( iremm10_ctrl_w ) +static WRITE8_HANDLER( m10_ctrl_w ) { - irem_state *state = Machine->driver_data; + m10_state *state = Machine->driver_data; #if DEBUG if (data & 0x40) @@ -251,9 +247,9 @@ static WRITE8_HANDLER( iremm10_ctrl_w ) * Will be updated only in attract mode */ -static WRITE8_HANDLER( iremm11_ctrl_w ) +static WRITE8_HANDLER( m11_ctrl_w ) { - irem_state *state = Machine->driver_data; + m10_state *state = Machine->driver_data; #if DEBUG if (data & 0x4C) @@ -284,9 +280,9 @@ static WRITE8_HANDLER( iremm11_ctrl_w ) * Will be updated only in attract mode */ -static WRITE8_HANDLER( iremm15_ctrl_w ) +static WRITE8_HANDLER( m15_ctrl_w ) { - irem_state *state = Machine->driver_data; + m10_state *state = Machine->driver_data; #if DEBUG if (data & 0xF0) @@ -312,7 +308,7 @@ static WRITE8_HANDLER( iremm15_ctrl_w ) * Will be updated only in attract mode */ -static WRITE8_HANDLER( iremm10_a500_w ) +static WRITE8_HANDLER( m10_a500_w ) { #if DEBUG if (data & 0xFC) @@ -320,7 +316,7 @@ static WRITE8_HANDLER( iremm10_a500_w ) #endif } -static WRITE8_HANDLER( iremm11_a100_w ) +static WRITE8_HANDLER( m11_a100_w ) { static int last = 0x00; int raising_bits = data & ~last; @@ -354,7 +350,7 @@ static WRITE8_HANDLER( iremm11_a100_w ) } -static WRITE8_HANDLER( iremm15_a100_w ) +static WRITE8_HANDLER( m15_a100_w ) { static int last = 0x00; //int raising_bits = data & ~last; @@ -412,14 +408,14 @@ static WRITE8_HANDLER( iremm15_a100_w ) last = data; } -static READ8_HANDLER( iremm10_a700_r ) +static READ8_HANDLER( m10_a700_r ) { //printf("rd:%d\n",video_screen_get_vpos(0)); cpunum_set_input_line(Machine, 0, 0, CLEAR_LINE); return 0x00; } -static READ8_HANDLER( iremm11_a700_r ) +static READ8_HANDLER( m11_a700_r ) { //printf("rd:%d\n",video_screen_get_vpos(0)); return 0x00; @@ -431,35 +427,35 @@ static READ8_HANDLER( iremm11_a700_r ) * *************************************/ -static TIMER_CALLBACK( skychut_callback ) +static TIMER_CALLBACK( interrupt_callback ) { if (param==0) { cpunum_set_input_line(machine, 0, 0, ASSERT_LINE); - timer_set(video_screen_get_time_until_pos(0, IREMM10_VBSTART+16, 0), NULL, 1,skychut_callback); + timer_set(video_screen_get_time_until_pos(0, IREMM10_VBSTART+16, 0), NULL, 1,interrupt_callback); } if (param==1) { cpunum_set_input_line(machine, 0, 0, ASSERT_LINE); - timer_set(video_screen_get_time_until_pos(0, IREMM10_VBSTART+24, 0), NULL, 2,skychut_callback); + timer_set(video_screen_get_time_until_pos(0, IREMM10_VBSTART+24, 0), NULL, 2,interrupt_callback); } if (param==-1) cpunum_set_input_line(machine, 0, 0, CLEAR_LINE); } -static INTERRUPT_GEN( iremm11_interrupt ) +static INTERRUPT_GEN( m11_interrupt ) { if (readinputport(2) & 1) /* Left Coin */ cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE); else { cpunum_set_input_line(machine, 0, 0, ASSERT_LINE); - timer_set(video_screen_get_time_until_pos(0, IREMM10_VBEND, 0), NULL, -1,skychut_callback); + timer_set(video_screen_get_time_until_pos(0, IREMM10_VBEND, 0), NULL, -1,interrupt_callback); } } -static INTERRUPT_GEN( iremm10_interrupt ) +static INTERRUPT_GEN( m10_interrupt ) { if (readinputport(2) & 1) /* Left Coin */ cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE); @@ -467,14 +463,14 @@ static INTERRUPT_GEN( iremm10_interrupt ) cpunum_set_input_line(machine, 0, 0, ASSERT_LINE); } -static INTERRUPT_GEN( iremm15_interrupt ) +static INTERRUPT_GEN( m15_interrupt ) { if (readinputport(2) & 1) /* Left Coin */ cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE); else { cpunum_set_input_line(machine, 0, 0, ASSERT_LINE); - timer_set(video_screen_get_time_until_pos(0, IREMM10_VBSTART+1, 80), NULL, -1,skychut_callback); + timer_set(video_screen_get_time_until_pos(0, IREMM10_VBSTART+1, 80), NULL, -1,interrupt_callback); } } @@ -484,45 +480,45 @@ static INTERRUPT_GEN( iremm15_interrupt ) * *************************************/ -static ADDRESS_MAP_START( iremm10_main, ADDRESS_SPACE_PROGRAM, 8 ) - AM_RANGE(0x0000, 0x02ff) AM_RAM AM_BASE_MEMBER(irem_state, memory) /* scratch ram */ - AM_RANGE(0x1000, 0x2fff) AM_READ(MRA8_ROM) AM_BASE_MEMBER(irem_state, rom) +static ADDRESS_MAP_START( m10_main, ADDRESS_SPACE_PROGRAM, 8 ) + AM_RANGE(0x0000, 0x02ff) AM_RAM AM_BASE_MEMBER(m10_state, memory) /* scratch ram */ + AM_RANGE(0x1000, 0x2fff) AM_READ(MRA8_ROM) AM_BASE_MEMBER(m10_state, rom) AM_RANGE(0x4000, 0x43ff) AM_RAM AM_BASE(&videoram) AM_SIZE(&videoram_size) - AM_RANGE(0x4800, 0x4bff) AM_READWRITE(MRA8_RAM, skychut_colorram_w) AM_BASE(&colorram) /* foreground colour */ - AM_RANGE(0x5000, 0x53ff) AM_RAM AM_BASE_MEMBER(irem_state, chargen) /* background ????? */ + AM_RANGE(0x4800, 0x4bff) AM_READWRITE(MRA8_RAM, m10_colorram_w) AM_BASE(&colorram) /* foreground colour */ + AM_RANGE(0x5000, 0x53ff) AM_RAM AM_BASE_MEMBER(m10_state, chargen) /* background ????? */ AM_RANGE(0xa200, 0xa200) AM_READ(input_port_1_r) AM_RANGE(0xa300, 0xa300) AM_READ(input_port_0_r) - AM_RANGE(0xa400, 0xa400) AM_WRITE(iremm10_ctrl_w) /* line at bottom of screen?, sound, flip screen */ - AM_RANGE(0xa500, 0xa500) AM_WRITE(iremm10_a500_w) /* ??? */ - AM_RANGE(0xa700, 0xa700) AM_READ(iremm10_a700_r) + AM_RANGE(0xa400, 0xa400) AM_WRITE(m10_ctrl_w) /* line at bottom of screen?, sound, flip screen */ + AM_RANGE(0xa500, 0xa500) AM_WRITE(m10_a500_w) /* ??? */ + AM_RANGE(0xa700, 0xa700) AM_READ(m10_a700_r) AM_RANGE(0xfc00, 0xffff) AM_READ(MRA8_ROM) /* for the reset / interrupt vectors */ ADDRESS_MAP_END -static ADDRESS_MAP_START( iremm11_main, ADDRESS_SPACE_PROGRAM, 8 ) - AM_RANGE(0x0000, 0x02ff) AM_RAM AM_BASE_MEMBER(irem_state, memory) /* scratch ram */ - AM_RANGE(0x1000, 0x2fff) AM_READ(MRA8_ROM) AM_BASE_MEMBER(irem_state, rom) +static ADDRESS_MAP_START( m11_main, ADDRESS_SPACE_PROGRAM, 8 ) + AM_RANGE(0x0000, 0x02ff) AM_RAM AM_BASE_MEMBER(m10_state, memory) /* scratch ram */ + AM_RANGE(0x1000, 0x2fff) AM_READ(MRA8_ROM) AM_BASE_MEMBER(m10_state, rom) AM_RANGE(0x4000, 0x43ff) AM_RAM AM_BASE(&videoram) AM_SIZE(&videoram_size) - AM_RANGE(0x4800, 0x4bff) AM_READWRITE(MRA8_RAM, skychut_colorram_w) AM_BASE(&colorram) /* foreground colour */ - AM_RANGE(0x5000, 0x53ff) AM_RAM AM_BASE_MEMBER(irem_state, chargen) /* background ????? */ - AM_RANGE(0xa100, 0xa100) AM_WRITE(iremm11_a100_w) /* sound writes ???? */ + AM_RANGE(0x4800, 0x4bff) AM_READWRITE(MRA8_RAM, m10_colorram_w) AM_BASE(&colorram) /* foreground colour */ + AM_RANGE(0x5000, 0x53ff) AM_RAM AM_BASE_MEMBER(m10_state, chargen) /* background ????? */ + AM_RANGE(0xa100, 0xa100) AM_WRITE(m11_a100_w) /* sound writes ???? */ AM_RANGE(0xa200, 0xa200) AM_READ(input_port_1_r) AM_RANGE(0xa300, 0xa300) AM_READ(input_port_0_r) - AM_RANGE(0xa400, 0xa400) AM_WRITE(iremm11_ctrl_w) /* line at bottom of screen?, sound, flip screen */ - AM_RANGE(0xa700, 0xa700) AM_READ(iremm11_a700_r) + AM_RANGE(0xa400, 0xa400) AM_WRITE(m11_ctrl_w) /* line at bottom of screen?, sound, flip screen */ + AM_RANGE(0xa700, 0xa700) AM_READ(m11_a700_r) AM_RANGE(0xfc00, 0xffff) AM_READ(MRA8_ROM) /* for the reset / interrupt vectors */ ADDRESS_MAP_END -static ADDRESS_MAP_START( iremm15_main, ADDRESS_SPACE_PROGRAM, 8 ) - AM_RANGE(0x0000, 0x02ff) AM_RAM AM_BASE_MEMBER(irem_state, memory) /* scratch ram */ - AM_RANGE(0x1000, 0x33ff) AM_READ(MRA8_ROM) AM_BASE_MEMBER(irem_state, rom) +static ADDRESS_MAP_START( m15_main, ADDRESS_SPACE_PROGRAM, 8 ) + AM_RANGE(0x0000, 0x02ff) AM_RAM AM_BASE_MEMBER(m10_state, memory) /* scratch ram */ + AM_RANGE(0x1000, 0x33ff) AM_READ(MRA8_ROM) AM_BASE_MEMBER(m10_state, rom) AM_RANGE(0x4000, 0x43ff) AM_RAM AM_BASE(&videoram) AM_SIZE(&videoram_size) - AM_RANGE(0x4800, 0x4bff) AM_READWRITE(MRA8_RAM, skychut_colorram_w) AM_BASE(&colorram) /* foreground colour */ - AM_RANGE(0x5000, 0x57ff) AM_READWRITE(MRA8_RAM, iremm15_chargen_w) AM_BASE_MEMBER(irem_state, chargen) /* background ????? */ + AM_RANGE(0x4800, 0x4bff) AM_READWRITE(MRA8_RAM, m10_colorram_w) AM_BASE(&colorram) /* foreground colour */ + AM_RANGE(0x5000, 0x57ff) AM_READWRITE(MRA8_RAM, m15_chargen_w) AM_BASE_MEMBER(m10_state, chargen) /* background ????? */ AM_RANGE(0xa000, 0xa000) AM_READ(input_port_3_r) - AM_RANGE(0xa100, 0xa100) AM_WRITE(iremm15_a100_w) /* sound writes ???? */ + AM_RANGE(0xa100, 0xa100) AM_WRITE(m15_a100_w) /* sound writes ???? */ AM_RANGE(0xa200, 0xa200) AM_READ(input_port_1_r) AM_RANGE(0xa300, 0xa300) AM_READ(input_port_0_r) - AM_RANGE(0xa400, 0xa400) AM_WRITE(iremm15_ctrl_w) /* sound, flip screen */ + AM_RANGE(0xa400, 0xa400) AM_WRITE(m15_ctrl_w) /* sound, flip screen */ AM_RANGE(0xfc00, 0xffff) AM_READ(MRA8_ROM) /* for the reset / interrupt vectors */ ADDRESS_MAP_END @@ -626,7 +622,7 @@ static INPUT_PORTS_START( ipminvad ) CAB_PORTENV INPUT_PORTS_END -static INPUT_PORTS_START( spacebeam ) +static INPUT_PORTS_START( spacbeam ) PORT_START PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1 ) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START2 ) @@ -717,7 +713,7 @@ static const gfx_layout charlayout = }; -static GFXDECODE_START( skychut ) +static GFXDECODE_START( m10 ) GFXDECODE_ENTRY( REGION_GFX1, 0x0000, charlayout, 0, 8 ) GFXDECODE_END @@ -727,7 +723,7 @@ GFXDECODE_END * *************************************/ -static const char *iremm10_sample_names[] = +static const char *m10_sample_names[] = { "*ipminvad", "1.wav", /* shot/missle */ @@ -744,10 +740,10 @@ static const char *iremm10_sample_names[] = }; -static struct Samplesinterface iremm10_samples_interface = +static struct Samplesinterface m10_samples_interface = { 6, /* 6 channels */ - iremm10_sample_names + m10_sample_names }; /************************************* @@ -756,106 +752,100 @@ static struct Samplesinterface iremm10_samples_interface = * *************************************/ -static MACHINE_DRIVER_START( iremm10 ) +static MACHINE_DRIVER_START( m10 ) - MDRV_DRIVER_DATA(irem_state) + MDRV_DRIVER_DATA(m10_state) /* basic machine hardware */ - MDRV_CPU_ADD_TAG("Main", M6502,IREMM10_CPU_CLOCK) - MDRV_CPU_PROGRAM_MAP(iremm10_main,0) + MDRV_CPU_ADD_TAG("main", M6502,IREMM10_CPU_CLOCK) + MDRV_CPU_PROGRAM_MAP(m10_main,0) MDRV_MACHINE_RESET(irem) - MDRV_CPU_VBLANK_INT(iremm10_interrupt,1) + MDRV_CPU_VBLANK_INT(m10_interrupt,1) MDRV_SCREEN_RAW_PARAMS(IREMM10_PIXEL_CLOCK, IREMM10_HTOTAL, IREMM10_HBEND, IREMM10_HBSTART, IREMM10_VTOTAL, IREMM10_VBEND, IREMM10_VBSTART) /* video hardware */ MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) - MDRV_GFXDECODE(skychut) - MDRV_PALETTE_LENGTH(8) - MDRV_COLORTABLE_LENGTH(2*8) + MDRV_GFXDECODE(m10) + MDRV_PALETTE_LENGTH(2*8) - MDRV_PALETTE_INIT(skychut) - MDRV_VIDEO_START(iremm10) - MDRV_VIDEO_UPDATE(iremm10) + MDRV_PALETTE_INIT(m10) + MDRV_VIDEO_START(m10) + MDRV_VIDEO_UPDATE(m10) /* sound hardware */ MDRV_SPEAKER_STANDARD_MONO("mono") MDRV_SOUND_ADD(SAMPLES, 0) - MDRV_SOUND_CONFIG(iremm10_samples_interface) + MDRV_SOUND_CONFIG(m10_samples_interface) MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) MACHINE_DRIVER_END -static MACHINE_DRIVER_START( iremm11 ) +static MACHINE_DRIVER_START( m11 ) - MDRV_DRIVER_DATA(irem_state) + MDRV_DRIVER_DATA(m10_state) /* basic machine hardware */ - MDRV_IMPORT_FROM(iremm10) - MDRV_CPU_REPLACE("Main", M6502,IREMM10_CPU_CLOCK / 2) - //MDRV_CPU_MODIFY("Main") - MDRV_CPU_PROGRAM_MAP(iremm11_main,0) - MDRV_CPU_VBLANK_INT(iremm11_interrupt,1) + MDRV_IMPORT_FROM(m10) + MDRV_CPU_REPLACE("main", M6502,IREMM10_CPU_CLOCK / 2) + //MDRV_CPU_MODIFY("main") + MDRV_CPU_PROGRAM_MAP(m11_main,0) + MDRV_CPU_VBLANK_INT(m11_interrupt,1) /* sound hardware */ MACHINE_DRIVER_END -static MACHINE_DRIVER_START( greenberet ) +static MACHINE_DRIVER_START( m15 ) - MDRV_DRIVER_DATA(irem_state) + MDRV_DRIVER_DATA(m10_state) /* basic machine hardware */ MDRV_CPU_ADD_TAG("main", M6502,IREMM15_CPU_CLOCK) - MDRV_CPU_PROGRAM_MAP(iremm15_main,0) + MDRV_CPU_PROGRAM_MAP(m15_main,0) MDRV_MACHINE_RESET(irem) - MDRV_CPU_VBLANK_INT(iremm15_interrupt,1) + MDRV_CPU_VBLANK_INT(m15_interrupt,1) MDRV_SCREEN_RAW_PARAMS(IREMM15_PIXEL_CLOCK, IREMM15_HTOTAL, IREMM15_HBEND, IREMM15_HBSTART, IREMM15_VTOTAL, IREMM15_VBEND, IREMM15_VBSTART) /* video hardware */ MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) - MDRV_PALETTE_LENGTH(8) - MDRV_COLORTABLE_LENGTH(2*8) + MDRV_PALETTE_LENGTH(2*8) - MDRV_PALETTE_INIT(skychut) - MDRV_VIDEO_START( iremm15 ) - MDRV_VIDEO_UPDATE(iremm15) + MDRV_PALETTE_INIT(m10) + MDRV_VIDEO_START( m15 ) + MDRV_VIDEO_UPDATE(m15) /* sound hardware */ MDRV_SPEAKER_STANDARD_MONO("mono") MDRV_SOUND_ADD(SAMPLES, 0) - MDRV_SOUND_CONFIG(iremm10_samples_interface) + MDRV_SOUND_CONFIG(m10_samples_interface) MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) MACHINE_DRIVER_END static MACHINE_DRIVER_START( headoni ) - MDRV_IMPORT_FROM(greenberet) + MDRV_IMPORT_FROM(m15) MDRV_CPU_REPLACE("main", M6502,11730000/16) MACHINE_DRIVER_END static DRIVER_INIT( andromed ) { int i; - irem_state *state = machine->driver_data; + m10_state *state = machine->driver_data; for (i=0x1c00;i<0x2000;i++) state->rom[i]=0x60; } -static DRIVER_INIT( iremm15 ) -{ -} - /*************************************************************************** @@ -949,9 +939,9 @@ ROM_START( greenber ) ROM_LOAD( "gb9", 0x3000, 0x0400, CRC(c27b9ba3) SHA1(a2f4f0c4b61eb03bba13ae5d25dc01009a4f86ee) ) // ok ? ROM_END -GAME( 1979, andromed, 0, iremm11, skychut, andromed, ROT270, "Irem", "Andromeda (Japan?)", GAME_NO_COCKTAIL | GAME_NO_SOUND | GAME_IMPERFECT_COLORS | GAME_NOT_WORKING ) -GAME( 1979?,ipminvad, 0, iremm10, ipminvad, 0, ROT270, "Irem", "IPM Invader", GAME_NO_COCKTAIL | GAME_IMPERFECT_COLORS ) -GAME( 1980, skychut, 0, iremm11, skychut, 0, ROT270, "Irem", "Sky Chuter", GAME_NO_COCKTAIL | GAME_NO_SOUND | GAME_IMPERFECT_COLORS ) -GAME( 1979, spacbeam, 0, greenberet, spacebeam, iremm15, ROT270, "Irem", "Space Beam", GAME_NO_COCKTAIL | GAME_NO_SOUND | GAME_IMPERFECT_COLORS ) -GAME( 1979?,headoni, 0, headoni, headoni, iremm15, ROT270, "Irem", "Head On (Irem, M-15 Hardware)", GAME_NO_COCKTAIL | GAME_NO_SOUND | GAME_IMPERFECT_COLORS ) -GAME( 1980, greenber, 0, greenberet, spacebeam, iremm15, ROT270, "Irem", "Green Beret (Irem)", GAME_NO_COCKTAIL | GAME_NO_SOUND | GAME_IMPERFECT_COLORS | GAME_NOT_WORKING ) +GAME( 1979, andromed, 0, m11, skychut, andromed, ROT270, "Irem", "Andromeda (Japan?)", GAME_NO_COCKTAIL | GAME_NO_SOUND | GAME_IMPERFECT_COLORS | GAME_NOT_WORKING ) +GAME( 1979?,ipminvad, 0, m10, ipminvad, 0, ROT270, "Irem", "I P M Invader", GAME_NO_COCKTAIL | GAME_IMPERFECT_COLORS ) +GAME( 1980, skychut, 0, m11, skychut, 0, ROT270, "Irem", "Sky Chuter", GAME_NO_COCKTAIL | GAME_NO_SOUND | GAME_IMPERFECT_COLORS ) +GAME( 1979, spacbeam, 0, m15, spacbeam, 0, ROT270, "Irem", "Space Beam", GAME_NO_COCKTAIL | GAME_NO_SOUND | GAME_IMPERFECT_COLORS ) +GAME( 1979?,headoni, 0, headoni, headoni, 0, ROT270, "Irem", "Head On (Irem, M-15 Hardware)", GAME_NO_COCKTAIL | GAME_NO_SOUND | GAME_IMPERFECT_COLORS ) +GAME( 1980, greenber, 0, m15, spacbeam, 0, ROT270, "Irem", "Green Beret (Irem)", GAME_NO_COCKTAIL | GAME_NO_SOUND | GAME_IMPERFECT_COLORS | GAME_NOT_WORKING ) diff --git a/src/mame/drivers/panicr.c b/src/mame/drivers/panicr.c index 704c09b9940..47beba37bf0 100644 --- a/src/mame/drivers/panicr.c +++ b/src/mame/drivers/panicr.c @@ -71,35 +71,54 @@ static PALETTE_INIT( panicr ) { int i; + /* allocate the colortable */ + machine->colortable = colortable_alloc(machine, 0x100); - PALETTE_INIT_CALL(RRRR_GGGG_BBBB); - color_prom += 256*3; + /* create a lookup table for the palette */ + for (i = 0; i < 0x100; i++) + { + 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 now points to the beginning of the lookup table */ + color_prom += 0x300; // txt lookup table - for (i = 0;i < 256;i++) + for (i = 0; i < 0x100; i++) { - if (*color_prom & 0x40) - *(colortable++) = 0; + UINT8 ctabentry; + + if (color_prom[i] & 0x40) + ctabentry = 0; else - *(colortable++) = (*color_prom & 0x3f) + 0x80; - color_prom++; + ctabentry = (color_prom[i] & 0x3f) | 0x80; + + colortable_entry_set_value(machine->colortable, i, ctabentry); } // tile lookup table - for (i = 0;i < 256;i++) + for (i = 0x100; i < 0x200; i++) { - *(colortable++) = (*color_prom & 0x3f) + 0x00; - color_prom++; + UINT8 ctabentry = (color_prom[i] & 0x3f) | 0x00; + + colortable_entry_set_value(machine->colortable, i, ctabentry); } // sprite lookup table - for (i = 0;i < 256;i++) + for (i = 0x200; i < 0x300; i++) { - if (*color_prom & 0x40) - *(colortable++) = 0; + UINT8 ctabentry; + + if (color_prom[i] & 0x40) + ctabentry = 0; else - *(colortable++) = (*color_prom & 0x3f) + 0x40; - color_prom++; + ctabentry = (color_prom[i] & 0x3f) | 0x40; + + colortable_entry_set_value(machine->colortable, i, ctabentry); } } @@ -119,14 +138,16 @@ static TILE_GET_INFO( get_bgtile_info ) static TILE_GET_INFO( get_txttile_info ) { - int code,attr; + int code=videoram[tile_index*4]; + int attr=videoram[tile_index*4+2]; + int color = attr & 0x07; + + tileinfo->group = color; - code=videoram[tile_index*4]; - attr=videoram[tile_index*4+2]; SET_TILE_INFO( 0, code + ((attr & 8) << 5), - attr&7, + color, 0); } @@ -168,8 +189,9 @@ ADDRESS_MAP_END static VIDEO_START( panicr ) { bgtilemap = tilemap_create( get_bgtile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN,16,16,1024,16 ); - txttilemap = tilemap_create( get_txttile_info,tilemap_scan_rows,TILEMAP_TYPE_COLORTABLE,8,8,32,32 ); - tilemap_set_transparent_pen(txttilemap, 0); + + txttilemap = tilemap_create( get_txttile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN,8,8,32,32 ); + colortable_configure_tilemap_groups(machine->colortable, txttilemap, machine->gfx[0], 0); } static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect ) @@ -191,7 +213,8 @@ static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rec drawgfx(bitmap,machine->gfx[2], sprite, color,fx,fy,x,y, - cliprect,TRANSPARENCY_COLOR,0); + cliprect,TRANSPARENCY_PENS, + colortable_get_transpen_mask(machine->colortable, machine->gfx[2], color, 0)); } } @@ -348,8 +371,7 @@ static MACHINE_DRIVER_START( panicr ) MDRV_SCREEN_SIZE(32*8, 32*8) MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) MDRV_GFXDECODE(panicr) - MDRV_PALETTE_LENGTH(256) - MDRV_COLORTABLE_LENGTH(256*3) + MDRV_PALETTE_LENGTH(256*3) MDRV_PALETTE_INIT(panicr) MDRV_VIDEO_START(panicr) diff --git a/src/mame/drivers/retofinv.c b/src/mame/drivers/retofinv.c index fce00eb8c70..145ecd1ac06 100644 --- a/src/mame/drivers/retofinv.c +++ b/src/mame/drivers/retofinv.c @@ -356,8 +356,8 @@ static const gfx_layout spritelayout = static GFXDECODE_START( retofinv ) GFXDECODE_ENTRY( REGION_GFX1, 0, charlayout, 0, 256 ) - GFXDECODE_ENTRY( REGION_GFX2, 0, bglayout, 64*16+256*2, 64 ) - GFXDECODE_ENTRY( REGION_GFX3, 0, spritelayout, 256*2, 64 ) + GFXDECODE_ENTRY( REGION_GFX2, 0, spritelayout, 256*2, 64 ) + GFXDECODE_ENTRY( REGION_GFX3, 0, bglayout, 64*16+256*2, 64 ) GFXDECODE_END @@ -390,8 +390,7 @@ static MACHINE_DRIVER_START( retofinv ) MDRV_SCREEN_SIZE(36*8, 28*8) MDRV_SCREEN_VISIBLE_AREA(0*8, 36*8-1, 0*8, 28*8-1) MDRV_GFXDECODE(retofinv) - MDRV_PALETTE_LENGTH(256) - MDRV_COLORTABLE_LENGTH(256*2+64*16+64*16) + MDRV_PALETTE_LENGTH(256*2+64*16+64*16) MDRV_PALETTE_INIT(retofinv) MDRV_VIDEO_START(retofinv) @@ -442,16 +441,16 @@ ROM_START( retofinv ) ROM_REGION( 0x02000, REGION_GFX1, ROMREGION_DISPOSE ) ROM_LOAD( "a37-16.61", 0x0000, 0x2000, CRC(4e3f501c) SHA1(2d832f4038ae65bfdeedfab870f6f1176ec6b676) ) - ROM_REGION( 0x04000, REGION_GFX2, ROMREGION_DISPOSE ) - ROM_LOAD( "a37-14.55", 0x0000, 0x2000, CRC(ef7f8651) SHA1(2d91057501e5e9c4255e0d55fff0d99c2a5be7e8) ) - ROM_LOAD( "a37-15.56", 0x2000, 0x2000, CRC(03b40905) SHA1(c10d87796e8a6e6a2a37c6fb713821cc87299cc8) ) - - ROM_REGION( 0x08000, REGION_GFX3, ROMREGION_DISPOSE ) + ROM_REGION( 0x08000, REGION_GFX2, ROMREGION_DISPOSE ) ROM_LOAD( "a37-10.8", 0x0000, 0x2000, CRC(6afdeec8) SHA1(782fe0a8aea48c3c270318b7ba011fc6fce0db7a) ) ROM_LOAD( "a37-11.9", 0x2000, 0x2000, CRC(d3dc9da3) SHA1(0d98d6e993b5a4845a23802751023b7a593dce29) ) ROM_LOAD( "a37-12.10", 0x4000, 0x2000, CRC(d10b2eed) SHA1(3809a0adf935a119f9ee0d4c24f1456c35d2a6fa) ) ROM_LOAD( "a37-13.11", 0x6000, 0x2000, CRC(00ca6b3d) SHA1(08ce5b13d5ebc79cc803949f4ba9e630e6cd92b8) ) + ROM_REGION( 0x04000, REGION_GFX3, ROMREGION_DISPOSE ) + ROM_LOAD( "a37-14.55", 0x0000, 0x2000, CRC(ef7f8651) SHA1(2d91057501e5e9c4255e0d55fff0d99c2a5be7e8) ) + ROM_LOAD( "a37-15.56", 0x2000, 0x2000, CRC(03b40905) SHA1(c10d87796e8a6e6a2a37c6fb713821cc87299cc8) ) + ROM_REGION( 0x0b00, REGION_PROMS, 0 ) ROM_LOAD( "a37-06.13", 0x0000, 0x0100, CRC(e9643b8b) SHA1(7bbb92a42e7c3effb701fc7b2c24f2470f31b063) ) /* palette red bits */ ROM_LOAD( "a37-07.4", 0x0100, 0x0100, CRC(e8f34e11) SHA1(8f438561b8d46ffff00747ed8baf0ebb6a081615) ) /* palette green bits */ @@ -474,16 +473,16 @@ ROM_START( retofin1 ) ROM_REGION( 0x02000, REGION_GFX1, ROMREGION_DISPOSE ) ROM_LOAD( "a37-16.61", 0x0000, 0x2000, CRC(4e3f501c) SHA1(2d832f4038ae65bfdeedfab870f6f1176ec6b676) ) - ROM_REGION( 0x04000, REGION_GFX2, ROMREGION_DISPOSE ) - ROM_LOAD( "a37-14.55", 0x0000, 0x2000, CRC(ef7f8651) SHA1(2d91057501e5e9c4255e0d55fff0d99c2a5be7e8) ) - ROM_LOAD( "a37-15.56", 0x2000, 0x2000, CRC(03b40905) SHA1(c10d87796e8a6e6a2a37c6fb713821cc87299cc8) ) - - ROM_REGION( 0x08000, REGION_GFX3, ROMREGION_DISPOSE ) + ROM_REGION( 0x08000, REGION_GFX2, ROMREGION_DISPOSE ) ROM_LOAD( "a37-10.8", 0x0000, 0x2000, CRC(6afdeec8) SHA1(782fe0a8aea48c3c270318b7ba011fc6fce0db7a) ) ROM_LOAD( "a37-11.9", 0x2000, 0x2000, CRC(d3dc9da3) SHA1(0d98d6e993b5a4845a23802751023b7a593dce29) ) ROM_LOAD( "a37-12.10", 0x4000, 0x2000, CRC(d10b2eed) SHA1(3809a0adf935a119f9ee0d4c24f1456c35d2a6fa) ) ROM_LOAD( "a37-13.11", 0x6000, 0x2000, CRC(00ca6b3d) SHA1(08ce5b13d5ebc79cc803949f4ba9e630e6cd92b8) ) + ROM_REGION( 0x04000, REGION_GFX3, ROMREGION_DISPOSE ) + ROM_LOAD( "a37-14.55", 0x0000, 0x2000, CRC(ef7f8651) SHA1(2d91057501e5e9c4255e0d55fff0d99c2a5be7e8) ) + ROM_LOAD( "a37-15.56", 0x2000, 0x2000, CRC(03b40905) SHA1(c10d87796e8a6e6a2a37c6fb713821cc87299cc8) ) + ROM_REGION( 0x0b00, REGION_PROMS, 0 ) ROM_LOAD( "a37-06.13", 0x0000, 0x0100, CRC(e9643b8b) SHA1(7bbb92a42e7c3effb701fc7b2c24f2470f31b063) ) /* palette red bits */ ROM_LOAD( "a37-07.4", 0x0100, 0x0100, CRC(e8f34e11) SHA1(8f438561b8d46ffff00747ed8baf0ebb6a081615) ) /* palette green bits */ @@ -506,16 +505,16 @@ ROM_START( retofin2 ) ROM_REGION( 0x02000, REGION_GFX1, ROMREGION_DISPOSE ) ROM_LOAD( "a37-16.61", 0x0000, 0x2000, CRC(4e3f501c) SHA1(2d832f4038ae65bfdeedfab870f6f1176ec6b676) ) - ROM_REGION( 0x04000, REGION_GFX2, ROMREGION_DISPOSE ) - ROM_LOAD( "a37-14.55", 0x0000, 0x2000, CRC(ef7f8651) SHA1(2d91057501e5e9c4255e0d55fff0d99c2a5be7e8) ) - ROM_LOAD( "a37-15.56", 0x2000, 0x2000, CRC(03b40905) SHA1(c10d87796e8a6e6a2a37c6fb713821cc87299cc8) ) - - ROM_REGION( 0x08000, REGION_GFX3, ROMREGION_DISPOSE ) + ROM_REGION( 0x08000, REGION_GFX2, ROMREGION_DISPOSE ) ROM_LOAD( "a37-10.8", 0x0000, 0x2000, CRC(6afdeec8) SHA1(782fe0a8aea48c3c270318b7ba011fc6fce0db7a) ) ROM_LOAD( "a37-11.9", 0x2000, 0x2000, CRC(d3dc9da3) SHA1(0d98d6e993b5a4845a23802751023b7a593dce29) ) ROM_LOAD( "a37-12.10", 0x4000, 0x2000, CRC(d10b2eed) SHA1(3809a0adf935a119f9ee0d4c24f1456c35d2a6fa) ) ROM_LOAD( "a37-13.11", 0x6000, 0x2000, CRC(00ca6b3d) SHA1(08ce5b13d5ebc79cc803949f4ba9e630e6cd92b8) ) + ROM_REGION( 0x04000, REGION_GFX3, ROMREGION_DISPOSE ) + ROM_LOAD( "a37-14.55", 0x0000, 0x2000, CRC(ef7f8651) SHA1(2d91057501e5e9c4255e0d55fff0d99c2a5be7e8) ) + ROM_LOAD( "a37-15.56", 0x2000, 0x2000, CRC(03b40905) SHA1(c10d87796e8a6e6a2a37c6fb713821cc87299cc8) ) + ROM_REGION( 0x0b00, REGION_PROMS, 0 ) ROM_LOAD( "a37-06.13", 0x0000, 0x0100, CRC(e9643b8b) SHA1(7bbb92a42e7c3effb701fc7b2c24f2470f31b063) ) /* palette red bits */ ROM_LOAD( "a37-07.4", 0x0100, 0x0100, CRC(e8f34e11) SHA1(8f438561b8d46ffff00747ed8baf0ebb6a081615) ) /* palette green bits */ diff --git a/src/mame/drivers/sprcros2.c b/src/mame/drivers/sprcros2.c index d6db454d978..acf4f61a59c 100644 --- a/src/mame/drivers/sprcros2.c +++ b/src/mame/drivers/sprcros2.c @@ -322,8 +322,7 @@ static MACHINE_DRIVER_START( sprcros2 ) MDRV_SCREEN_SIZE(32*8, 32*8) MDRV_SCREEN_VISIBLE_AREA(1*8, 31*8-1, 2*8, 30*8-1) MDRV_GFXDECODE(sprcros2) - MDRV_PALETTE_LENGTH(18) - MDRV_COLORTABLE_LENGTH(768) + MDRV_PALETTE_LENGTH(768) MDRV_PALETTE_INIT(sprcros2) MDRV_VIDEO_START(sprcros2) @@ -415,5 +414,5 @@ ROM_START( sprcrs2a ) ROM_LOAD( "sc-60.4k", 0x0320, 0x0100, CRC(d7a4e57d) SHA1(6db02ec6aa55b05422cb505e63c71e36b4b11b4a) ) //fg clut ROM_END -GAME( 1986, sprcros2, 0, sprcros2, sprcros2, 0, ROT0, "GM Shoji", "Super Cross 2 (Japan set 1)", 0 ) -GAME( 1986, sprcrs2a, sprcros2, sprcros2, sprcros2, 0, ROT0, "GM Shoji", "Super Cross 2 (Japan set 2)", 0 ) +GAME( 1986, sprcros2, 0, sprcros2, sprcros2, 0, ROT0, "GM Shoji", "Super Cross II (Japan, set 1)", 0 ) +GAME( 1986, sprcrs2a, sprcros2, sprcros2, sprcros2, 0, ROT0, "GM Shoji", "Super Cross II (Japan, set 2)", 0 ) diff --git a/src/mame/drivers/stfight.c b/src/mame/drivers/stfight.c index 4cd3756b5da..7943a2f18c1 100644 --- a/src/mame/drivers/stfight.c +++ b/src/mame/drivers/stfight.c @@ -280,8 +280,8 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( writemem_cpu1, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_WRITE(MWA8_ROM) AM_RANGE(0x8000, 0xbfff) AM_WRITE(MWA8_BANK1) /* sf02.bin */ - AM_RANGE(0xc000, 0xc0ff) AM_WRITE(paletteram_xxxxBBBBRRRRGGGG_split1_w) AM_BASE(&paletteram) - AM_RANGE(0xc100, 0xc1ff) AM_WRITE(paletteram_xxxxBBBBRRRRGGGG_split2_w) AM_BASE(&paletteram_2) + AM_RANGE(0xc000, 0xc0ff) AM_WRITE(MWA8_RAM) AM_BASE(&paletteram) + AM_RANGE(0xc100, 0xc1ff) AM_WRITE(MWA8_RAM) AM_BASE(&paletteram_2) AM_RANGE(0xc500, 0xc500) AM_WRITE(stfight_fm_w) /* play fm sound */ AM_RANGE(0xc600, 0xc600) AM_WRITE(stfight_adpcm_control_w) /* voice control */ AM_RANGE(0xc700, 0xc700) AM_WRITE(stfight_coin_w) /* coin mech */ @@ -506,8 +506,7 @@ static MACHINE_DRIVER_START( stfight ) MDRV_SCREEN_SIZE(32*8, 32*8) MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) MDRV_GFXDECODE(stfight) - MDRV_PALETTE_LENGTH(256+1) - MDRV_COLORTABLE_LENGTH(16*4+16*16+16*16+16*16) + MDRV_PALETTE_LENGTH(16*4+16*16+16*16+16*16) MDRV_PALETTE_INIT(stfight) MDRV_VIDEO_START(stfight) diff --git a/src/mame/drivers/tceptor.c b/src/mame/drivers/tceptor.c index 930b55383c8..4b54c434965 100644 --- a/src/mame/drivers/tceptor.c +++ b/src/mame/drivers/tceptor.c @@ -462,8 +462,7 @@ static MACHINE_DRIVER_START( tceptor ) /* video hardware */ MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) MDRV_GFXDECODE(tceptor) - MDRV_PALETTE_LENGTH(1024) - MDRV_COLORTABLE_LENGTH(4096) + MDRV_PALETTE_LENGTH(4096) MDRV_DEFAULT_LAYOUT(layout_horizont) MDRV_SCREEN_ADD("2D", 0x000) @@ -543,11 +542,11 @@ ROM_START( tceptor ) ROM_LOAD( "tc1-20.10e", 0x00000, 0x08000, CRC(3e5054b7) SHA1(ed359f8659a4a46d5ff7299d0da10550b1496db8) ) ROM_LOAD( "tc1-19.10d", 0x08000, 0x04000, CRC(7406e6e7) SHA1(61ad77667e94fd7e11037da2721f7bbe0130286a) ) - ROM_REGION( 0X10000, REGION_GFX3, ROMREGION_DISPOSE ) // 16x16 sprites + ROM_REGION( 0x10000, REGION_GFX3, ROMREGION_DISPOSE ) // 16x16 sprites ROM_LOAD( "tc1-16.8t", 0x00000, 0x08000, CRC(7c72be33) SHA1(397e11727b86688d550c28fbdcb864bb9335d891) ) ROM_LOAD( "tc1-15.10t", 0x08000, 0x08000, CRC(51268075) SHA1(75b6b935c6721adbc984795b9bf0a791fb8b209e) ) - ROM_REGION( 0X80000, REGION_GFX4, ROMREGION_DISPOSE ) // 32x32 sprites + ROM_REGION( 0x80000, REGION_GFX4, ROMREGION_DISPOSE ) // 32x32 sprites ROM_LOAD( "tc1-8.8m", 0x00000, 0x10000, CRC(192a1f1f) SHA1(8424a6a19c080da0a83e173e33915f4d9326f379) ) ROM_LOAD( "tc1-10.8p", 0x10000, 0x08000, CRC(7876bcef) SHA1(09180b26d0eab51de18a13723f46d763541979fb) ) ROM_RELOAD( 0x18000, 0x08000 ) @@ -563,13 +562,13 @@ ROM_START( tceptor ) ROM_LOAD( "tc1-13.10s", 0x70000, 0x08000, CRC(e67cef29) SHA1(ba8559caf498bbc1d9278d74da03ee2d910f76d8) ) ROM_RELOAD( 0x78000, 0x08000 ) - ROM_REGION( 0x3600, REGION_PROMS, 0 ) + ROM_REGION( 0x3500, REGION_PROMS, 0 ) ROM_LOAD( "tc1-3.1k", 0x00000, 0x00400, CRC(fd2fcb57) SHA1(97d5b7527714acfd729b26ac56f0a9210982c551) ) // red components ROM_LOAD( "tc1-1.1h", 0x00400, 0x00400, CRC(0241cf67) SHA1(9b2b579425b72a5b1f2c632f53d1c1d172b4ed1e) ) // green components ROM_LOAD( "tc1-2.1j", 0x00800, 0x00400, CRC(ea9eb3da) SHA1(0d7cfceac57afc53a063d7fe67cfc9bda0a8dbc8) ) // blue components ROM_LOAD( "tc1-5.6a", 0x00c00, 0x00400, CRC(afa8eda8) SHA1(783efbcbf0bb7e4cf2e2618ddd0ef3b52a4518cc) ) // tiles color table - ROM_LOAD( "tc1-4.2e", 0x01000, 0x00100, CRC(a4e73d53) SHA1(df8231720e9b57cf2751f86ac3ed7433804f51ca) ) // road color table - ROM_LOAD( "tc1-6.7s", 0x01100, 0x00400, CRC(72707677) SHA1(122c1b619c9efa3b7055908dda3102ee28230504) ) // sprite color table + ROM_LOAD( "tc1-6.7s", 0x01000, 0x00400, CRC(72707677) SHA1(122c1b619c9efa3b7055908dda3102ee28230504) ) // sprite color table + ROM_LOAD( "tc1-4.2e", 0x01400, 0x00100, CRC(a4e73d53) SHA1(df8231720e9b57cf2751f86ac3ed7433804f51ca) ) // road color table ROM_LOAD( "tc1-17.7k", 0x01500, 0x02000, CRC(90db1bf6) SHA1(dbb9e50a8efc3b4012fcf587cc87da9ef42a1b80) ) // sprite related ROM_END @@ -614,13 +613,13 @@ ROM_START( tceptor2 ) ROM_LOAD( "tc2-11.10r", 0x60000, 0x10000, CRC(40724380) SHA1(57549094fc8403f1f528e57fe3fa64844bf89e22) ) ROM_LOAD( "tc2-13.10s", 0x70000, 0x10000, CRC(519ec7c1) SHA1(c4abe279d7cf6f626dcbb6f6c4dc2a138b818f51) ) - ROM_REGION( 0x3600, REGION_PROMS, 0 ) + ROM_REGION( 0x3500, REGION_PROMS, 0 ) ROM_LOAD( "tc2-3.1k", 0x00000, 0x00400, CRC(e3504f1a) SHA1(1ac3968e993030a6b2f4719702ff870267ab6918) ) // red components ROM_LOAD( "tc2-1.1h", 0x00400, 0x00400, CRC(e8a96fda) SHA1(42e5d2b351000ac0705b01ab484c5fe8e294a08b) ) // green components ROM_LOAD( "tc2-2.1j", 0x00800, 0x00400, CRC(c65eda61) SHA1(c316b748daa6be68eebbb480557637efc9f44781) ) // blue components ROM_LOAD( "tc1-5.6a", 0x00c00, 0x00400, CRC(afa8eda8) SHA1(783efbcbf0bb7e4cf2e2618ddd0ef3b52a4518cc) ) // tiles color table - ROM_LOAD( "tc2-4.2e", 0x01000, 0x00100, CRC(6b49fc30) SHA1(66ca39cd7985643acd71905111ae2d931c082465) ) // road color table - ROM_LOAD( "tc2-6.7s", 0x01100, 0x00400, CRC(badcda76) SHA1(726e0019241d31716f3af9ebe900089bce771477) ) // sprite color table + ROM_LOAD( "tc2-6.7s", 0x01000, 0x00400, CRC(badcda76) SHA1(726e0019241d31716f3af9ebe900089bce771477) ) // sprite color table + ROM_LOAD( "tc2-4.2e", 0x01400, 0x00100, CRC(6b49fc30) SHA1(66ca39cd7985643acd71905111ae2d931c082465) ) // road color table ROM_LOAD( "tc1-17.7k", 0x01500, 0x02000, CRC(90db1bf6) SHA1(dbb9e50a8efc3b4012fcf587cc87da9ef42a1b80) ) // sprite related ROM_END diff --git a/src/mame/includes/skychut.h b/src/mame/includes/m10.h similarity index 79% rename from src/mame/includes/skychut.h rename to src/mame/includes/m10.h index ecb160d8892..99b1753bbd8 100644 --- a/src/mame/includes/skychut.h +++ b/src/mame/includes/m10.h @@ -27,8 +27,8 @@ #define IREMM15_VBSTART (240) #define IREMM15_VBEND (16) -typedef struct _irem_state irem_state; -struct _irem_state +typedef struct _m10_state m10_state; +struct _m10_state { /* memory pointers */ UINT8 * chargen; @@ -47,15 +47,15 @@ struct _irem_state }; -/*----------- defined in video/skychut.c -----------*/ +/*----------- defined in video/m10.c -----------*/ -WRITE8_HANDLER( skychut_colorram_w ); -WRITE8_HANDLER( iremm15_chargen_w ); +WRITE8_HANDLER( m10_colorram_w ); +WRITE8_HANDLER( m15_chargen_w ); -VIDEO_UPDATE( iremm10 ); -VIDEO_UPDATE( iremm15 ); +VIDEO_UPDATE( m10 ); +VIDEO_UPDATE( m15 ); -VIDEO_START( iremm10 ); -VIDEO_START( iremm15 ); +VIDEO_START( m10 ); +VIDEO_START( m15 ); diff --git a/src/mame/mame.mak b/src/mame/mame.mak index d612ad56baf..a7f020726a1 100644 --- a/src/mame/mame.mak +++ b/src/mame/mame.mak @@ -755,6 +755,7 @@ $(MAMEOBJ)/igs.a: \ $(MACHINE)/pgmy2ks.o \ $(MAMEOBJ)/irem.a: \ + $(DRIVERS)/m10.o $(VIDEO)/m10.o \ $(DRIVERS)/m52.o $(VIDEO)/m52.o \ $(DRIVERS)/m57.o $(VIDEO)/m57.o \ $(DRIVERS)/m58.o $(VIDEO)/m58.o \ @@ -766,7 +767,6 @@ $(MAMEOBJ)/irem.a: \ $(DRIVERS)/olibochu.o \ $(DRIVERS)/redalert.o $(AUDIO)/redalert.o $(VIDEO)/redalert.o \ $(DRIVERS)/shisen.o $(VIDEO)/shisen.o \ - $(DRIVERS)/skychut.o $(VIDEO)/skychut.o \ $(DRIVERS)/travrusa.o $(VIDEO)/travrusa.o \ $(DRIVERS)/vigilant.o $(VIDEO)/vigilant.o \ $(DRIVERS)/wilytowr.o \ diff --git a/src/mame/video/circusc.c b/src/mame/video/circusc.c index b94b2d46d2e..901a0dc058a 100644 --- a/src/mame/video/circusc.c +++ b/src/mame/video/circusc.c @@ -110,7 +110,6 @@ static TILE_GET_INFO( get_tile_info ) { UINT8 attr = circusc_colorram[tile_index]; tileinfo->category = (attr & 0x10) >> 4; - tileinfo->group = attr & 0x0f; SET_TILE_INFO(0, circusc_videoram[tile_index] + ((attr & 0x20) << 3), diff --git a/src/mame/video/exctsccr.c b/src/mame/video/exctsccr.c index 4f84383bf94..6d032c5c53a 100644 --- a/src/mame/video/exctsccr.c +++ b/src/mame/video/exctsccr.c @@ -19,80 +19,79 @@ static tilemap *bg_tilemap; ***************************************************************************/ PALETTE_INIT( exctsccr ) { - int i,idx; - #define COLOR(gfxn,offs) (colortable[machine->drv->gfxdecodeinfo[gfxn].color_codes_start + offs]) + int i; - for (i = 0;i < machine->drv->total_colors;i++) + /* allocate the colortable */ + machine->colortable = colortable_alloc(machine, 0x20); + + /* create a lookup table for the palette */ + for (i = 0; i < 0x20; i++) { - int bit0,bit1,bit2,r,g,b; + 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; + + /* 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[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)); + colortable_palette_set_color(machine->colortable, i, MAKE_RGB(r, g, b)); } - color_prom += machine->drv->total_colors; + /* color_prom now points to the beginning of the lookup table */ + color_prom += 0x20; /* characters */ - idx = 0; - for (i = 0;i < 32;i++) + for (i = 0; i < 0x80; i++) { - COLOR(0,idx++) = color_prom[256+0+(i*4)]; - COLOR(0,idx++) = color_prom[256+1+(i*4)]; - COLOR(0,idx++) = color_prom[256+2+(i*4)]; - COLOR(0,idx++) = color_prom[256+3+(i*4)]; - COLOR(0,idx++) = color_prom[256+128+0+(i*4)]; - COLOR(0,idx++) = color_prom[256+128+1+(i*4)]; - COLOR(0,idx++) = color_prom[256+128+2+(i*4)]; - COLOR(0,idx++) = color_prom[256+128+3+(i*4)]; + int swapped_i = BITSWAP8(i,2,7,6,5,4,3,1,0); + UINT8 ctabentry = color_prom[0x100 + swapped_i]; + colortable_entry_set_value(machine->colortable, i, ctabentry); } /* sprites */ - - idx=0; - - for (i = 0;i < 15*16;i++) + for (i = 0; i < 0xf0; i++) { - if ( (i%16) < 8 ) + if ((i & 0x08) == 0) { - COLOR(2,idx) = color_prom[i]+16; - idx++; + int swapped_i = BITSWAP8(i,3,7,6,5,4,2,1,0); + UINT8 ctabentry = color_prom[i] | 0x10; + colortable_entry_set_value(machine->colortable, swapped_i + 0x80, ctabentry); } } - for (i = 15*16;i < 16*16;i++) + + for (i = 0xf0; i < 0x100; i++) { - if ( (i%16) > 7 ) + if (i & 0x08) { - COLOR(2,idx) = color_prom[i]+16; - idx++; + int swapped_i = BITSWAP8(i,3,7,6,5,4,2,1,0); + UINT8 ctabentry = color_prom[i] | 0x10; + colortable_entry_set_value(machine->colortable, swapped_i + 0x80, ctabentry); } } - for (i = 16;i < 32;i++) + + for (i = 0x80; i < 0x100; i++) { - COLOR(2,idx++) = color_prom[256+0+(i*4)]+16; - COLOR(2,idx++) = color_prom[256+1+(i*4)]+16; - COLOR(2,idx++) = color_prom[256+2+(i*4)]+16; - COLOR(2,idx++) = color_prom[256+3+(i*4)]+16; - COLOR(2,idx++) = color_prom[256+128+0+(i*4)]+16; - COLOR(2,idx++) = color_prom[256+128+1+(i*4)]+16; - COLOR(2,idx++) = color_prom[256+128+2+(i*4)]+16; - COLOR(2,idx++) = color_prom[256+128+3+(i*4)]+16; + int swapped_i = BITSWAP8(i,2,7,6,5,4,3,1,0); + UINT8 ctabentry = color_prom[0x100 + swapped_i] | 0x10; + colortable_entry_set_value(machine->colortable, i + 0x80, ctabentry); } - /* Patch for goalkeeper */ - COLOR(2,29*8+7) = 16; - + /* patch for goalkeeper - but of course, this is totally wrong */ + colortable_entry_set_value(machine->colortable, 0x80+(0x1d*8)+7, 0x10); } static TIMER_CALLBACK( exctsccr_fm_callback ) @@ -133,7 +132,10 @@ WRITE8_HANDLER( exctsccr_flipscreen_w ) static TILE_GET_INFO( get_bg_tile_info ) { int code = videoram[tile_index]; - int color = colorram[tile_index] & 0x1f; + + /* ZV 02052008 - this used to be "& 0x1f," but that's not supported by the + color PROM decoding, so I am using 0x0f. I don't see any glitches */ + int color = colorram[tile_index] & 0x0f; SET_TILE_INFO(gfx_bank, code, color, 0); } @@ -209,6 +211,7 @@ static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const re color += 6; } + if ( color==0x1d && gfx_bank==1 ) { drawgfx(bitmap,machine->gfx[3], @@ -218,23 +221,26 @@ static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const re sx,sy, cliprect, TRANSPARENCY_PEN,0); + drawgfx(bitmap,machine->gfx[4], code, color, flipx, flipy, sx,sy, cliprect, - TRANSPARENCY_COLOR, 16); + TRANSPARENCY_PENS, + colortable_get_transpen_mask(machine->colortable, machine->gfx[4], color, 0x10)); - } else + } + else { - drawgfx(bitmap,machine->gfx[bank], - code, - color, - flipx, flipy, - sx,sy, - cliprect, - TRANSPARENCY_PEN,0); + drawgfx(bitmap,machine->gfx[bank], + code, + color, + flipx, flipy, + sx,sy, + cliprect, + TRANSPARENCY_PEN,0); } } } diff --git a/src/mame/video/exedexes.c b/src/mame/video/exedexes.c index a193b33b554..436c5b74d6f 100644 --- a/src/mame/video/exedexes.c +++ b/src/mame/video/exedexes.c @@ -39,55 +39,49 @@ static tilemap *bg_tilemap, *fg_tilemap, *tx_tilemap; PALETTE_INIT( exedexes ) { 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, 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]); - - 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++; + 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 table */ + color_prom += 0x300; - /* characters use colors 192-207 */ - for (i = 0;i < TOTAL_COLORS(0);i++) - COLOR(0,i) = (*color_prom++) + 192; - - /* 32x32 tiles use colors 0-15 */ - for (i = 0;i < TOTAL_COLORS(1);i++) - COLOR(1,i) = (*color_prom++); - - /* 16x16 tiles use colors 64-79 */ - for (i = 0;i < TOTAL_COLORS(2);i++) - COLOR(2,i) = (*color_prom++) + 64; - - /* sprites use colors 128-191 in four banks */ - for (i = 0;i < TOTAL_COLORS(3);i++) + /* characters use colors 0xc0-0xcf */ + for (i = 0; i < 0x100; i++) { - COLOR(3,i) = color_prom[0] + 128 + 16 * color_prom[256]; - color_prom++; + UINT8 ctabentry = color_prom[i] | 0xc0; + colortable_entry_set_value(machine->colortable, i, ctabentry); + } + + /* 32x32 tiles use colors 0-0x0f */ + for (i = 0x100; i < 0x200; i++) + { + UINT8 ctabentry = color_prom[i]; + colortable_entry_set_value(machine->colortable, i, ctabentry); + } + + /* 16x16 tiles use colors 0x40-0x4f */ + for (i = 0x200; i < 0x300; i++) + { + UINT8 ctabentry = color_prom[i] | 0x40; + colortable_entry_set_value(machine->colortable, i, ctabentry); + } + + /* sprites use colors 0x80-0xbf in four banks */ + for (i = 0x300; i < 0x400; i++) + { + UINT8 ctabentry = color_prom[i] | (color_prom[i + 0x100] << 4) | 0x80; + colortable_entry_set_value(machine->colortable, i, ctabentry); } } @@ -157,6 +151,8 @@ static TILE_GET_INFO( get_tx_tile_info ) int code = videoram[tile_index] + 2 * (colorram[tile_index] & 0x80); int color = colorram[tile_index] & 0x3f; + tileinfo->group = color; + SET_TILE_INFO(0, code, color, 0); } @@ -181,10 +177,10 @@ VIDEO_START( exedexes ) TILEMAP_TYPE_PEN, 16, 16, 128, 128); tx_tilemap = tilemap_create(get_tx_tile_info, tilemap_scan_rows, - TILEMAP_TYPE_COLORTABLE, 8, 8, 32, 32); + TILEMAP_TYPE_PEN, 8, 8, 32, 32); tilemap_set_transparent_pen(fg_tilemap, 0); - tilemap_set_transparent_pen(tx_tilemap, 207); + colortable_configure_tilemap_groups(machine->colortable, tx_tilemap, machine->gfx[0], 0xcf); } static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int priority) @@ -242,9 +238,8 @@ VIDEO_UPDATE( exedexes ) draw_sprites(machine, bitmap, cliprect, 0); if (chon) - { tilemap_draw(bitmap, cliprect, tx_tilemap, 0, 0); - } + return 0; } diff --git a/src/mame/video/gberet.c b/src/mame/video/gberet.c index 479ad9e8eed..f57df90f84c 100644 --- a/src/mame/video/gberet.c +++ b/src/mame/video/gberet.c @@ -30,39 +30,56 @@ static tilemap *bg_tilemap; PALETTE_INIT( gberet ) { 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, 0x20); + + /* create a lookup table for the palette */ + for (i = 0; i < 0x20; i++) { - int bit0,bit1,bit2,r,g,b; + int bit0, bit1, bit2; + int r, g, b; - bit0 = (*color_prom >> 0) & 0x01; - bit1 = (*color_prom >> 1) & 0x01; - bit2 = (*color_prom >> 2) & 0x01; + /* 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 < TOTAL_COLORS(1);i++) + /* color_prom now points to the beginning of the lookup table */ + color_prom += 0x20; + + for (i = 0; i < 0x100; i++) { - if (*color_prom & 0x0f) COLOR(1,i) = *color_prom & 0x0f; - else COLOR(1,i) = 0; - color_prom++; + UINT8 ctabentry = (color_prom[i] & 0x0f) | 0x10; + colortable_entry_set_value(machine->colortable, i, ctabentry); } - for (i = 0;i < TOTAL_COLORS(0);i++) + + for (i = 0x100; i < 0x200; i++) { - COLOR(0,i) = (*(color_prom++) & 0x0f) + 0x10; + UINT8 ctabentry; + + if (color_prom[i] & 0x0f) + ctabentry = color_prom[i] & 0x0f; + else + ctabentry = 0; + + colortable_entry_set_value(machine->colortable, i, ctabentry); } } @@ -100,6 +117,7 @@ static TILE_GET_INFO( get_bg_tile_info ) int color = attr & 0x0f; int flags = TILE_FLIPYX((attr & 0x30) >> 4); + tileinfo->group = color; tileinfo->category = (attr & 0x80) >> 7; SET_TILE_INFO(0, code, color, flags); @@ -107,10 +125,9 @@ static TILE_GET_INFO( get_bg_tile_info ) VIDEO_START( gberet ) { - bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows, - TILEMAP_TYPE_COLORTABLE, 8, 8, 64, 32); + bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows, TILEMAP_TYPE_PEN, 8, 8, 64, 32); - tilemap_set_transparent_pen(bg_tilemap, 0x10); + colortable_configure_tilemap_groups(machine->colortable, bg_tilemap, machine->gfx[0], 0x10); tilemap_set_scroll_rows(bg_tilemap, 32); } @@ -145,7 +162,8 @@ static void gberet_draw_sprites(running_machine *machine, mame_bitmap *bitmap, c } drawgfx(bitmap, machine->gfx[1], code, color, flipx, flipy, sx, sy, - cliprect, TRANSPARENCY_COLOR, 0); + cliprect, TRANSPARENCY_PENS, + colortable_get_transpen_mask(machine->colortable, machine->gfx[1], color, 0)); } } } @@ -197,7 +215,8 @@ static void gberetb_draw_sprites(running_machine *machine, mame_bitmap *bitmap, } drawgfx(bitmap, machine->gfx[1], code, color, flipx, flipy, sx, sy, - cliprect, TRANSPARENCY_COLOR, 0); + cliprect, TRANSPARENCY_PENS, + colortable_get_transpen_mask(machine->colortable, machine->gfx[1], color, 0)); } } } diff --git a/src/mame/video/gunsmoke.c b/src/mame/video/gunsmoke.c index 79ec0530b2a..3f373c65321 100644 --- a/src/mame/video/gunsmoke.c +++ b/src/mame/video/gunsmoke.c @@ -29,58 +29,42 @@ PALETTE_INIT( gunsmoke ) { int i; - 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; + int r = pal4bit(color_prom[i + 0x000]); + int g = pal4bit(color_prom[i + 0x100]); + int b = pal4bit(color_prom[i + 0x200]); - 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++; + 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 table */ + color_prom += 0x300; - /* characters use colors 64-79 */ - for (i = 0; i < TOTAL_COLORS(0); i++) - COLOR(0, i) = *(color_prom++) + 64; - color_prom += 128; /* skip the bottom half of the PROM - not used */ - - /* background tiles use colors 0-63 */ - for (i = 0; i < TOTAL_COLORS(1); i++) + /* characters use colors 0x40-0x4f */ + for (i = 0; i < 0x80; i++) { - COLOR(1, i) = color_prom[0] + 16 * (color_prom[256] & 0x03); - color_prom++; + UINT8 ctabentry = color_prom[i] | 0x40; + colortable_entry_set_value(machine->colortable, i, ctabentry); } - color_prom += TOTAL_COLORS(1); - /* sprites use colors 128-255 */ - for (i = 0; i < TOTAL_COLORS(2); i++) + /* background tiles use colors 0-0x3f */ + for (i = 0x100; i < 0x200; i++) { - COLOR(2, i) = color_prom[0] + 16 * (color_prom[256] & 0x07) + 128; - color_prom++; + UINT8 ctabentry = color_prom[i] | ((color_prom[i + 0x100] & 0x03) << 4); + colortable_entry_set_value(machine->colortable, i - 0x80, ctabentry); + } + + /* sprites use colors 0x80-0xff */ + for (i = 0x300; i < 0x400; i++) + { + UINT8 ctabentry = color_prom[i] | ((color_prom[i + 0x100] & 0x07) << 4) | 0x80; + colortable_entry_set_value(machine->colortable, i - 0x180, ctabentry); } - color_prom += TOTAL_COLORS(2); } WRITE8_HANDLER( gunsmoke_videoram_w ) @@ -144,6 +128,8 @@ static TILE_GET_INFO( get_fg_tile_info ) int code = videoram[tile_index] + ((attr & 0xe0) << 2); int color = attr & 0x1f; + tileinfo->group = color; + SET_TILE_INFO(0, code, color, 0); } @@ -154,13 +140,10 @@ VIDEO_START( gunsmoke ) memory_configure_bank(1, 0, 4, &rombase[0x10000], 0x4000); /* create tilemaps */ - bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_cols, - TILEMAP_TYPE_PEN, 32, 32, 2048, 8); + bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_cols, TILEMAP_TYPE_PEN, 32, 32, 2048, 8); + fg_tilemap = tilemap_create(get_fg_tile_info, tilemap_scan_rows, TILEMAP_TYPE_PEN, 8, 8, 32, 32); - fg_tilemap = tilemap_create(get_fg_tile_info, tilemap_scan_rows, - TILEMAP_TYPE_COLORTABLE, 8, 8, 32, 32); - - tilemap_set_transparent_pen(fg_tilemap, 0x4f); + colortable_configure_tilemap_groups(machine->colortable, fg_tilemap, machine->gfx[0], 0x4f); /* register for saving */ state_save_register_global(chon); diff --git a/src/mame/video/skychut.c b/src/mame/video/m10.c similarity index 84% rename from src/mame/video/skychut.c rename to src/mame/video/m10.c index 6b13882b02a..8c3bc5ce63b 100644 --- a/src/mame/video/skychut.c +++ b/src/mame/video/m10.c @@ -12,7 +12,7 @@ #include "driver.h" #include "deprecat.h" -#include "skychut.h" +#include "m10.h" static tilemap * tx_tilemap; static gfx_element * back_gfx; @@ -44,7 +44,7 @@ static const gfx_layout charlayout = static UINT32 tilemap_scan(UINT32 col,UINT32 row,UINT32 num_cols,UINT32 num_rows) { - //irem_state *state = Machine->driver_data; + //m10_state *state = Machine->driver_data; return (31-col)*32 + row; } @@ -56,7 +56,7 @@ static void get_tile_info(running_machine *machine, tile_data *tileinfo, tilemap } -WRITE8_HANDLER( skychut_colorram_w ) +WRITE8_HANDLER( m10_colorram_w ) { if (colorram[offset] != data) { @@ -66,9 +66,9 @@ WRITE8_HANDLER( skychut_colorram_w ) } -WRITE8_HANDLER( iremm15_chargen_w ) +WRITE8_HANDLER( m15_chargen_w ) { - irem_state *state = Machine->driver_data; + m10_state *state = Machine->driver_data; if (state->chargen[offset] != data) { @@ -79,9 +79,9 @@ WRITE8_HANDLER( iremm15_chargen_w ) } -INLINE void plot_pixel_iremm10(mame_bitmap *bm, int x, int y, int col) +INLINE void plot_pixel_m10(mame_bitmap *bm, int x, int y, int col) { - irem_state *state = Machine->driver_data; + m10_state *state = Machine->driver_data; if (!state->flip) *BITMAP_ADDR16(bm, y, x) = col; @@ -90,16 +90,16 @@ INLINE void plot_pixel_iremm10(mame_bitmap *bm, int x, int y, int col) , (IREMM10_HBSTART - 1)- (x- IREMM10_HBEND)) = col; // only when flip_screen(?) } -VIDEO_START( iremm10 ) +VIDEO_START( m10 ) { - //irem_state *state = machine->driver_data; + //m10_state *state = machine->driver_data; int i; for (i=0;i<32*8;i++) extyoffs[i] = i*8; - tx_tilemap = tilemap_create(get_tile_info,tilemap_scan,TILEMAP_TYPE_COLORTABLE,8,8,32,32); - tilemap_set_transparent_pen(tx_tilemap, 0x07); + tx_tilemap = tilemap_create(get_tile_info,tilemap_scan,TILEMAP_TYPE_PEN,8,8,32,32); + tilemap_set_transparent_pen(tx_tilemap, 0); tilemap_set_scrolldx(tx_tilemap, 0, 62); tilemap_set_scrolldy(tx_tilemap, 0, 0); @@ -110,9 +110,9 @@ VIDEO_START( iremm10 ) return ; } -VIDEO_START( iremm15 ) +VIDEO_START( m15 ) { - irem_state *state = machine->driver_data; + m10_state *state = machine->driver_data; machine->gfx[0] = allocgfx(&charlayout); machine->gfx[0]->total_colors = 8; @@ -131,15 +131,15 @@ VIDEO_START( iremm15 ) Draw the game screen in the given mame_bitmap. ***************************************************************************/ -VIDEO_UPDATE( iremm10 ) +VIDEO_UPDATE( m10 ) { - irem_state *state = machine->driver_data; + m10_state *state = machine->driver_data; int offs; static const int color[4]= { 3, 3, 5, 5 }; static const int xpos[4] = { 4*8, 26*8, 7*8, 6*8}; int i; - fillbitmap(bitmap,machine->pens[7],cliprect); + fillbitmap(bitmap,machine->pens[0],cliprect); decodegfx(back_gfx, state->chargen,0,4); for (i=0;i<4;i++) @@ -153,9 +153,7 @@ VIDEO_UPDATE( iremm10 ) int y; for (y = IREMM10_VBEND;y < IREMM10_VBSTART;y++) - { - plot_pixel_iremm10(bitmap,16,y,0); - } + plot_pixel_m10(bitmap,16,y,1); } for (offs = videoram_size - 1;offs >= 0;offs--) @@ -173,9 +171,9 @@ VIDEO_UPDATE( iremm10 ) Draw the game screen in the given mame_bitmap. ***************************************************************************/ -VIDEO_UPDATE( iremm15 ) +VIDEO_UPDATE( m15 ) { - irem_state *state = machine->driver_data; + m10_state *state = machine->driver_data; int offs; for (offs = videoram_size - 1;offs >= 0;offs--) diff --git a/src/mame/video/retofinv.c b/src/mame/video/retofinv.c index 052c4ca7650..9fe65b32cff 100644 --- a/src/mame/video/retofinv.c +++ b/src/mame/video/retofinv.c @@ -20,54 +20,43 @@ static tilemap *bg_tilemap,*fg_tilemap; PALETTE_INIT( retofinv ) { 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, 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]); - bit0 = (color_prom[i + 0*machine->drv->total_colors] >> 0) & 0x01; - bit1 = (color_prom[i + 0*machine->drv->total_colors] >> 1) & 0x01; - bit2 = (color_prom[i + 0*machine->drv->total_colors] >> 2) & 0x01; - bit3 = (color_prom[i + 0*machine->drv->total_colors] >> 3) & 0x01; - r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - - bit0 = (color_prom[i + 1*machine->drv->total_colors] >> 0) & 0x01; - bit1 = (color_prom[i + 1*machine->drv->total_colors] >> 1) & 0x01; - bit2 = (color_prom[i + 1*machine->drv->total_colors] >> 2) & 0x01; - bit3 = (color_prom[i + 1*machine->drv->total_colors] >> 3) & 0x01; - g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - - 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)); } - color_prom += 3*machine->drv->total_colors; /* color_prom now points to the beginning of the lookup table */ + color_prom += 0x300; + /* fg chars (1bpp) */ - for (i = 0;i < TOTAL_COLORS(0);i++) + for (i = 0; i < 0x200; i++) { - if (i % 2) - COLOR(0,i) = i/2; + UINT8 ctabentry; + + if (i & 0x01) + ctabentry = i >> 1; else - COLOR(0,i) = 0; + ctabentry = 0; + + colortable_entry_set_value(machine->colortable, i, ctabentry); } - /* sprites */ - for(i = 0;i < TOTAL_COLORS(2);i++) - COLOR(2,i) = BITSWAP8(color_prom[i],4,5,6,7,3,2,1,0); - - /* bg tiles */ - for(i = 0;i < TOTAL_COLORS(1);i++) - COLOR(1,i) = BITSWAP8(color_prom[TOTAL_COLORS(2) + i],4,5,6,7,3,2,1,0); + /* sprites and bg tiles */ + for (i = 0; i < 0x800; i++) + { + UINT8 ctabentry = BITSWAP8(color_prom[i],4,5,6,7,3,2,1,0); + colortable_entry_set_value(machine->colortable, i + 0x200, ctabentry); + } } @@ -92,7 +81,7 @@ static TILEMAP_MAPPER( tilemap_scan ) static TILE_GET_INFO( bg_get_tile_info ) { SET_TILE_INFO( - 1, + 2, retofinv_bg_videoram[tile_index] + 256 * bg_bank, retofinv_bg_videoram[0x400 + tile_index] & 0x3f, 0); @@ -101,10 +90,14 @@ static TILE_GET_INFO( bg_get_tile_info ) static TILE_GET_INFO( fg_get_tile_info ) { /* not sure about the transparency thing, but it makes sense */ + int color = retofinv_fg_videoram[0x400 + tile_index]; + + tileinfo->group = color; + SET_TILE_INFO( 0, retofinv_fg_videoram[tile_index] + 256 * fg_bank, - retofinv_fg_videoram[0x400 + tile_index], + color, (tile_index < 0x40 || tile_index >= 0x3c0) ? TILE_FORCE_LAYER0 : 0); } @@ -119,9 +112,9 @@ static TILE_GET_INFO( fg_get_tile_info ) VIDEO_START( retofinv ) { bg_tilemap = tilemap_create(bg_get_tile_info,tilemap_scan,TILEMAP_TYPE_PEN,8,8,36,28); - fg_tilemap = tilemap_create(fg_get_tile_info,tilemap_scan,TILEMAP_TYPE_COLORTABLE,8,8,36,28); + fg_tilemap = tilemap_create(fg_get_tile_info,tilemap_scan,TILEMAP_TYPE_PEN,8,8,36,28); - tilemap_set_transparent_pen(fg_tilemap,0); + colortable_configure_tilemap_groups(machine->colortable, fg_tilemap, machine->gfx[0], 0); spriteram = retofinv_sharedram + 0x0780; spriteram_2 = retofinv_sharedram + 0x0f80; @@ -225,12 +218,13 @@ static void draw_sprites(running_machine *machine, mame_bitmap *bitmap) { for (x = 0;x <= sizex;x++) { - drawgfx(bitmap,machine->gfx[2], + drawgfx(bitmap,machine->gfx[1], sprite + gfx_offs[y ^ (sizey * flipy)][x ^ (sizex * flipx)], color, flipx,flipy, sx + 16*x,sy + 16*y, - &spritevisiblearea,TRANSPARENCY_COLOR,0xff); + &spritevisiblearea,TRANSPARENCY_PENS, + colortable_get_transpen_mask(machine->colortable, machine->gfx[1], color, 0xff)); } } } diff --git a/src/mame/video/sprcros2.c b/src/mame/video/sprcros2.c index 60994007e25..41d4e9bfd98 100644 --- a/src/mame/video/sprcros2.c +++ b/src/mame/video/sprcros2.c @@ -12,33 +12,53 @@ extern UINT8 sprcros2_m_port7; PALETTE_INIT( sprcros2 ) { - int i,bit0,bit1,bit2,r,g,b; + int i; - for (i = 0;i < machine->drv->total_colors; i++) + /* allocate the colortable */ + machine->colortable = colortable_alloc(machine, 0x20); + + /* 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; + /* 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 */ - bit1 = (color_prom[i] >> 6) & 0x01; - bit2 = (color_prom[i] >> 7) & 0x01; - b = 0x47 * bit1 + 0xb8 * bit2; + bit0 = (color_prom[i] >> 6) & 0x01; + bit1 = (color_prom[i] >> 7) & 0x01; + b = 0x47 * bit0 + 0xb8 * bit1; palette_set_color(machine,i,MAKE_RGB(r,g,b)); + + colortable_palette_set_color(machine->colortable, i, MAKE_RGB(r, g, b)); } - //cluts - for (i = 0;i < 0x100; i++) + /* color_prom now points to the beginning of the lookup table */ + color_prom += 0x20; + + /* bg */ + for (i = 0; i < 0x100; i++) { - colortable[i]=color_prom[i+0x20]+(color_prom[i+0x120]<<4); //bg - colortable[i+0x100]=color_prom[i+0x220]; //sprites - colortable[i+0x200]=color_prom[i+0x320]; //fg + UINT8 ctabentry = (color_prom[i] & 0x0f) | ((color_prom[i + 0x100] & 0x0f) << 4); + colortable_entry_set_value(machine->colortable, i, ctabentry); + } + + /* sprites & fg */ + for (i = 0x100; i < 0x300; i++) + { + UINT8 ctabentry = color_prom[i + 0x100]; + colortable_entry_set_value(machine->colortable, i, ctabentry); } } @@ -91,6 +111,9 @@ static TILE_GET_INFO( get_sprcros2_fgtile_info ) { UINT32 tile_number = sprcros2_fgvideoram[tile_index]; UINT8 attr = sprcros2_fgvideoram[tile_index+0x400]; + int color = (attr&0xfc)>>2; + + tileinfo->group = color; //attr //76543210 @@ -102,21 +125,21 @@ static TILE_GET_INFO( get_sprcros2_fgtile_info ) SET_TILE_INFO( 2, tile_number, - (attr&0xfc)>>2, + color, 0); } VIDEO_START( sprcros2 ) { sprcros2_bgtilemap = tilemap_create( get_sprcros2_bgtile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN,8,8,32,32 ); - sprcros2_fgtilemap = tilemap_create( get_sprcros2_fgtile_info,tilemap_scan_rows,TILEMAP_TYPE_COLORTABLE,8,8,32,32 ); + sprcros2_fgtilemap = tilemap_create( get_sprcros2_fgtile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN,8,8,32,32 ); - tilemap_set_transparent_pen(sprcros2_fgtilemap,0); + colortable_configure_tilemap_groups(machine->colortable, sprcros2_fgtilemap, machine->gfx[2], 0); } static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect) { - int offs,sx,sy,flipx,flipy; + int offs,sx,sy,color,flipx,flipy; for (offs = sprcros2_spriteram_size-4; offs >= 0; offs -= 4) { @@ -139,6 +162,7 @@ static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rec sx = ((sprcros2_spriteram[offs+3]+0x10)%0x100)-0x10; sy = 225-(((sprcros2_spriteram[offs+2]+0x10)%0x100)-0x10); + color = (sprcros2_spriteram[offs+1]&0x38)>>3; flipx = sprcros2_spriteram[offs+1]&0x02; flipy = 0; @@ -152,10 +176,11 @@ static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rec drawgfx(bitmap,machine->gfx[1], sprcros2_spriteram[offs], - (sprcros2_spriteram[offs+1]&0x38)>>3, + color, flipx,flipy, sx,sy, - cliprect,TRANSPARENCY_COLOR,0); + cliprect,TRANSPARENCY_PENS, + colortable_get_transpen_mask(machine->colortable, machine->gfx[1], color, 0)); } } } diff --git a/src/mame/video/stfight.c b/src/mame/video/stfight.c index 2a1ffcbc697..01e486c582b 100644 --- a/src/mame/video/stfight.c +++ b/src/mame/video/stfight.c @@ -40,47 +40,54 @@ static int stfight_sprite_base = 0; PALETTE_INIT( stfight ) { 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, 0x100); - /* unique color for transparency */ - palette_set_color(machine,256,MAKE_RGB(0x04,0x04,0x04)); - - /* text uses colors 192-207 */ - for (i = 0;i < TOTAL_COLORS(0);i++) + /* text uses colors 0xc0-0xcf */ + for (i = 0; i < 0x40; i++) { - if ((*color_prom & 0x0f) == 0x0f) COLOR(0,i) = 256; /* transparent */ - else COLOR(0,i) = (*color_prom & 0x0f) + 0xc0; - color_prom++; + UINT8 ctabentry = (color_prom[i] & 0x0f) | 0xc0; + colortable_entry_set_value(machine->colortable, i, ctabentry); } - color_prom += 256 - TOTAL_COLORS(0); /* rest of the PROM is unused */ - /* fg uses colors 64-127 */ - for (i = 0;i < TOTAL_COLORS(1);i++) + /* fg uses colors 0x40-0x7f */ + for (i = 0x40; i < 0x140; i++) { - COLOR(1,i) = (color_prom[256] & 0x0f) + 16 * (color_prom[0] & 0x03) + 0x40; - color_prom++; + UINT8 ctabentry = (color_prom[i + 0x1c0] & 0x0f) | ((color_prom[i + 0x0c0] & 0x03) << 4) | 0x40; + colortable_entry_set_value(machine->colortable, i, ctabentry); } - color_prom += 256; - /* bg uses colors 0-63 */ - for (i = 0;i < TOTAL_COLORS(2);i++) + /* bg uses colors 0-0x3f */ + for (i = 0x140; i < 0x240; i++) { - COLOR(2,i) = (color_prom[256] & 0x0f) + 16 * (color_prom[0] & 0x03) + 0x00; - color_prom++; + UINT8 ctabentry = (color_prom[i + 0x2c0] & 0x0f) | ((color_prom[i + 0x1c0] & 0x03) << 4); + colortable_entry_set_value(machine->colortable, i, ctabentry); } - color_prom += 256; - /* sprites use colors 128-191 */ - for (i = 0;i < TOTAL_COLORS(4);i++) + /* bg uses colors 0x80-0xbf */ + for (i = 0x240; i < 0x340; i++) { - COLOR(4,i) = (color_prom[256] & 0x0f) + 16 * (color_prom[0] & 0x03) + 0x80; - color_prom++; + UINT8 ctabentry = (color_prom[i + 0x3c0] & 0x0f) | ((color_prom[i + 0x2c0] & 0x03) << 4) | 0x80; + colortable_entry_set_value(machine->colortable, i, ctabentry); } - color_prom += 256; } + +static void set_pens(running_machine *machine) +{ + int i; + + for (i = 0; i < 0x100; i++) + { + UINT16 data = paletteram[i] | (paletteram_2[i] << 8); + rgb_t color = MAKE_RGB(pal4bit(data >> 4), pal4bit(data >> 0), pal4bit(data >> 8)); + + colortable_palette_set_color(machine->colortable, i, color); + } +} + + /*************************************************************************** Callbacks for the TileMap code @@ -135,6 +142,9 @@ static TILE_GET_INFO( get_bg_tile_info ) static TILE_GET_INFO( get_tx_tile_info ) { UINT8 attr = stfight_text_attr_ram[tile_index]; + int color = attr & 0x0f; + + tileinfo->group = color; SET_TILE_INFO( 0, @@ -154,11 +164,10 @@ VIDEO_START( stfight ) { bg_tilemap = tilemap_create(get_bg_tile_info,bg_scan,TILEMAP_TYPE_PEN, 16,16,128,256); fg_tilemap = tilemap_create(get_fg_tile_info,fg_scan,TILEMAP_TYPE_PEN,16,16,128,256); - tx_tilemap = tilemap_create(get_tx_tile_info,tilemap_scan_rows, - TILEMAP_TYPE_COLORTABLE,8,8,32,32); + tx_tilemap = tilemap_create(get_tx_tile_info,tilemap_scan_rows, TILEMAP_TYPE_PEN,8,8,32,32); - tilemap_set_transparent_pen(fg_tilemap,0x0F); - tilemap_set_transparent_pen(tx_tilemap,256); + tilemap_set_transparent_pen(fg_tilemap,0x0f); + colortable_configure_tilemap_groups(machine->colortable, tx_tilemap, machine->gfx[0], 0xcf); } @@ -285,6 +294,8 @@ static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const re VIDEO_UPDATE( stfight ) { + set_pens(machine); + fillbitmap(priority_bitmap,0,cliprect); fillbitmap(bitmap,machine->pens[0],cliprect); /* in case bg_tilemap is disabled */ diff --git a/src/mame/video/tceptor.c b/src/mame/video/tceptor.c index 30e064da8fc..a7184cb644a 100644 --- a/src/mame/video/tceptor.c +++ b/src/mame/video/tceptor.c @@ -11,8 +11,8 @@ #define TX_TILE_OFFSET_RIGHT (32 * 0 + 2) #define TX_TILE_OFFSET_LEFT (32 * 31 + 2) -#define SPR_TRANS_COLOR (0xff + 768) -#define SPR_MASK_COLOR (0xfe + 768) +#define SPR_TRANS_COLOR (0xff + 0x300) +#define SPR_MASK_COLOR (0xfe + 0x300) UINT8 *tceptor_tile_ram; @@ -42,38 +42,24 @@ static int is_mask_spr[1024/16]; PALETTE_INIT( tceptor ) { - int totcolors, totlookup; int i; - totcolors = machine->drv->total_colors; - totlookup = machine->drv->color_table_len; + /* allocate the colortable */ + machine->colortable = colortable_alloc(machine, 0x400); - for (i = 0; i < totcolors; i++) + /* create a lookup table for the palette */ + for (i = 0; i < 0x400; i++) { - int bit0, bit1, bit2, bit3, r, g, b; + int r = pal4bit(color_prom[i + 0x000]); + int g = pal4bit(color_prom[i + 0x400]); + int b = pal4bit(color_prom[i + 0x800]); - 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[totcolors] >> 0) & 0x01; - bit1 = (color_prom[totcolors] >> 1) & 0x01; - bit2 = (color_prom[totcolors] >> 2) & 0x01; - bit3 = (color_prom[totcolors] >> 3) & 0x01; - g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - bit0 = (color_prom[2*totcolors] >> 0) & 0x01; - bit1 = (color_prom[2*totcolors] >> 1) & 0x01; - bit2 = (color_prom[2*totcolors] >> 2) & 0x01; - bit3 = (color_prom[2*totcolors] >> 3) & 0x01; - b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - - palette_set_color(machine, i, MAKE_RGB(r, g, b)); - color_prom++; + colortable_palette_set_color(machine->colortable, i, MAKE_RGB(r, g, b)); } - color_prom += 2 * totcolors; /* color_prom now points to the beginning of the lookup table */ + color_prom += 0xc00; + /* color lookup table: @@ -84,27 +70,39 @@ PALETTE_INIT( tceptor ) */ /* tiles lookup table (1024 colors) */ - for (i = 0; i < 1024;i++) - colortable[i] = *color_prom++; - - /* road lookup table (256 colors) */ - for (i = 0; i < 256; i++) - colortable[i + 0xf00] = *(color_prom++) + 512; + for (i = 0; i < 0x0400; i++) + { + int ctabentry = color_prom[i]; + colortable_entry_set_value(machine->colortable, i, ctabentry); + } /* sprites lookup table (1024 colors) */ - for (i = 0;i < 1024; i++) - colortable[i + 1024] = *(color_prom++) + 768; + for (i = 0x0400; i < 0x0800; i++) + { + int ctabentry = color_prom[i] | 0x300; + colortable_entry_set_value(machine->colortable, i, ctabentry); + } - /* background: lookup prom is not presented, use prom directly (512 colors) */ - for (i = 0;i < 512; i++) - colortable[i + 2048] = i; + /* background: no lookup PROM, use directly (512 colors) */ + for (i = 0x0a00; i < 0x0c00; i++) + { + int ctabentry = i & 0x1ff; + colortable_entry_set_value(machine->colortable, i, ctabentry); + } + + /* road lookup table (256 colors) */ + for (i = 0x0f00; i < 0x1000; i++) + { + int ctabentry = color_prom[i - 0x700] | 0x200; + colortable_entry_set_value(machine->colortable, i, ctabentry); + } /* setup sprite mask color map */ /* tceptor2: only 0x23 */ memset(is_mask_spr, 0, sizeof is_mask_spr); - for (i = 0; i < 1024; i++) - if (colortable[i + 1024] == SPR_MASK_COLOR) - is_mask_spr[i / 16] = 1; + for (i = 0; i < 0x400; i++) + if (colortable_entry_get_value(machine->colortable, i | 0x400) == SPR_MASK_COLOR) + is_mask_spr[i >> 4] = 1; } @@ -132,6 +130,8 @@ static TILE_GET_INFO( get_tx_tile_info ) int code = tceptor_tile_ram[offset]; int color = tceptor_tile_attr[offset]; + tileinfo->group = color; + SET_TILE_INFO(0, code, color, 0); } @@ -430,13 +430,13 @@ VIDEO_START( tceptor ) namco_road_init(machine, gfx_index); - namco_road_set_transparent_color(machine->remapped_colortable[0xfff]); + namco_road_set_transparent_color(colortable_entry_get_value(machine->colortable, 0xfff)); - tx_tilemap = tilemap_create(get_tx_tile_info, tilemap_scan_cols, TILEMAP_TYPE_COLORTABLE, 8, 8, 34, 28); + tx_tilemap = tilemap_create(get_tx_tile_info, tilemap_scan_cols, TILEMAP_TYPE_PEN, 8, 8, 34, 28); tilemap_set_scrollx(tx_tilemap, 0, -2*8); tilemap_set_scrolly(tx_tilemap, 0, 0); - tilemap_set_transparent_pen(tx_tilemap, 7); + colortable_configure_tilemap_groups(machine->colortable, tx_tilemap, machine->gfx[0], 7); bg1_tilemap = tilemap_create(get_bg1_tile_info, tilemap_scan_rows, TILEMAP_TYPE_PEN, 8, 8, 64, 32); bg2_tilemap = tilemap_create(get_bg2_tile_info, tilemap_scan_rows, TILEMAP_TYPE_PEN, 8, 8, 64, 32); @@ -533,7 +533,8 @@ static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const re flipx, flipy, x, y, cliprect, - TRANSPARENCY_COLOR, SPR_TRANS_COLOR, + TRANSPARENCY_PENS, + colortable_get_transpen_mask(machine->colortable, machine->gfx[gfx], color, SPR_TRANS_COLOR), scalex, scaley); } @@ -546,11 +547,9 @@ static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const re for (x = cliprect->min_x; x <= cliprect->max_x; x++) for (y = cliprect->min_y; y <= cliprect->max_y; y++) - if (*BITMAP_ADDR16(bitmap, y, x) == SPR_MASK_COLOR) - { + if (colortable_entry_get_value(machine->colortable, *BITMAP_ADDR16(bitmap, y, x)) == SPR_MASK_COLOR) // restore pixel *BITMAP_ADDR16(bitmap, y, x) = *BITMAP_ADDR16(temp_bitmap, y, x); - } } }