diff --git a/.gitattributes b/.gitattributes index d93964722c2..a070aed252a 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2204,6 +2204,9 @@ src/mame/includes/lethalj.h svneol=native#text/plain src/mame/includes/liberatr.h svneol=native#text/plain src/mame/includes/lwings.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 +src/mame/includes/m62.h svneol=native#text/plain src/mame/includes/m72.h svneol=native#text/plain src/mame/includes/m92.h svneol=native#text/plain src/mame/includes/mario.h svneol=native#text/plain diff --git a/src/mame/audio/irem.c b/src/mame/audio/irem.c index 9d49689a0e9..6f7769eb9e8 100644 --- a/src/mame/audio/irem.c +++ b/src/mame/audio/irem.c @@ -92,7 +92,10 @@ static WRITE8_HANDLER( irem_msm5205_w ) static WRITE8_HANDLER( irem_adpcm_w ) { - MSM5205_data_w(offset,data); + if (offset & 1) + MSM5205_data_w(0, data); + if (offset & 2) + MSM5205_data_w(1, data); } static void irem_adpcm_int(int data) @@ -142,26 +145,42 @@ static const struct MSM5205interface irem_msm5205_interface_2 = -static ADDRESS_MAP_START( irem_sound_map, ADDRESS_SPACE_PROGRAM, 8 ) - AM_RANGE(0x0800, 0x0800) AM_WRITENOP - AM_RANGE(0x0801, 0x0802) AM_WRITE(irem_adpcm_w) - AM_RANGE(0x9000, 0x9000) AM_WRITE(irem_sound_irq_ack_w) +/* complete address map verified from Moon Patrol/10 Yard Fight schematics */ +/* large map uses 8k ROMs, small map uses 4k ROMs; this is selected via a jumper */ +static ADDRESS_MAP_START( m52_small_sound_map, ADDRESS_SPACE_PROGRAM, 8 ) + ADDRESS_MAP_FLAGS( AMEF_ABITS(15) ) + AM_RANGE(0x0000, 0x0fff) AM_WRITE(irem_adpcm_w) + AM_RANGE(0x1000, 0x1fff) AM_WRITE(irem_sound_irq_ack_w) + AM_RANGE(0x2000, 0x7fff) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( m52_large_sound_map, ADDRESS_SPACE_PROGRAM, 8 ) + AM_RANGE(0x0000, 0x1fff) AM_WRITE(irem_adpcm_w) + AM_RANGE(0x2000, 0x3fff) AM_WRITE(irem_sound_irq_ack_w) AM_RANGE(0x4000, 0xffff) AM_ROM ADDRESS_MAP_END + +/* complete address map verified from Kid Niki schematics */ +static ADDRESS_MAP_START( m62_sound_map, ADDRESS_SPACE_PROGRAM, 8 ) + AM_RANGE(0x0800, 0x0800) AM_MIRROR(0xf7fc) AM_WRITE(irem_sound_irq_ack_w) + AM_RANGE(0x0801, 0x0802) AM_MIRROR(0xf7fc) AM_WRITE(irem_adpcm_w) + AM_RANGE(0x4000, 0xffff) AM_ROM +ADDRESS_MAP_END + + static ADDRESS_MAP_START( irem_sound_portmap, ADDRESS_SPACE_IO, 8 ) AM_RANGE(M6803_PORT1, M6803_PORT1) AM_READWRITE(irem_port1_r, irem_port1_w) AM_RANGE(M6803_PORT2, M6803_PORT2) AM_READWRITE(irem_port2_r, irem_port2_w) ADDRESS_MAP_END -MACHINE_DRIVER_START( irem_audio ) +MACHINE_DRIVER_START( irem_audio_base ) MDRV_SOUND_START(irem_audio) /* basic machine hardware */ - MDRV_CPU_ADD(M6803, XTAL_3_579545MHz) /* verified on pcb */ - MDRV_CPU_PROGRAM_MAP(irem_sound_map,0) + MDRV_CPU_ADD_TAG("iremsound", M6803, XTAL_3_579545MHz) /* verified on pcb */ MDRV_CPU_IO_MAP(irem_sound_portmap,0) /* sound hardware */ @@ -183,3 +202,32 @@ MACHINE_DRIVER_START( irem_audio ) MDRV_SOUND_CONFIG(irem_msm5205_interface_2) MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) MACHINE_DRIVER_END + + +MACHINE_DRIVER_START( m52_small_audio ) + MDRV_IMPORT_FROM(irem_audio_base) + + /* basic machine hardware */ + MDRV_CPU_MODIFY("iremsound") + MDRV_CPU_PROGRAM_MAP(m52_small_sound_map,0) +MACHINE_DRIVER_END + + +MACHINE_DRIVER_START( m52_large_audio ) /* 10 yard fight */ + MDRV_IMPORT_FROM(irem_audio_base) + + /* basic machine hardware */ + MDRV_CPU_MODIFY("iremsound") + MDRV_CPU_PROGRAM_MAP(m52_large_sound_map,0) +MACHINE_DRIVER_END + + +MACHINE_DRIVER_START( m62_audio ) + MDRV_IMPORT_FROM(irem_audio_base) + + /* basic machine hardware */ + MDRV_CPU_MODIFY("iremsound") + MDRV_CPU_PROGRAM_MAP(m62_sound_map,0) +MACHINE_DRIVER_END + + diff --git a/src/mame/audio/irem.h b/src/mame/audio/irem.h index 0c97212f1e9..4f1ab1fb53d 100644 --- a/src/mame/audio/irem.h +++ b/src/mame/audio/irem.h @@ -4,6 +4,8 @@ ****************************************************************************/ -MACHINE_DRIVER_EXTERN( irem_audio ); +MACHINE_DRIVER_EXTERN( m52_small_audio ); +MACHINE_DRIVER_EXTERN( m52_large_audio ); +MACHINE_DRIVER_EXTERN( m62_audio ); WRITE8_HANDLER( irem_sound_cmd_w ); diff --git a/src/mame/drivers/kncljoe.c b/src/mame/drivers/kncljoe.c index 3cdb9307683..b18cc4b7279 100644 --- a/src/mame/drivers/kncljoe.c +++ b/src/mame/drivers/kncljoe.c @@ -37,28 +37,21 @@ extern WRITE8_HANDLER(kncljoe_scroll_w); extern UINT8 *kncljoe_scrollregs; -static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 ) - AM_RANGE(0x0000, 0xbfff) AM_READ(MRA8_ROM) - AM_RANGE(0xc000, 0xcfff) AM_READ(MRA8_RAM) /* videoram */ +static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 ) + AM_RANGE(0x0000, 0xbfff) AM_ROM + AM_RANGE(0xc000, 0xcfff) AM_READWRITE(MRA8_RAM, kncljoe_videoram_w) AM_BASE(&videoram) + AM_RANGE(0xd000, 0xd001) AM_WRITE(kncljoe_scroll_w) AM_BASE(&kncljoe_scrollregs) AM_RANGE(0xd800, 0xd800) AM_READ(input_port_0_r) /* IN 0 */ AM_RANGE(0xd801, 0xd801) AM_READ(input_port_1_r) /* IN 1 */ AM_RANGE(0xd802, 0xd802) AM_READ(input_port_2_r) /* IN 2 */ AM_RANGE(0xd803, 0xd803) AM_READ(input_port_3_r) /* DSW A */ AM_RANGE(0xd804, 0xd804) AM_READ(input_port_4_r) /* DSW B */ - AM_RANGE(0xd807, 0xd807) AM_READ(MRA8_NOP) /* unknown read */ - AM_RANGE(0xd817, 0xd817) AM_READ(MRA8_NOP) /* unknown read */ - AM_RANGE(0xe800, 0xefff) AM_READ(MRA8_RAM) /* spriteram */ - AM_RANGE(0xf000, 0xffff) AM_READ(MRA8_RAM) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 8 ) - AM_RANGE(0x0000, 0xbfff) AM_WRITE(MWA8_ROM) - AM_RANGE(0xc000, 0xcfff) AM_WRITE(kncljoe_videoram_w) AM_BASE(&videoram) - AM_RANGE(0xd000, 0xd001) AM_WRITE(kncljoe_scroll_w) AM_BASE(&kncljoe_scrollregs) AM_RANGE(0xd800, 0xd800) AM_WRITE(irem_sound_cmd_w) AM_RANGE(0xd801, 0xd803) AM_WRITE(kncljoe_control_w) - AM_RANGE(0xe800, 0xefff) AM_WRITE(MWA8_RAM) AM_BASE(&spriteram) AM_SIZE(&spriteram_size) - AM_RANGE(0xf000, 0xffff) AM_WRITE(MWA8_RAM) + AM_RANGE(0xd807, 0xd807) AM_READ(MRA8_NOP) /* unknown read */ + AM_RANGE(0xd817, 0xd817) AM_READ(MRA8_NOP) /* unknown read */ + AM_RANGE(0xe800, 0xefff) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size) + AM_RANGE(0xf000, 0xffff) AM_RAM ADDRESS_MAP_END /******************************************************************************/ @@ -181,7 +174,7 @@ static MACHINE_DRIVER_START( kncljoe ) /* basic machine hardware */ // MDRV_CPU_ADD(Z80, 4000000) /* 4 MHz */ MDRV_CPU_ADD(Z80, 5500000) /* 4 MHz is too low. The game loop never finishes a frame in time. */ - MDRV_CPU_PROGRAM_MAP(readmem,writemem) + MDRV_CPU_PROGRAM_MAP(main_map,0) MDRV_CPU_VBLANK_INT(irq0_line_hold,1) MDRV_SCREEN_REFRESH_RATE(60) @@ -201,7 +194,7 @@ static MACHINE_DRIVER_START( kncljoe ) MDRV_VIDEO_UPDATE(kncljoe) /* sound hardware */ - MDRV_IMPORT_FROM(irem_audio) + MDRV_IMPORT_FROM(m52_small_audio) MACHINE_DRIVER_END @@ -212,8 +205,8 @@ ROM_START( kncljoe ) ROM_LOAD( "kj-2.bin", 0x4000, 0x4000, CRC(cb11514b) SHA1(c75d4019d1617493ff074ce8187a81ad70d9b60c) ) ROM_LOAD( "kj-3.bin", 0x8000, 0x4000, CRC(0f50697b) SHA1(412c6aba270824299ca2a74e9bea42b83e69797b) ) - ROM_REGION( 0x10000, REGION_CPU2, 0 ) /* 64k for audio code */ - ROM_LOAD( "kj-13.bin",0xe000, 0x2000, CRC(0a0be3f5) SHA1(00be47fc76500843b6f5de63622edb1748ef5f7d) ) + ROM_REGION( 0x8000, REGION_CPU2, 0 ) /* 64k for audio code */ + ROM_LOAD( "kj-13.bin",0x6000, 0x2000, CRC(0a0be3f5) SHA1(00be47fc76500843b6f5de63622edb1748ef5f7d) ) ROM_REGION( 0xc000, REGION_GFX1, ROMREGION_DISPOSE ) /* tiles */ ROM_LOAD( "kj-10.bin", 0x0000, 0x4000, CRC(74d3ba33) SHA1(c7887d690cb7f7a7b24d59d490ffc088fb6cc49c) ) @@ -244,8 +237,8 @@ ROM_START( kncljoea ) ROM_LOAD( "kj-2.bin", 0x4000, 0x4000, CRC(cb11514b) SHA1(c75d4019d1617493ff074ce8187a81ad70d9b60c) ) ROM_LOAD( "kj-3.bin", 0x8000, 0x4000, CRC(0f50697b) SHA1(412c6aba270824299ca2a74e9bea42b83e69797b) ) - ROM_REGION( 0x10000, REGION_CPU2, 0 ) /* 64k for audio code */ - ROM_LOAD( "kj-13.bin",0xe000, 0x2000, CRC(0a0be3f5) SHA1(00be47fc76500843b6f5de63622edb1748ef5f7d) ) + ROM_REGION( 0x8000, REGION_CPU2, 0 ) /* 64k for audio code */ + ROM_LOAD( "kj-13.bin",0x6000, 0x2000, CRC(0a0be3f5) SHA1(00be47fc76500843b6f5de63622edb1748ef5f7d) ) ROM_REGION( 0xc000, REGION_GFX1, ROMREGION_DISPOSE ) /* tiles */ ROM_LOAD( "kj-10.bin", 0x0000, 0x4000, CRC(74d3ba33) SHA1(c7887d690cb7f7a7b24d59d490ffc088fb6cc49c) ) @@ -276,8 +269,8 @@ ROM_START( bcrusher ) ROM_LOAD( "bcrush2.bin", 0x4000, 0x4000, CRC(1be4c731) SHA1(11f3a33263d66172902dfb6f3fe2d0ab5cad38d7) ) ROM_LOAD( "bcrush3.bin", 0x8000, 0x4000, CRC(0772d993) SHA1(430f0319bd4765add2f1ee197e7217fdf9ae79c8) ) - ROM_REGION( 0x10000, REGION_CPU2, 0 ) /* 64k for audio code */ - ROM_LOAD( "kj-13.bin",0xe000, 0x2000, CRC(0a0be3f5) SHA1(00be47fc76500843b6f5de63622edb1748ef5f7d) ) + ROM_REGION( 0x8000, REGION_CPU2, 0 ) /* 64k for audio code */ + ROM_LOAD( "kj-13.bin",0x6000, 0x2000, CRC(0a0be3f5) SHA1(00be47fc76500843b6f5de63622edb1748ef5f7d) ) ROM_REGION( 0xc000, REGION_GFX1, ROMREGION_DISPOSE ) /* tiles */ ROM_LOAD( "bcrush10.bin", 0x0000, 0x4000, CRC(a62f4572) SHA1(4e38e175e25a955e5f83cac8c935163e2e861e94) ) diff --git a/src/mame/drivers/m62.c b/src/mame/drivers/m62.c index cf2fcedba0d..494589a7310 100644 --- a/src/mame/drivers/m62.c +++ b/src/mame/drivers/m62.c @@ -60,65 +60,10 @@ JP4: / **************************************************************************/ #include "driver.h" +#include "m62.h" #include "audio/irem.h" -PALETTE_INIT( m62 ); -PALETTE_INIT( lotlot ); -PALETTE_INIT( battroad ); -PALETTE_INIT( spelunk2 ); - -WRITE8_HANDLER( m62_tileram_w ); -WRITE8_HANDLER( m62_textram_w ); -WRITE8_HANDLER( m62_flipscreen_w ); -WRITE8_HANDLER( m62_hscroll_low_w ); -WRITE8_HANDLER( m62_hscroll_high_w ); -WRITE8_HANDLER( m62_vscroll_low_w ); -WRITE8_HANDLER( m62_vscroll_high_w ); -extern UINT8 *m62_tileram; -extern UINT8 *m62_textram; - -VIDEO_START( kungfum ); -VIDEO_UPDATE( kungfum ); -WRITE8_HANDLER( kungfum_tileram_w ); - -VIDEO_START( ldrun ); -VIDEO_UPDATE( ldrun ); - -VIDEO_START( ldrun2 ); - -VIDEO_START( battroad ); -VIDEO_UPDATE( battroad ); - -VIDEO_START( ldrun4 ); -VIDEO_UPDATE( ldrun4 ); - -VIDEO_START( lotlot ); -VIDEO_UPDATE( lotlot ); - -WRITE8_HANDLER( kidniki_text_vscroll_low_w ); -WRITE8_HANDLER( kidniki_text_vscroll_high_w ); -WRITE8_HANDLER( kidniki_background_bank_w ); -VIDEO_START( kidniki ); -VIDEO_UPDATE( kidniki ); - -WRITE8_HANDLER( spelunkr_palbank_w ); -VIDEO_START( spelunkr ); -VIDEO_UPDATE( spelunkr ); - -WRITE8_HANDLER( spelunk2_gfxport_w ); -VIDEO_START( spelunk2 ); -VIDEO_UPDATE( spelunk2 ); - -VIDEO_START( youjyudn ); -VIDEO_UPDATE( youjyudn ); - -VIDEO_START( horizon ); -VIDEO_UPDATE( horizon ); -WRITE8_HANDLER( horizon_scrollram_w ); -extern UINT8 *horizon_scrollram; - - /* Lode Runner 2 seems to have a simple protection on the bank switching */ /* circuitry. It writes data to ports 0x80 and 0x81, then reads port 0x80 */ /* a variable number of times (discarding the result) and finally retrieves */ @@ -1381,7 +1326,7 @@ static MACHINE_DRIVER_START( ldrun ) MDRV_VIDEO_UPDATE(ldrun) /* sound hardware */ - MDRV_IMPORT_FROM(irem_audio) + MDRV_IMPORT_FROM(m62_audio) MACHINE_DRIVER_END diff --git a/src/mame/drivers/mpatrol.c b/src/mame/drivers/mpatrol.c index 8f5a6e3007e..966083d4881 100644 --- a/src/mame/drivers/mpatrol.c +++ b/src/mame/drivers/mpatrol.c @@ -1,67 +1,61 @@ /*************************************************************************** -Moon Patrol memory map + Irem M52 hardware -driver by Nicola Salmoria +**************************************************************************** -0000-3fff ROM -8000-83ff Video RAM -8400-87ff Color RAM -e000-e7ff RAM + Moon Patrol memory map + + driver by Nicola Salmoria + + 0000-3fff ROM + 8000-83ff Video RAM + 8400-87ff Color RAM + e000-e7ff RAM -read: -8800 protection -d000 IN0 -d001 IN1 -d002 IN2 -d003 DSW1 -d004 DSW2 + read: + 8800 protection + d000 IN0 + d001 IN1 + d002 IN2 + d003 DSW1 + d004 DSW2 -write: -c800-c8ff sprites -d000 sound command -d001 flip screen + write: + c800-c8ff sprites + d000 sound command + d001 flip screen -I/O ports -write: -10-1f scroll registers -40 background #1 x position -60 background #1 y position -80 background #2 x position -a0 background #2 y position -c0 background control + I/O ports + write: + 10-1f scroll registers + 40 background #1 x position + 60 background #1 y position + 80 background #2 x position + a0 background #2 y position + c0 background control + + NOTE: It may be possible to remove the fake port now that conditional DIPS + are supported. What should really be filled in for each mode? -NOTE: It may be possible to remove the fake port now that conditional DIPS -are supported. What should really be filled in for each mode? ***************************************************************************/ #include "driver.h" +#include "m52.h" #include "audio/irem.h" #include "cpu/z80/z80.h" #define MASTER_CLOCK XTAL_18_432MHz -#define SOUND_CLOCK XTAL_3_579545MHz -READ8_HANDLER( mpatrol_protection_r ); -WRITE8_HANDLER( mpatrol_scroll_w ); -WRITE8_HANDLER( mpatrol_bg1xpos_w ); -WRITE8_HANDLER( mpatrol_bg1ypos_w ); -WRITE8_HANDLER( mpatrol_bg2xpos_w ); -WRITE8_HANDLER( mpatrol_bg2ypos_w ); -WRITE8_HANDLER( mpatrol_bgcontrol_w ); -WRITE8_HANDLER( mpatrol_flipscreen_w ); -WRITE8_HANDLER( mpatrol_videoram_w ); -WRITE8_HANDLER( mpatrol_colorram_w ); - -PALETTE_INIT( mpatrol ); -VIDEO_START( mpatrol ); -VIDEO_UPDATE( mpatrol ); - - +/************************************* + * + * Custom input ports + * + *************************************/ static CUSTOM_INPUT( coin_mode ) { @@ -80,12 +74,12 @@ static CUSTOM_INPUT( coin_mode ) static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x3fff) AM_ROM - AM_RANGE(0x8000, 0x83ff) AM_READWRITE(MRA8_RAM, mpatrol_videoram_w) AM_BASE(&videoram) - AM_RANGE(0x8400, 0x87ff) AM_READWRITE(MRA8_RAM, mpatrol_colorram_w) AM_BASE(&colorram) - AM_RANGE(0x8800, 0x8800) AM_MIRROR(0x07ff) AM_READ(mpatrol_protection_r) + AM_RANGE(0x8000, 0x83ff) AM_READWRITE(MRA8_RAM, m52_videoram_w) AM_BASE(&videoram) + AM_RANGE(0x8400, 0x87ff) AM_READWRITE(MRA8_RAM, m52_colorram_w) AM_BASE(&colorram) + AM_RANGE(0x8800, 0x8800) AM_MIRROR(0x07ff) AM_READ(m52_protection_r) AM_RANGE(0xc800, 0xcbff) AM_MIRROR(0x0400) AM_WRITE(MWA8_RAM) AM_BASE(&spriteram) AM_SIZE(&spriteram_size) AM_RANGE(0xd000, 0xd000) AM_MIRROR(0x07fc) AM_WRITE(irem_sound_cmd_w) - AM_RANGE(0xd001, 0xd001) AM_MIRROR(0x07fc) AM_WRITE(mpatrol_flipscreen_w) /* + coin counters */ + AM_RANGE(0xd001, 0xd001) AM_MIRROR(0x07fc) AM_WRITE(m52_flipscreen_w) /* + coin counters */ AM_RANGE(0xd000, 0xd000) AM_MIRROR(0x07f8) AM_READ_PORT("IN0") AM_RANGE(0xd001, 0xd001) AM_MIRROR(0x07f8) AM_READ_PORT("IN1") AM_RANGE(0xd002, 0xd002) AM_MIRROR(0x07f8) AM_READ_PORT("IN2") @@ -97,11 +91,11 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( alpha1v_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x6fff) AM_ROM - AM_RANGE(0x8000, 0x83ff) AM_READWRITE(MRA8_RAM, mpatrol_videoram_w) AM_BASE(&videoram) - AM_RANGE(0x8400, 0x87ff) AM_READWRITE(MRA8_RAM, mpatrol_colorram_w) AM_BASE(&colorram) + AM_RANGE(0x8000, 0x83ff) AM_READWRITE(MRA8_RAM, m52_videoram_w) AM_BASE(&videoram) + AM_RANGE(0x8400, 0x87ff) AM_READWRITE(MRA8_RAM, m52_colorram_w) AM_BASE(&colorram) AM_RANGE(0xc800, 0xc9ff) AM_WRITE(MWA8_RAM) AM_BASE(&spriteram) AM_SIZE(&spriteram_size) AM_SHARE(1) // bigger or mirrored? AM_RANGE(0xd000, 0xd000) AM_READ_PORT("IN0") AM_WRITE(irem_sound_cmd_w) - AM_RANGE(0xd001, 0xd001) AM_READ_PORT("IN1") AM_WRITE(mpatrol_flipscreen_w) /* + coin counters */ + AM_RANGE(0xd001, 0xd001) AM_READ_PORT("IN1") AM_WRITE(m52_flipscreen_w) /* + coin counters */ AM_RANGE(0xd002, 0xd002) AM_READ_PORT("IN2") AM_RANGE(0xd003, 0xd003) AM_READ_PORT("DSW0") AM_RANGE(0xd004, 0xd004) AM_READ_PORT("DSW1") @@ -111,12 +105,12 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( main_portmap, ADDRESS_SPACE_IO, 8 ) ADDRESS_MAP_FLAGS( AMEF_ABITS(8) ) - AM_RANGE(0x00, 0x00) AM_MIRROR(0x1f) AM_WRITE(mpatrol_scroll_w) - AM_RANGE(0x40, 0x40) AM_MIRROR(0x1f) AM_WRITE(mpatrol_bg1xpos_w) - AM_RANGE(0x60, 0x60) AM_MIRROR(0x1f) AM_WRITE(mpatrol_bg1ypos_w) - AM_RANGE(0x80, 0x80) AM_MIRROR(0x1f) AM_WRITE(mpatrol_bg2xpos_w) - AM_RANGE(0xa0, 0xa0) AM_MIRROR(0x1f) AM_WRITE(mpatrol_bg2ypos_w) - AM_RANGE(0xc0, 0xc0) AM_MIRROR(0x1f) AM_WRITE(mpatrol_bgcontrol_w) + AM_RANGE(0x00, 0x00) AM_MIRROR(0x1f) AM_WRITE(m52_scroll_w) + AM_RANGE(0x40, 0x40) AM_MIRROR(0x1f) AM_WRITE(m52_bg1xpos_w) + AM_RANGE(0x60, 0x60) AM_MIRROR(0x1f) AM_WRITE(m52_bg1ypos_w) + AM_RANGE(0x80, 0x80) AM_MIRROR(0x1f) AM_WRITE(m52_bg2xpos_w) + AM_RANGE(0xa0, 0xa0) AM_MIRROR(0x1f) AM_WRITE(m52_bg2ypos_w) + AM_RANGE(0xc0, 0xc0) AM_MIRROR(0x1f) AM_WRITE(m52_bgcontrol_w) ADDRESS_MAP_END @@ -328,7 +322,7 @@ static const gfx_layout bgcharlayout = }; -static GFXDECODE_START( mpatrol ) +static GFXDECODE_START( m52 ) GFXDECODE_ENTRY( REGION_GFX1, 0x0000, charlayout, 0, 128 ) GFXDECODE_ENTRY( REGION_GFX2, 0x0000, spritelayout, 128*4, 16 ) GFXDECODE_ENTRY( REGION_GFX3, 0x0000, bgcharlayout, 128*4+16*4+0*4, 1 ) @@ -344,7 +338,7 @@ GFXDECODE_END * *************************************/ -static MACHINE_DRIVER_START( mpatrol ) +static MACHINE_DRIVER_START( m52 ) /* basic machine hardware */ MDRV_CPU_ADD_TAG("main", Z80, MASTER_CLOCK/6) @@ -354,25 +348,24 @@ static MACHINE_DRIVER_START( mpatrol ) /* video hardware */ MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) - MDRV_GFXDECODE(mpatrol) - MDRV_PALETTE_LENGTH(512+32+32) - MDRV_COLORTABLE_LENGTH(128*4+16*4+3*4) + MDRV_GFXDECODE(m52) + MDRV_PALETTE_LENGTH(128*4+16*4+3*4) MDRV_SCREEN_ADD("main", 0) MDRV_SCREEN_RAW_PARAMS(MASTER_CLOCK/3, 384, 136, 376, 282, 22, 274) MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) - MDRV_PALETTE_INIT(mpatrol) - MDRV_VIDEO_START(mpatrol) - MDRV_VIDEO_UPDATE(mpatrol) + MDRV_PALETTE_INIT(m52) + MDRV_VIDEO_START(m52) + MDRV_VIDEO_UPDATE(m52) /* sound hardware */ - MDRV_IMPORT_FROM(irem_audio) + MDRV_IMPORT_FROM(m52_small_audio) MACHINE_DRIVER_END static MACHINE_DRIVER_START( alpha1v ) - MDRV_IMPORT_FROM(mpatrol) + MDRV_IMPORT_FROM(m52) /* basic machine hardware */ MDRV_CPU_MODIFY("main") @@ -394,8 +387,8 @@ ROM_START( mpatrol ) ROM_LOAD( "mpa-3.3k", 0x2000, 0x1000, CRC(2e1a598c) SHA1(112c3c9678db8a8540a8df3708020c87fd10c91b) ) ROM_LOAD( "mpa-4.3j", 0x3000, 0x1000, CRC(dd05b587) SHA1(727961b0dafa4a96b580d51013336db2a18aff1e) ) - ROM_REGION( 0x10000, REGION_CPU2, 0 ) - ROM_LOAD( "mp-s1.1a", 0xf000, 0x1000, CRC(561d3108) SHA1(4998c68a9e9a8002251fa8f07aa1082444a9dc80) ) + ROM_REGION( 0x8000, REGION_CPU2, 0 ) + ROM_LOAD( "mp-s1.1a", 0x7000, 0x1000, CRC(561d3108) SHA1(4998c68a9e9a8002251fa8f07aa1082444a9dc80) ) ROM_REGION( 0x2000, REGION_GFX1, ROMREGION_DISPOSE ) ROM_LOAD( "mpe-5.3e", 0x0000, 0x1000, CRC(e3ee7f75) SHA1(b03d0d56150d3e9da4a4c871338097b4f450b649) ) /* chars */ @@ -428,8 +421,8 @@ ROM_START( mpatrolw ) ROM_LOAD( "mpa-3w.3k", 0x2000, 0x1000, CRC(9b249fe5) SHA1(c01e0d572c4c163f3cf4b2aa9f4246427811b78d) ) ROM_LOAD( "mpa-4w.3j", 0x3000, 0x1000, CRC(fee76972) SHA1(c3166b027f89f61964ead804d3c2da387454c4c2) ) - ROM_REGION( 0x10000, REGION_CPU2, 0 ) - ROM_LOAD( "mp-s1.1a", 0xf000, 0x1000, CRC(561d3108) SHA1(4998c68a9e9a8002251fa8f07aa1082444a9dc80) ) + ROM_REGION( 0x8000, REGION_CPU2, 0 ) + ROM_LOAD( "mp-s1.1a", 0x7000, 0x1000, CRC(561d3108) SHA1(4998c68a9e9a8002251fa8f07aa1082444a9dc80) ) ROM_REGION( 0x2000, REGION_GFX1, ROMREGION_DISPOSE ) ROM_LOAD( "mpe-5w.3e", 0x0000, 0x1000, CRC(f56e01fe) SHA1(93f582d63b9cd5c6dca207aa57b213c939cdda1d) ) /* chars */ @@ -466,8 +459,8 @@ ROM_START( alpha1v ) ROM_LOAD( "7-f3", 0x5000, 0x1000, CRC(99db9781) SHA1(a56a675cc4cbc9681bfe8052f51f19336eb2a0a6) ) ROM_LOAD( "7a e3", 0x6000, 0x1000, CRC(3b0b4b0d) SHA1(0d8eea1e2db269943611289b3490a578ee347f85) ) - ROM_REGION( 0x10000, REGION_CPU2, 0 ) - ROM_LOAD( "1-a1", 0xf000, 0x1000, CRC(9e07fdd5) SHA1(ed4f462fcfe91fa8e88bfeaaba0a0c11fa0b4601) ) + ROM_REGION( 0x8000, REGION_CPU2, 0 ) + ROM_LOAD( "1-a1", 0x7000, 0x1000, CRC(9e07fdd5) SHA1(ed4f462fcfe91fa8e88bfeaaba0a0c11fa0b4601) ) ROM_REGION( 0x2000, REGION_GFX1, ROMREGION_DISPOSE ) ROM_LOAD( "14-e3", 0x0000, 0x1000, CRC(cf00c737) SHA1(415e90289039cac4d04cb1d559f1378ca6a32132) ) /* chars */ @@ -504,6 +497,6 @@ ROM_END * *************************************/ -GAME( 1982, mpatrol, 0, mpatrol, mpatrol, 0, ROT0, "Irem", "Moon Patrol", GAME_SUPPORTS_SAVE ) -GAME( 1982, mpatrolw, mpatrol, mpatrol, mpatrolw, 0, ROT0, "Irem (Williams license)", "Moon Patrol (Williams)", GAME_SUPPORTS_SAVE ) +GAME( 1982, mpatrol, 0, m52, mpatrol, 0, ROT0, "Irem", "Moon Patrol", GAME_SUPPORTS_SAVE ) +GAME( 1982, mpatrolw, mpatrol, m52, mpatrolw, 0, ROT0, "Irem (Williams license)", "Moon Patrol (Williams)", GAME_SUPPORTS_SAVE ) GAME( 1988, alpha1v, 0, alpha1v, alpha1v, 0, ROT0, "Vision Electronics", "Alpha One (Vision Electronics / Kyle Hodgetts)", GAME_NOT_WORKING|GAME_NO_SOUND ) diff --git a/src/mame/drivers/travrusa.c b/src/mame/drivers/travrusa.c index de7d5e1374f..f63982e39d8 100644 --- a/src/mame/drivers/travrusa.c +++ b/src/mame/drivers/travrusa.c @@ -65,26 +65,20 @@ VIDEO_UPDATE( shtrider ); -static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 ) - AM_RANGE(0x0000, 0x7fff) AM_READ(MRA8_ROM) - AM_RANGE(0x8000, 0x8fff) AM_READ(MRA8_RAM) /* Video and Color ram */ - AM_RANGE(0xd000, 0xd000) AM_READ(input_port_0_r) /* IN0 */ - AM_RANGE(0xd001, 0xd001) AM_READ(input_port_1_r) /* IN1 */ - AM_RANGE(0xd002, 0xd002) AM_READ(input_port_2_r) /* IN2 */ - AM_RANGE(0xd003, 0xd003) AM_READ(input_port_3_r) /* DSW1 */ - AM_RANGE(0xd004, 0xd004) AM_READ(input_port_4_r) /* DSW2 */ - AM_RANGE(0xe000, 0xefff) AM_READ(MRA8_RAM) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 8 ) - AM_RANGE(0x0000, 0x7fff) AM_WRITE(MWA8_ROM) - AM_RANGE(0x8000, 0x8fff) AM_WRITE(travrusa_videoram_w) AM_BASE(&travrusa_videoram) +static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 ) + AM_RANGE(0x0000, 0x7fff) AM_ROM + AM_RANGE(0x8000, 0x8fff) AM_READWRITE(MRA8_RAM, travrusa_videoram_w) AM_BASE(&travrusa_videoram) AM_RANGE(0x9000, 0x9000) AM_WRITE(travrusa_scroll_x_low_w) AM_RANGE(0xa000, 0xa000) AM_WRITE(travrusa_scroll_x_high_w) AM_RANGE(0xc800, 0xc9ff) AM_WRITE(MWA8_RAM) AM_BASE(&spriteram) AM_SIZE(&spriteram_size) AM_RANGE(0xd000, 0xd000) AM_WRITE(irem_sound_cmd_w) AM_RANGE(0xd001, 0xd001) AM_WRITE(travrusa_flipscreen_w) /* + coin counters - not written by shtrider */ - AM_RANGE(0xe000, 0xefff) AM_WRITE(MWA8_RAM) + AM_RANGE(0xd000, 0xd000) AM_READ(input_port_0_r) /* IN0 */ + AM_RANGE(0xd001, 0xd001) AM_READ(input_port_1_r) /* IN1 */ + AM_RANGE(0xd002, 0xd002) AM_READ(input_port_2_r) /* IN2 */ + AM_RANGE(0xd003, 0xd003) AM_READ(input_port_3_r) /* DSW1 */ + AM_RANGE(0xd004, 0xd004) AM_READ(input_port_4_r) /* DSW2 */ + AM_RANGE(0xe000, 0xefff) AM_RAM ADDRESS_MAP_END #define TRAV_COMMON\ @@ -333,7 +327,7 @@ static MACHINE_DRIVER_START( travrusa ) /* basic machine hardware */ MDRV_CPU_ADD(Z80, 4000000) /* 4 MHz (?) */ - MDRV_CPU_PROGRAM_MAP(readmem,writemem) + MDRV_CPU_PROGRAM_MAP(main_map,0) MDRV_CPU_VBLANK_INT(irq0_line_hold,1) MDRV_SCREEN_REFRESH_RATE(56.75) @@ -356,7 +350,7 @@ static MACHINE_DRIVER_START( travrusa ) MDRV_VIDEO_UPDATE(travrusa) /* sound hardware */ - MDRV_IMPORT_FROM(irem_audio) + MDRV_IMPORT_FROM(m52_small_audio) MACHINE_DRIVER_END static MACHINE_DRIVER_START( shtrider ) @@ -385,8 +379,8 @@ ROM_START( travrusa ) ROM_LOAD( "zr1-6a.k3", 0x4000, 0x2000, CRC(e1b51383) SHA1(34f4476c1bcc28c53c8ffa7b614f443a329aae13) ) ROM_LOAD( "zr1-7.j3", 0x6000, 0x2000, CRC(85cd1a51) SHA1(7eb046514845cb9d2507ee24d1b2f7cc5402ac02) ) - ROM_REGION( 0x10000, REGION_CPU2, 0 ) - ROM_LOAD( "mr10.1a", 0xf000, 0x1000, CRC(a02ad8a0) SHA1(aff80b506dbecabed2a36eb743693940f6a22d16) ) + ROM_REGION( 0x8000, REGION_CPU2, 0 ) + ROM_LOAD( "mr10.1a", 0x7000, 0x1000, CRC(a02ad8a0) SHA1(aff80b506dbecabed2a36eb743693940f6a22d16) ) ROM_REGION( 0x06000, REGION_GFX1, ROMREGION_DISPOSE ) ROM_LOAD( "zippyrac.001", 0x00000, 0x2000, CRC(aa8994dd) SHA1(9b326ce52a03d723e5c3c1b5fd4aa8fa7f70f904) ) @@ -411,8 +405,8 @@ ROM_START( motorace ) ROM_LOAD( "mr2.3k", 0x4000, 0x2000, CRC(8a2374ec) SHA1(7159731f5ef2485e3c822e3e8e51e9583dd1c6bc) ) ROM_LOAD( "mr3.3j", 0x6000, 0x2000, CRC(2f04c341) SHA1(ae990d9d4abdd7d6ef9d21aa62125fe2e0067623) ) - ROM_REGION( 0x10000, REGION_CPU2, 0 ) - ROM_LOAD( "mr10.1a", 0xf000, 0x1000, CRC(a02ad8a0) SHA1(aff80b506dbecabed2a36eb743693940f6a22d16) ) + ROM_REGION( 0x8000, REGION_CPU2, 0 ) + ROM_LOAD( "mr10.1a", 0x7000, 0x1000, CRC(a02ad8a0) SHA1(aff80b506dbecabed2a36eb743693940f6a22d16) ) ROM_REGION( 0x06000, REGION_GFX1, ROMREGION_DISPOSE ) ROM_LOAD( "mr7.3e", 0x00000, 0x2000, CRC(492a60be) SHA1(9a3d6407b834eb7c3e3c8bb292ff124550a2787c) ) @@ -438,8 +432,8 @@ ROM_START( shtrider ) ROM_LOAD( "sr03a.bin", 0x4000, 0x2000, CRC(3ade11b9) SHA1(70b9dbd510cf6192194acf6876856d4c19bdf279) ) ROM_LOAD( "sr04a.bin", 0x6000, 0x2000, CRC(02b96eaa) SHA1(ba4d61cf57142192684c45dd22720234d3521241) ) - ROM_REGION( 0x10000, REGION_CPU2, 0 ) - ROM_LOAD( "sr11a.bin", 0xe000, 0x2000, CRC(a8396b76) SHA1(614151fb1d25930e9fee4ab290a63f8fe97adbe6) ) + ROM_REGION( 0x8000, REGION_CPU2, 0 ) + ROM_LOAD( "sr11a.bin", 0x6000, 0x2000, CRC(a8396b76) SHA1(614151fb1d25930e9fee4ab290a63f8fe97adbe6) ) ROM_REGION( 0x06000, REGION_GFX1, ROMREGION_DISPOSE ) ROM_LOAD( "sr05a.bin", 0x0000, 0x2000, CRC(34449f79) SHA1(30aa9da07bf32282d213f63e50c564a336fd0102) ) @@ -465,8 +459,8 @@ ROM_START( shtridra ) ROM_LOAD( "3.bin", 0x4000, 0x2000, CRC(78d051cd) SHA1(e1dc2dcfc4af35bdd5245d23977e8640d81a43f1) ) ROM_LOAD( "4.bin", 0x6000, 0x2000, CRC(02b96eaa) SHA1(ba4d61cf57142192684c45dd22720234d3521241) ) - ROM_REGION( 0x10000, REGION_CPU2, 0 ) - ROM_LOAD( "11.bin", 0xe000, 0x2000, CRC(a8396b76) SHA1(614151fb1d25930e9fee4ab290a63f8fe97adbe6) ) + ROM_REGION( 0x8000, REGION_CPU2, 0 ) + ROM_LOAD( "11.bin", 0x6000, 0x2000, CRC(a8396b76) SHA1(614151fb1d25930e9fee4ab290a63f8fe97adbe6) ) ROM_REGION( 0x06000, REGION_GFX1, ROMREGION_DISPOSE ) ROM_LOAD( "5.bin", 0x0000, 0x2000, CRC(34449f79) SHA1(30aa9da07bf32282d213f63e50c564a336fd0102) ) diff --git a/src/mame/drivers/troangel.c b/src/mame/drivers/troangel.c index 36e441f4d1b..01095d3f97a 100644 --- a/src/mame/drivers/troangel.c +++ b/src/mame/drivers/troangel.c @@ -1,78 +1,86 @@ /**************************************************************************** -Tropical Angel + Irem M57 hardware -driver by Phil Stroffolino +***************************************************************************** -IREM M57 board stack with a M52-SOUND-E sound PCB. + Tropical Angel -M57-A-A: - TA-A-xx roms and proms - NEC D780C (Z80) CPU - NANAO KNA6032601 custom chip - NANAO KNA6032701 custom chip - 8-way dipswitch (x2) - M58725P RAM (x3) - CN1 - Ribbon cable connector - CN2 - Ribbon cable connector - Ribbon cable connector to sound PCB + driver by Phil Stroffolino -M57-B-A: - TA-B-xx roms and proms - 18.432 MHz OSC - CN1 - Ribbon cable connector - CN2 - Ribbon cable connector + IREM M57 board stack with a M52-SOUND-E sound PCB. -M52: - HD6803 CPU - AY-3-9810 (x2) sound chips - MSM5205 OKI sound chip (and an unpopulated socket for a second MSM5202) - 3.579545 MHz OSC - 2764 Program rom labeled "TA S-1A-" - Ribbon cable connector to M57-A-A PCB + M57-A-A: + TA-A-xx roms and proms + NEC D780C (Z80) CPU + NANAO KNA6032601 custom chip + NANAO KNA6032701 custom chip + 8-way dipswitch (x2) + M58725P RAM (x3) + CN1 - Ribbon cable connector + CN2 - Ribbon cable connector + Ribbon cable connector to sound PCB -New Tropical Angel: - Roms where found on an official IREM board with genuine IREM Tropical Angel - license seal and genuine IREM serial number sticker. - The "new" roms have hand written labels, while those that match the current - Tropical Angel set look to be factory labeled chips. + M57-B-A: + TA-B-xx roms and proms + 18.432 MHz OSC + CN1 - Ribbon cable connector + CN2 - Ribbon cable connector + + M52: + HD6803 CPU + AY-3-9810 (x2) sound chips + MSM5205 OKI sound chip (and an unpopulated socket for a second MSM5202) + 3.579545 MHz OSC + 2764 Program rom labeled "TA S-1A-" + Ribbon cable connector to M57-A-A PCB + + New Tropical Angel: + Roms where found on an official IREM board with genuine IREM Tropical Angel + license seal and genuine IREM serial number sticker. + The "new" roms have hand written labels, while those that match the current + Tropical Angel set look to be factory labeled chips. ****************************************************************************/ + #include "driver.h" +#include "m57.h" #include "audio/irem.h" -extern UINT8 *troangel_scroll; -WRITE8_HANDLER( troangel_flipscreen_w ); -PALETTE_INIT( troangel ); -VIDEO_UPDATE( troangel ); + +#define MASTER_CLOCK XTAL_18_432MHz -static ADDRESS_MAP_START( troangel_readmem, ADDRESS_SPACE_PROGRAM, 8 ) - AM_RANGE(0x0000, 0x7fff) AM_READ(MRA8_ROM) - AM_RANGE(0x8000, 0x8fff) AM_READ(MRA8_RAM) - AM_RANGE(0x9000, 0x90ff) AM_READ(MRA8_RAM) - AM_RANGE(0xd000, 0xd000) AM_READ(input_port_0_r) - AM_RANGE(0xd001, 0xd001) AM_READ(input_port_1_r) - AM_RANGE(0xd002, 0xd002) AM_READ(input_port_2_r) - AM_RANGE(0xd003, 0xd003) AM_READ(input_port_3_r) - AM_RANGE(0xd004, 0xd004) AM_READ(input_port_4_r) - AM_RANGE(0xe000, 0xe7ff) AM_READ(MRA8_RAM) -ADDRESS_MAP_END +/************************************* + * + * Memory maps + * + *************************************/ -static ADDRESS_MAP_START( troangel_writemem, ADDRESS_SPACE_PROGRAM, 8 ) - AM_RANGE(0x0000, 0x7fff) AM_WRITE(MWA8_ROM) - AM_RANGE(0x8000, 0x87ff) AM_WRITE(MWA8_RAM) AM_BASE(&videoram) AM_SIZE(&videoram_size) -// AM_RANGE(0x8800, 0x8fff) AM_WRITE(MWA8_RAM) - AM_RANGE(0x9000, 0x91ff) AM_WRITE(MWA8_RAM) AM_BASE(&troangel_scroll) +static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 ) + AM_RANGE(0x0000, 0x7fff) AM_ROM + AM_RANGE(0x8000, 0x87ff) AM_READWRITE(MRA8_RAM, m57_videoram_w) AM_BASE(&videoram) + AM_RANGE(0x9000, 0x91ff) AM_RAM AM_BASE(&m57_scroll) AM_RANGE(0xc820, 0xc8ff) AM_WRITE(MWA8_RAM) AM_BASE(&spriteram) AM_SIZE(&spriteram_size) AM_RANGE(0xd000, 0xd000) AM_WRITE(irem_sound_cmd_w) - AM_RANGE(0xd001, 0xd001) AM_WRITE(troangel_flipscreen_w) /* + coin counters */ - AM_RANGE(0xe000, 0xe7ff) AM_WRITE(MWA8_RAM) + AM_RANGE(0xd001, 0xd001) AM_WRITE(m57_flipscreen_w) /* + coin counters */ + AM_RANGE(0xd000, 0xd000) AM_READ_PORT("IN0") + AM_RANGE(0xd001, 0xd001) AM_READ_PORT("IN1") + AM_RANGE(0xd002, 0xd002) AM_READ_PORT("IN2") + AM_RANGE(0xd003, 0xd003) AM_READ_PORT("DSW1") + AM_RANGE(0xd004, 0xd004) AM_READ_PORT("DSW2") + AM_RANGE(0xe000, 0xe7ff) AM_RAM ADDRESS_MAP_END +/************************************* + * + * Port definitions + * + *************************************/ + static INPUT_PORTS_START( troangel ) PORT_START_TAG("IN0") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 ) @@ -161,47 +169,41 @@ INPUT_PORTS_END -static const gfx_layout charlayout = -{ - 8,8, /* character size */ - 1024, /* number of characters */ - 3, /* bits per pixel */ - { 0, 1024*8*8, 2*1024*8*8 }, - { 0, 1, 2, 3, 4, 5, 6, 7 }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 /* character offset */ -}; +/************************************* + * + * Graphics layouts + * + *************************************/ static const gfx_layout spritelayout = { - 16,32, /* sprite size */ - 64, /* number of sprites */ - 3, /* bits per pixel */ - { 0, 0x4000*8, 2*0x4000*8 }, - { 0, 1, 2, 3, 4, 5, 6, 7, - 16*8+0, 16*8+1, 16*8+2, 16*8+3, 16*8+4, 16*8+5, 16*8+6, 16*8+7 }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, - 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8, - 256*64+0*8, 256*64+1*8, 256*64+2*8, 256*64+3*8, 256*64+4*8, 256*64+5*8, 256*64+6*8, 256*64+7*8, - 256*64+8*8, 256*64+9*8, 256*64+10*8, 256*64+11*8, 256*64+12*8, 256*64+13*8, 256*64+14*8, 256*64+15*8 }, - 32*8 /* character offset */ + 16,32, + RGN_FRAC(1,3), + 3, + { RGN_FRAC(0,3), RGN_FRAC(1,3), RGN_FRAC(2,3) }, + { STEP8(0,1), STEP8(16*8,1) }, + { STEP16(0,8), STEP16(256*64,8) }, + 32*8 }; -static GFXDECODE_START( troangel ) - GFXDECODE_ENTRY( REGION_GFX1, 0x0000, charlayout, 0, 32 ) - GFXDECODE_ENTRY( REGION_GFX2, 0x0000, spritelayout, 32*8, 32 ) - GFXDECODE_ENTRY( REGION_GFX2, 0x1000, spritelayout, 32*8, 32 ) - GFXDECODE_ENTRY( REGION_GFX2, 0x2000, spritelayout, 32*8, 32 ) - GFXDECODE_ENTRY( REGION_GFX2, 0x3000, spritelayout, 32*8, 32 ) +static GFXDECODE_START( m57 ) + GFXDECODE_ENTRY( REGION_GFX1, 0x0000, gfx_8x8x3_planar, 0, 32 ) + GFXDECODE_ENTRY( REGION_GFX2, 0x0000, spritelayout, 32*8, 32 ) GFXDECODE_END -static MACHINE_DRIVER_START( troangel ) +/************************************* + * + * Machine drivers + * + *************************************/ + +static MACHINE_DRIVER_START( m57 ) /* basic machine hardware */ MDRV_CPU_ADD(Z80, XTAL_18_432MHz/6) /* verified on pcb */ - MDRV_CPU_PROGRAM_MAP(troangel_readmem,troangel_writemem) + MDRV_CPU_PROGRAM_MAP(main_map,0) MDRV_CPU_VBLANK_INT(irq0_line_hold,1) MDRV_SCREEN_REFRESH_RATE(57) @@ -214,20 +216,24 @@ static MACHINE_DRIVER_START( troangel ) MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) MDRV_SCREEN_SIZE(32*8, 32*8) MDRV_SCREEN_VISIBLE_AREA(1*8, 31*8-1, 1*8, 31*8-1) - MDRV_GFXDECODE(troangel) - MDRV_PALETTE_LENGTH(32*8+16) - MDRV_COLORTABLE_LENGTH(32*8+32*8) + MDRV_GFXDECODE(m57) + MDRV_PALETTE_LENGTH(32*8+32*8) - MDRV_PALETTE_INIT(troangel) - MDRV_VIDEO_START(generic) - MDRV_VIDEO_UPDATE(troangel) + MDRV_PALETTE_INIT(m57) + MDRV_VIDEO_START(m57) + MDRV_VIDEO_UPDATE(m57) /* sound hardware */ - MDRV_IMPORT_FROM(irem_audio) + MDRV_IMPORT_FROM(m52_small_audio) MACHINE_DRIVER_END +/************************************* + * + * ROM definitions + * + *************************************/ ROM_START( troangel ) ROM_REGION( 0x10000, REGION_CPU1, 0 ) /* main CPU */ @@ -236,13 +242,13 @@ ROM_START( troangel ) ROM_LOAD( "ta-a-3n", 0x4000, 0x2000, CRC(de3dea44) SHA1(1290755ffc04dc3b3667e063118669a0eab6fb79) ) ROM_LOAD( "ta-a-3q", 0x6000, 0x2000, CRC(fff0fc2a) SHA1(82f3f5a8817e956192323eb555daa85b7766676d) ) - ROM_REGION( 0x10000 , REGION_CPU2, 0 ) /* sound CPU */ - ROM_LOAD( "ta-s-1a", 0xe000, 0x2000, CRC(15a83210) SHA1(8ada510db689ffa372b2f4dc4bd1b1c69a0c5307) ) + ROM_REGION( 0x8000 , REGION_CPU2, 0 ) /* sound CPU */ + ROM_LOAD( "ta-s-1a", 0x6000, 0x2000, CRC(15a83210) SHA1(8ada510db689ffa372b2f4dc4bd1b1c69a0c5307) ) ROM_REGION( 0x06000, REGION_GFX1, ROMREGION_DISPOSE ) - ROM_LOAD( "ta-a-3c", 0x00000, 0x2000, CRC(7ff5482f) SHA1(fe8c181fed113007d69d11e8aa467e86a6357ffb) ) /* characters */ + ROM_LOAD( "ta-a-3e", 0x00000, 0x2000, CRC(e49f7ad8) SHA1(915de1084fd3c5fc81dd8c80107c28cc57b33226) ) ROM_LOAD( "ta-a-3d", 0x02000, 0x2000, CRC(06eef241) SHA1(4f327a54169046d8d84b5f5cf5d9f45e1df4dae6) ) - ROM_LOAD( "ta-a-3e", 0x04000, 0x2000, CRC(e49f7ad8) SHA1(915de1084fd3c5fc81dd8c80107c28cc57b33226) ) + ROM_LOAD( "ta-a-3c", 0x04000, 0x2000, CRC(7ff5482f) SHA1(fe8c181fed113007d69d11e8aa467e86a6357ffb) ) /* characters */ ROM_REGION( 0x0c000, REGION_GFX2, ROMREGION_DISPOSE ) ROM_LOAD( "ta-b-5j", 0x00000, 0x2000, CRC(86895c0c) SHA1(b42b041e3e20dadd8411805d492133d371426ebf) ) /* sprites */ @@ -266,13 +272,13 @@ ROM_START( newtangl ) /* Offical "upgrade" or hack? */ ROM_LOAD( "3n", 0x4000, 0x2000, CRC(17b5a775) SHA1(d85c3371080bea82f19ac96fa0f1b332e1c86e27) ) ROM_LOAD( "3q", 0x6000, 0x2000, CRC(2e5fa773) SHA1(9a34fa43bde021fc7b00d8c3762c248e7b96dbf1) ) - ROM_REGION( 0x10000 , REGION_CPU2, 0 ) /* sound CPU */ - ROM_LOAD( "ta-s-1a-", 0xe000, 0x2000, CRC(ea8a05cb) SHA1(5683e4dca93066ee788287ab73a766fa303ebe84) ) + ROM_REGION( 0x8000 , REGION_CPU2, 0 ) /* sound CPU */ + ROM_LOAD( "ta-s-1a-", 0x6000, 0x2000, CRC(ea8a05cb) SHA1(5683e4dca93066ee788287ab73a766fa303ebe84) ) ROM_REGION( 0x06000, REGION_GFX1, ROMREGION_DISPOSE ) - ROM_LOAD( "ta-a-3c", 0x00000, 0x2000, CRC(7ff5482f) SHA1(fe8c181fed113007d69d11e8aa467e86a6357ffb) ) /* characters */ + ROM_LOAD( "ta-a-3e", 0x00000, 0x2000, CRC(e49f7ad8) SHA1(915de1084fd3c5fc81dd8c80107c28cc57b33226) ) ROM_LOAD( "ta-a-3d", 0x02000, 0x2000, CRC(06eef241) SHA1(4f327a54169046d8d84b5f5cf5d9f45e1df4dae6) ) - ROM_LOAD( "ta-a-3e", 0x04000, 0x2000, CRC(e49f7ad8) SHA1(915de1084fd3c5fc81dd8c80107c28cc57b33226) ) + ROM_LOAD( "ta-a-3c", 0x04000, 0x2000, CRC(7ff5482f) SHA1(fe8c181fed113007d69d11e8aa467e86a6357ffb) ) /* characters */ ROM_REGION( 0x0c000, REGION_GFX2, ROMREGION_DISPOSE ) ROM_LOAD( "5j", 0x00000, 0x2000, CRC(89409130) SHA1(3f37f820b1b86166cde7c039d657ebd036d490dd) ) /* sprites */ @@ -291,5 +297,11 @@ ROM_END -GAME( 1983, troangel, 0, troangel, troangel, 0, ROT0, "Irem", "Tropical Angel", 0 ) -GAME( 1983, newtangl, troangel, troangel, troangel, 0, ROT0, "Irem", "New Tropical Angel", 0 ) +/************************************* + * + * Game drivers + * + *************************************/ + +GAME( 1983, troangel, 0, m57, troangel, 0, ROT0, "Irem", "Tropical Angel", 0 ) +GAME( 1983, newtangl, troangel, m57, troangel, 0, ROT0, "Irem", "New Tropical Angel", 0 ) diff --git a/src/mame/drivers/yard.c b/src/mame/drivers/yard.c index 278b18ce7d9..5d794b377b6 100644 --- a/src/mame/drivers/yard.c +++ b/src/mame/drivers/yard.c @@ -11,6 +11,9 @@ Loosely based on the Kung Fu Master driver. #include "driver.h" #include "audio/irem.h" +#define MASTER_CLOCK XTAL_18_432MHz + + extern UINT8 *yard_scroll_x_low; extern UINT8 *yard_scroll_x_high; extern UINT8 *yard_scroll_y_low; @@ -186,42 +189,38 @@ static const gfx_layout spritelayout = /* Graphics Decode Information */ static GFXDECODE_START( yard ) - GFXDECODE_ENTRY( REGION_GFX1, 0, charlayout, 0, 32 ) // use colors 0-255 - GFXDECODE_ENTRY( REGION_GFX2, 0, spritelayout, 32*8, 32 ) // use colors 256-271 with lookup table -GFXDECODE_END// bitmapped radar uses colors 272-527 + GFXDECODE_ENTRY( REGION_GFX1, 0, charlayout, 0, 32 ) + GFXDECODE_ENTRY( REGION_GFX2, 0, spritelayout, 256, 32 ) +GFXDECODE_END /* Machine Driver */ static MACHINE_DRIVER_START( yard ) - // basic machine hardware - MDRV_CPU_ADD(Z80, 4000000) // ??? + + /* basic machine hardware */ + MDRV_CPU_ADD(Z80, MASTER_CLOCK/3/2) MDRV_CPU_PROGRAM_MAP(yard_map, 0) MDRV_CPU_VBLANK_INT(irq0_line_hold, 1) - MDRV_SCREEN_REFRESH_RATE(57) - MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(1790)) - /* accurate frequency, measured on a Moon Patrol board, is 56.75Hz. - the Lode Runner manual (similar but different hardware) - talks about 55Hz and 1790ms vblank duration. */ - - // video hardware + /* video hardware */ MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) - MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) - MDRV_SCREEN_SIZE(32*8, 32*8) - MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 1*8, 31*8-1) MDRV_GFXDECODE(yard) - MDRV_PALETTE_LENGTH(256+16+256) - MDRV_COLORTABLE_LENGTH(32*8+32*8) + MDRV_PALETTE_LENGTH(256+256+256) + + MDRV_SCREEN_ADD("main", 0) + MDRV_SCREEN_RAW_PARAMS(MASTER_CLOCK/3, 384, 0, 256, 282, 42, 266) + MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) MDRV_PALETTE_INIT(yard) MDRV_VIDEO_START(yard) MDRV_VIDEO_UPDATE(yard) - // sound hardware - MDRV_IMPORT_FROM(irem_audio) + /* sound hardware */ + MDRV_IMPORT_FROM(m52_large_audio) MACHINE_DRIVER_END + /* ROMs */ ROM_START( 10yard ) ROM_REGION( 0x10000, REGION_CPU1, 0 ) diff --git a/src/mame/includes/m52.h b/src/mame/includes/m52.h new file mode 100644 index 00000000000..73832eb0001 --- /dev/null +++ b/src/mame/includes/m52.h @@ -0,0 +1,24 @@ +/************************************************************************* + + Irem M52 hardware + +*************************************************************************/ + +/*----------- defined in video/m52.c -----------*/ + +READ8_HANDLER( m52_protection_r ); +WRITE8_HANDLER( m52_scroll_w ); +WRITE8_HANDLER( m52_bg1xpos_w ); +WRITE8_HANDLER( m52_bg1ypos_w ); +WRITE8_HANDLER( m52_bg2xpos_w ); +WRITE8_HANDLER( m52_bg2ypos_w ); +WRITE8_HANDLER( m52_bgcontrol_w ); +WRITE8_HANDLER( m52_flipscreen_w ); +WRITE8_HANDLER( m52_videoram_w ); +WRITE8_HANDLER( m52_colorram_w ); + +PALETTE_INIT( m52 ); +VIDEO_START( m52 ); +VIDEO_UPDATE( m52 ); + + diff --git a/src/mame/includes/m57.h b/src/mame/includes/m57.h new file mode 100644 index 00000000000..e2fa7d9da5f --- /dev/null +++ b/src/mame/includes/m57.h @@ -0,0 +1,17 @@ +/************************************************************************* + + Irem M57 hardware + +*************************************************************************/ + +/*----------- defined in video/m57.c -----------*/ + +extern UINT8 *m57_scroll; + +WRITE8_HANDLER( m57_videoram_w ); +WRITE8_HANDLER( m57_flipscreen_w ); + +PALETTE_INIT( m57 ); +VIDEO_START( m57 ); +VIDEO_UPDATE( m57 ); + diff --git a/src/mame/includes/m62.h b/src/mame/includes/m62.h new file mode 100644 index 00000000000..a3c3765f78d --- /dev/null +++ b/src/mame/includes/m62.h @@ -0,0 +1,62 @@ +/************************************************************************* + + Irem M62 hardware + +*************************************************************************/ + +/*----------- defined in video/centiped.c -----------*/ + +PALETTE_INIT( m62 ); +PALETTE_INIT( lotlot ); +PALETTE_INIT( battroad ); +PALETTE_INIT( spelunk2 ); + +WRITE8_HANDLER( m62_tileram_w ); +WRITE8_HANDLER( m62_textram_w ); +WRITE8_HANDLER( m62_flipscreen_w ); +WRITE8_HANDLER( m62_hscroll_low_w ); +WRITE8_HANDLER( m62_hscroll_high_w ); +WRITE8_HANDLER( m62_vscroll_low_w ); +WRITE8_HANDLER( m62_vscroll_high_w ); +extern UINT8 *m62_tileram; +extern UINT8 *m62_textram; + +VIDEO_START( kungfum ); +VIDEO_UPDATE( kungfum ); +WRITE8_HANDLER( kungfum_tileram_w ); + +VIDEO_START( ldrun ); +VIDEO_UPDATE( ldrun ); + +VIDEO_START( ldrun2 ); + +VIDEO_START( battroad ); +VIDEO_UPDATE( battroad ); + +VIDEO_START( ldrun4 ); +VIDEO_UPDATE( ldrun4 ); + +VIDEO_START( lotlot ); +VIDEO_UPDATE( lotlot ); + +WRITE8_HANDLER( kidniki_text_vscroll_low_w ); +WRITE8_HANDLER( kidniki_text_vscroll_high_w ); +WRITE8_HANDLER( kidniki_background_bank_w ); +VIDEO_START( kidniki ); +VIDEO_UPDATE( kidniki ); + +WRITE8_HANDLER( spelunkr_palbank_w ); +VIDEO_START( spelunkr ); +VIDEO_UPDATE( spelunkr ); + +WRITE8_HANDLER( spelunk2_gfxport_w ); +VIDEO_START( spelunk2 ); +VIDEO_UPDATE( spelunk2 ); + +VIDEO_START( youjyudn ); +VIDEO_UPDATE( youjyudn ); + +VIDEO_START( horizon ); +VIDEO_UPDATE( horizon ); +WRITE8_HANDLER( horizon_scrollram_w ); +extern UINT8 *horizon_scrollram; diff --git a/src/mame/video/m62.c b/src/mame/video/m62.c index e694f73647b..bf073bd1521 100644 --- a/src/mame/video/m62.c +++ b/src/mame/video/m62.c @@ -14,6 +14,7 @@ Tile/sprite priority system (for the Kung Fu Master M62 board): ***************************************************************************/ #include "driver.h" +#include "m62.h" #include "video/resnet.h" UINT8 *m62_tileram; diff --git a/src/mame/video/mpatrol.c b/src/mame/video/mpatrol.c index ba972213241..90745327ac7 100644 --- a/src/mame/video/mpatrol.c +++ b/src/mame/video/mpatrol.c @@ -1,12 +1,11 @@ /*************************************************************************** - video.c - - Functions to emulate the video hardware of the machine. + Irem M52 hardware ***************************************************************************/ #include "driver.h" +#include "m52.h" #define BGHEIGHT 64 @@ -52,20 +51,17 @@ static tilemap* bg_tilemap; bit 0 -- 1 kohm resistor -- BLUE ***************************************************************************/ -PALETTE_INIT( mpatrol ) +PALETTE_INIT( m52 ) { 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]) + machine->colortable = colortable_alloc(machine, 512+32+32); /* character palette */ for (i = 0;i < 512;i++) { int bit0,bit1,bit2,r,g,b; - COLOR(0, i) = i; - /* red component */ bit0 = (*color_prom >> 0) & 0x01; bit1 = (*color_prom >> 1) & 0x01; @@ -82,7 +78,8 @@ PALETTE_INIT( mpatrol ) bit2 = (*color_prom >> 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)); + colortable_entry_set_value(machine->colortable,i,i); color_prom++; } @@ -91,7 +88,6 @@ PALETTE_INIT( mpatrol ) { int bit0,bit1,bit2,r,g,b; - /* red component */ bit0 = (*color_prom >> 0) & 0x01; bit1 = (*color_prom >> 1) & 0x01; @@ -108,7 +104,7 @@ PALETTE_INIT( mpatrol ) bit2 = (*color_prom >> 7) & 0x01; b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - palette_set_color(machine,i+512,MAKE_RGB(r,g,b)); + colortable_palette_set_color(machine->colortable,i+512,MAKE_RGB(r,g,b)); color_prom++; } @@ -119,7 +115,6 @@ PALETTE_INIT( mpatrol ) { int bit0,bit1,bit2,r,g,b; - /* red component */ bit0 = 0; bit1 = (*color_prom >> 6) & 0x01; @@ -136,16 +131,16 @@ PALETTE_INIT( mpatrol ) bit2 = (*color_prom >> 2) & 0x01; b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - palette_set_color(machine,i+512+32,MAKE_RGB(r,g,b)); + colortable_palette_set_color(machine->colortable,i+512+32,MAKE_RGB(r,g,b)); color_prom++; } /* color_prom now points to the beginning of the sprite lookup table */ /* sprite lookup table */ - for (i = 0;i < TOTAL_COLORS(1);i++) + for (i = 0;i < 16*4;i++) { - COLOR(1,i) = 512+32 + (*color_prom++); + colortable_entry_set_value(machine->colortable, 512+i, 512+32+(*color_prom++)); if (i % 4 == 3) color_prom += 4; /* half of the PROM is unused */ } @@ -155,18 +150,18 @@ PALETTE_INIT( mpatrol ) /* xbb00: mountains */ /* 0xxbb: hills */ /* 1xxbb: city */ - COLOR(2,0) = 512; - COLOR(2,1) = 512+4; - COLOR(2,2) = 512+8; - COLOR(2,3) = 512+12; - COLOR(3,0) = 512; - COLOR(3,1) = 512+1; - COLOR(3,2) = 512+2; - COLOR(3,3) = 512+3; - COLOR(4,0) = 512; - COLOR(4,1) = 512+16+1; - COLOR(4,2) = 512+16+2; - COLOR(4,3) = 512+16+3; + colortable_entry_set_value(machine->colortable, 512+16*4+0*4+0, 512); + colortable_entry_set_value(machine->colortable, 512+16*4+0*4+1, 512+4); + colortable_entry_set_value(machine->colortable, 512+16*4+0*4+2, 512+8); + colortable_entry_set_value(machine->colortable, 512+16*4+0*4+3, 512+12); + colortable_entry_set_value(machine->colortable, 512+16*4+1*4+0, 512); + colortable_entry_set_value(machine->colortable, 512+16*4+1*4+1, 512+1); + colortable_entry_set_value(machine->colortable, 512+16*4+1*4+2, 512+2); + colortable_entry_set_value(machine->colortable, 512+16*4+1*4+3, 512+3); + colortable_entry_set_value(machine->colortable, 512+16*4+2*4+0, 512); + colortable_entry_set_value(machine->colortable, 512+16*4+2*4+1, 512+16+1); + colortable_entry_set_value(machine->colortable, 512+16*4+2*4+2, 512+16+2); + colortable_entry_set_value(machine->colortable, 512+16*4+2*4+3, 512+16+3); } @@ -196,7 +191,7 @@ static TILE_GET_INFO( get_tile_info ) -VIDEO_START( mpatrol ) +VIDEO_START( m52 ) { bg_tilemap = tilemap_create(get_tile_info, tilemap_scan_rows, TILEMAP_TYPE_PEN, 8, 8, 32, 32); @@ -214,7 +209,7 @@ VIDEO_START( mpatrol ) -WRITE8_HANDLER( mpatrol_scroll_w ) +WRITE8_HANDLER( m52_scroll_w ) { /* @@ -232,7 +227,7 @@ WRITE8_HANDLER( mpatrol_scroll_w ) -WRITE8_HANDLER( mpatrol_videoram_w ) +WRITE8_HANDLER( m52_videoram_w ) { videoram[offset] = data; tilemap_mark_tile_dirty(bg_tilemap, offset); @@ -240,7 +235,7 @@ WRITE8_HANDLER( mpatrol_videoram_w ) -WRITE8_HANDLER( mpatrol_colorram_w ) +WRITE8_HANDLER( m52_colorram_w ) { colorram[offset] = data; tilemap_mark_tile_dirty(bg_tilemap, offset); @@ -248,9 +243,9 @@ WRITE8_HANDLER( mpatrol_colorram_w ) /* This looks like some kind of protection implemented by a custom chip on the - scroll board. It mangles the value written to the port mpatrol_bg1xpos_w, as + scroll board. It mangles the value written to the port m52_bg1xpos_w, as follows: result = popcount(value & 0x7f) ^ (value >> 7) */ -READ8_HANDLER( mpatrol_protection_r ) +READ8_HANDLER( m52_protection_r ) { int popcount = 0; int temp; @@ -261,30 +256,30 @@ READ8_HANDLER( mpatrol_protection_r ) } -WRITE8_HANDLER( mpatrol_bg1ypos_w ) +WRITE8_HANDLER( m52_bg1ypos_w ) { bg1ypos = data; } -WRITE8_HANDLER( mpatrol_bg1xpos_w ) +WRITE8_HANDLER( m52_bg1xpos_w ) { bg1xpos = data; } -WRITE8_HANDLER( mpatrol_bg2xpos_w ) +WRITE8_HANDLER( m52_bg2xpos_w ) { bg2xpos = data; } -WRITE8_HANDLER( mpatrol_bg2ypos_w ) +WRITE8_HANDLER( m52_bg2ypos_w ) { bg2ypos = data; } -WRITE8_HANDLER( mpatrol_bgcontrol_w ) +WRITE8_HANDLER( m52_bgcontrol_w ) { bgcontrol = data; } -WRITE8_HANDLER( mpatrol_flipscreen_w ) +WRITE8_HANDLER( m52_flipscreen_w ) { coin_counter_w(0, data & 0x02); coin_counter_w(1, data & 0x20); @@ -345,7 +340,7 @@ static void draw_background(running_machine *machine, mame_bitmap *bitmap, const -VIDEO_UPDATE( mpatrol ) +VIDEO_UPDATE( m52 ) { int offs; @@ -409,7 +404,8 @@ VIDEO_UPDATE( mpatrol ) drawgfx(bitmap, machine->gfx[1], code, color, flipx, flipy, sx, sy, - &clip, TRANSPARENCY_COLOR, 512+32); + &clip, TRANSPARENCY_PENS, + colortable_get_transpen_mask(machine->colortable, machine->gfx[1], color, 512+32)); } return 0; } diff --git a/src/mame/video/troangel.c b/src/mame/video/troangel.c index d657c2bdbae..d891a4b43d3 100644 --- a/src/mame/video/troangel.c +++ b/src/mame/video/troangel.c @@ -1,9 +1,17 @@ +/**************************************************************************** + + Irem M57 hardware + +****************************************************************************/ + #include "driver.h" +#include "m57.h" -UINT8 *troangel_scroll; +UINT8 *m57_scroll; static int flipscreen; +static tilemap *bg_tilemap; /*************************************************************************** @@ -27,19 +35,17 @@ static int flipscreen; bit 0 -- 1 kohm resistor -- BLUE ***************************************************************************/ -PALETTE_INIT( troangel ) +PALETTE_INIT( m57 ) { 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]) + machine->colortable = colortable_alloc(machine, 32*8+16); /* character palette */ for (i = 0;i < 256;i++) { int bit0,bit1,bit2,r,g,b; - /* red component */ bit0 = 0; bit1 = (color_prom[256] >> 2) & 0x01; @@ -56,21 +62,19 @@ PALETTE_INIT( troangel ) bit2 = (color_prom[0] >> 2) & 0x01; b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - palette_set_color(machine,i,MAKE_RGB(r,g,b)); - COLOR(0,i) = i; + colortable_palette_set_color(machine->colortable,i,MAKE_RGB(r,g,b)); + colortable_entry_set_value(machine->colortable,i,i); color_prom++; } color_prom += 256; /* color_prom now points to the beginning of the sprite palette */ - /* sprite palette */ for (i = 0;i < 16;i++) { int bit0,bit1,bit2,r,g,b; - /* red component */ bit0 = 0; bit1 = (*color_prom >> 6) & 0x01; @@ -87,7 +91,7 @@ PALETTE_INIT( troangel ) bit2 = (*color_prom >> 2) & 0x01; b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - palette_set_color(machine,i+256,MAKE_RGB(r,g,b)); + colortable_palette_set_color(machine->colortable,i+256,MAKE_RGB(r,g,b)); color_prom++; } @@ -96,21 +100,44 @@ PALETTE_INIT( troangel ) /* sprite lookup table */ - for (i = 0;i < TOTAL_COLORS(1);i++) + for (i = 0;i < 32*8;i++) { - COLOR(1,i) = 256 + (~*color_prom & 0x0f); + colortable_entry_set_value(machine->colortable,i+32*8,256 + (~*color_prom & 0x0f)); color_prom++; } } +static TILE_GET_INFO( get_tile_info ) +{ + UINT8 attr = videoram[tile_index*2 + 0]; + UINT16 code = videoram[tile_index*2 + 1] | ((attr & 0xc0) << 2); -WRITE8_HANDLER( troangel_flipscreen_w ) + SET_TILE_INFO(0, code, attr & 0x0f, TILE_FLIPXY(attr >> 4)); +} + + +WRITE8_HANDLER( m57_videoram_w ) +{ + videoram[offset] = data; + tilemap_mark_tile_dirty(bg_tilemap, offset / 2); +} + + +VIDEO_START( m57 ) +{ + bg_tilemap = tilemap_create(get_tile_info, tilemap_scan_rows, TILEMAP_TYPE_PEN, 8, 8, 32, 32); + tilemap_set_scroll_rows(bg_tilemap, 256); +} + + +WRITE8_HANDLER( m57_flipscreen_w ) { /* screen flip is handled both by software and hardware */ data ^= ~readinputport(4) & 1; flipscreen = data & 1; + tilemap_set_flip(bg_tilemap, flipscreen ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0); coin_counter_w(0,data & 0x02); coin_counter_w(1,data & 0x20); @@ -121,65 +148,11 @@ WRITE8_HANDLER( troangel_flipscreen_w ) static void draw_background(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect) { - int offs; - const gfx_element *gfx = machine->gfx[0]; - - for (offs = videoram_size - 2;offs >= 0;offs -= 2) - { - int sx,sy,code,attr,flipx,flipy; - - - sx = (offs/2) % 32; - sy = (offs/2) / 32; - - attr = videoram[offs+0]; - code = videoram[offs+1] | ((attr & 0xc0) << 2); - flipx = attr & 0x20; - flipy = (attr & 0x10) >> 4; - - if (flipscreen) - { - sx = 31 - sx; - sy = 31 - sy; - flipx = !flipx; - } - - drawgfx(tmpbitmap,gfx, - code, - attr & 0x0f, - flipx,flipy ^ flipscreen, - 8*sx,8*sy, - 0,TRANSPARENCY_NONE,0); - } - - { - int xscroll[256]; - - if (flipscreen) - { - /* fixed */ - for (offs = 0;offs < 64;offs++) xscroll[255-offs] = 0; - - /* scroll (wraps around) */ - for (offs = 64;offs < 128;offs++) xscroll[255-offs] = troangel_scroll[64]; - - /* linescroll (no wrap) */ - for (offs = 128;offs < 256;offs++) xscroll[255-offs] = troangel_scroll[offs]; - } - else - { - /* fixed */ - for (offs = 0;offs < 64;offs++) xscroll[offs] = 0; - - /* scroll (wraps around) */ - for (offs = 64;offs < 128;offs++) xscroll[offs] = -troangel_scroll[64]; - - /* linescroll (no wrap) */ - for (offs = 128;offs < 256;offs++) xscroll[offs] = -troangel_scroll[offs]; - } - - copyscrollbitmap(bitmap,tmpbitmap,256,xscroll,0,0,cliprect,TRANSPARENCY_NONE,0); - } + int y; + + for (y = 0; y < 256; y++) + tilemap_set_scrollx(bg_tilemap, y, (y < 64) ? 0 : (y < 128) ? m57_scroll[64] : m57_scroll[y]); + tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0); } static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect) @@ -197,11 +170,7 @@ static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const re int flipy = attributes&0x80; int flipx = attributes&0x40; - int tile_number = code & 0x3f; - - int bank = 0; - if( code&0x80 ) bank += 1; - if( attributes&0x20 ) bank += 2; + int tile_number = code + ((attributes & 0x20) << 3); if (flipscreen) { @@ -211,18 +180,19 @@ static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const re flipy = !flipy; } - drawgfx(bitmap,machine->gfx[1+bank], + drawgfx(bitmap,machine->gfx[1], tile_number, color, flipx,flipy, sx,sy, - cliprect,TRANSPARENCY_PEN,0); + cliprect,TRANSPARENCY_PENS, + colortable_get_transpen_mask(machine->colortable, machine->gfx[1], color, 256+15)); } } -VIDEO_UPDATE( troangel ) +VIDEO_UPDATE( m57 ) { draw_background(machine, bitmap, cliprect); draw_sprites(machine, bitmap, cliprect); diff --git a/src/mame/video/yard.c b/src/mame/video/yard.c index b74249be983..53720907eef 100644 --- a/src/mame/video/yard.c +++ b/src/mame/video/yard.c @@ -23,21 +23,8 @@ static mame_bitmap *scroll_panel_bitmap; static tilemap *bg_tilemap; #define SCROLL_PANEL_WIDTH (14*4) -#define RADAR_PALETTE_BASE (256+16) -#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]) +#define RADAR_PALETTE_BASE (256+256) -static const rectangle clippanel = -{ - 26*8, 32*8-1, - 1*8, 31*8-1 -}; - -static const rectangle clippanelflip = -{ - 0*8, 6*8-1, - 1*8, 31*8-1 -}; /*************************************************************************** @@ -65,6 +52,8 @@ PALETTE_INIT( yard ) { int i; + machine->colortable = colortable_alloc(machine, 256+16+256); + /* character palette */ for (i = 0;i < 256;i++) { @@ -86,7 +75,8 @@ PALETTE_INIT( yard ) bit2 = (color_prom[0] >> 2) & 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)); + colortable_entry_set_value(machine->colortable,i,i); color_prom++; } @@ -115,7 +105,7 @@ PALETTE_INIT( yard ) bit2 = (*color_prom >> 2) & 0x01; b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - palette_set_color(machine,i+256,MAKE_RGB(r,g,b)); + colortable_palette_set_color(machine->colortable,256+i,MAKE_RGB(r,g,b)); color_prom++; } @@ -124,8 +114,8 @@ PALETTE_INIT( yard ) /* color_prom now points to the beginning of the sprite lookup table */ /* sprite lookup table */ - for (i = 0;i < TOTAL_COLORS(1);i++) - COLOR(1,i) = 256 + (*(color_prom++) & 0x0f); + for (i = 0;i < 256;i++) + colortable_entry_set_value(machine->colortable,256+i,256+(*color_prom++ & 0x0f)); /* color_prom now points to the beginning of the radar palette */ @@ -150,7 +140,8 @@ PALETTE_INIT( yard ) bit2 = (color_prom[0] >> 2) & 0x01; b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - palette_set_color(machine,i+256+16,MAKE_RGB(r,g,b)); + colortable_palette_set_color(machine->colortable,256+16+i,MAKE_RGB(r,g,b)); + colortable_entry_set_value(machine->colortable,256+256+i,256+16+i); color_prom++; } @@ -180,7 +171,7 @@ WRITE8_HANDLER( yard_scroll_panel_w ) col = (data >> i) & 0x11; col = ((col >> 3) | col) & 3; - *BITMAP_ADDR16(scroll_panel_bitmap, sy, sx + i) = Machine->pens[RADAR_PALETTE_BASE + (sy & 0xfc) + col]; + *BITMAP_ADDR16(scroll_panel_bitmap, sy, sx + i) = RADAR_PALETTE_BASE + (sy & 0xfc) + col; } } @@ -206,13 +197,14 @@ static UINT32 yard_tilemap_scan_rows( UINT32 col, UINT32 row, UINT32 num_cols, U VIDEO_START( yard ) { - bg_tilemap = tilemap_create(yard_get_bg_tile_info, yard_tilemap_scan_rows, - TILEMAP_TYPE_PEN, 8, 8, 64, 32); + bg_tilemap = tilemap_create(yard_get_bg_tile_info, yard_tilemap_scan_rows, TILEMAP_TYPE_PEN, 8, 8, 64, 32); + tilemap_set_scrolldx(bg_tilemap, machine->screen[0].visarea.min_x, machine->screen[0].width - (machine->screen[0].visarea.max_x + 1)); + tilemap_set_scrolldy(bg_tilemap, machine->screen[0].visarea.min_y - 8, machine->screen[0].height + 16 - (machine->screen[0].visarea.max_y + 1)); scroll_panel_bitmap = auto_bitmap_alloc(SCROLL_PANEL_WIDTH, machine->screen[0].height, machine->screen[0].format); } -#define DRAW_SPRITE(code, sy) drawgfx(bitmap, machine->gfx[1], code, color, flipx, flipy, sx, sy, cliprect, TRANSPARENCY_COLOR, 256); +#define DRAW_SPRITE(code, sy) drawgfx(bitmap, machine->gfx[1], code, color, flipx, flipy, sx, sy, cliprect, TRANSPARENCY_PENS, colortable_get_transpen_mask(machine->colortable, machine->gfx[1], color, 256)); static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect ) { @@ -228,7 +220,7 @@ static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const re int flipx = attr & 0x40; int flipy = attr & 0x80; int sx = spriteram[offs + 3]; - int sy1 = 241 - spriteram[offs]; + int sy1 = 233 - spriteram[offs]; int sy2 = 0; if (flipy) @@ -244,7 +236,7 @@ static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const re if (flip_screen) { sx = 240 - sx; - sy2 = 224 - sy1; + sy2 = 192 - sy1; sy1 = sy2 + 0x10; flipx = !flipx; flipy = !flipy; @@ -254,19 +246,34 @@ static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const re sy2 = sy1 + 0x10; } - DRAW_SPRITE(code1 + 256 * bank, sy1) - DRAW_SPRITE(code2 + 256 * bank, sy2) + DRAW_SPRITE(code1 + 256 * bank, machine->screen[0].visarea.min_y + sy1) + DRAW_SPRITE(code2 + 256 * bank, machine->screen[0].visarea.min_y + sy2) } } -static void draw_panel( mame_bitmap *bitmap, const rectangle *cliprect ) +static void draw_panel( running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect ) { if (! *yard_score_panel_disabled) { + static const rectangle clippanel = + { + 26*8, 32*8-1, + 1*8, 31*8-1 + }; + static const rectangle clippanelflip = + { + 0*8, 6*8-1, + 1*8, 31*8-1 + }; + rectangle clip = flip_screen ? clippanelflip : clippanel; int sx = flip_screen ? cliprect->min_x - 8 : cliprect->max_x + 1 - SCROLL_PANEL_WIDTH; + int yoffs = flip_screen ? -40 : -16; + + clip.min_y += machine->screen[0].visarea.min_y + yoffs; + clip.max_y += machine->screen[0].visarea.max_y + yoffs; - copybitmap(bitmap, scroll_panel_bitmap, flip_screen, flip_screen, sx, 0, - flip_screen ? &clippanelflip : &clippanel, TRANSPARENCY_NONE, 0); + copybitmap(bitmap, scroll_panel_bitmap, flip_screen, flip_screen, sx, machine->screen[0].visarea.min_y + yoffs, + &clip, TRANSPARENCY_NONE, 0); } } @@ -277,6 +284,6 @@ VIDEO_UPDATE( yard ) tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0); draw_sprites(machine, bitmap, cliprect); - draw_panel(bitmap, cliprect); + draw_panel(machine, bitmap, cliprect); return 0; }