diff --git a/src/mame/drivers/shootout.cpp b/src/mame/drivers/shootout.cpp index 13c31bd4079..ec1565abaec 100644 --- a/src/mame/drivers/shootout.cpp +++ b/src/mame/drivers/shootout.cpp @@ -13,9 +13,14 @@ arm? Shoot Out (Korean bootleg) is based on the earlier DE-0203 board but - strangely features the same encryption as used on the DE-0219 board. It + strangely features the same encryption as used on the DE-0219 board. It also has some edited graphics. + The DE-0219 PCB seems to have only one 12 MHz XTAL, some images with recognizable XTAL value can be found here: + - http://www.jammarcade.net/images/2016/04/Shootout.jpg + - http://thumbs.picclick.com/00/s/MTIwMFgxNjAw/z/7iIAAOSw5ClXxbrB/$/Data-East-Shootout-Arcade-Video-Game-Pcb-Circuit-_57.jpg + + Driver by: Ernesto Corvi (ernesto@imagina.com) Phil Stroffolino @@ -23,8 +28,9 @@ TODO: - - Fix coin counter - - Lots of unmapped memory reads + - Lots of unmapped memory reads and writes (sprram or vram mirrors, perhaps...), bg_vram is also read. + - Does the korean bootleg really have the DECO 222 CPU? I think it should use the shootclr.003 prom to decrypt the opcodes. + Something like -> rom [addr] = (rom [addr] & 0x0F) | proms [rom [addr] >> 4]]); *******************************************************************************/ @@ -49,10 +55,19 @@ WRITE8_MEMBER(shootout_state::bankswitch_w) membank("bank1")->set_entry(data & 0x0f); } +READ8_MEMBER(shootout_state::sound_cpu_command_r) +{ + m_audiocpu->set_input_line (INPUT_LINE_NMI, CLEAR_LINE); + return (m_soundlatch->read (space, 0)); +} + WRITE8_MEMBER(shootout_state::sound_cpu_command_w) { m_soundlatch->write( space, offset, data ); - m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE ); + m_audiocpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); + + // Allow the other CPU to reply. This fixes the missing music on the title screen (parent set). + space.device ().execute ().spin_until_time (attotime :: from_usec (200)); } WRITE8_MEMBER(shootout_state::flipscreen_w) @@ -60,9 +75,27 @@ WRITE8_MEMBER(shootout_state::flipscreen_w) flip_screen_set(data & 0x01); } +/* + This is actually a double BCD counter (2 BCD digits packet in a byte)... + The first write is always 0x40, then when a coin is inserted it starts to count from 0x01 up to 0x99. + When it reaches 99 credits, 0x99 is always written... + + On the shootoutj and shootoutb sets, it works as above but it counts up to 0x09 instead of 0x99 (Single BCD digit). + + Note: + This should be an input for a BCD to 7-segment decoder (e.g. a 74LS47), but all the PCBs I've seen don't have 'onboard' + display(s), so this was implemented as normal "coin counter" (after all, they both have the same goal: count credits ;)) +*/ WRITE8_MEMBER(shootout_state::coincounter_w) { - machine().bookkeeping().coin_counter_w(0, data); + if (data != m_ccnt_old_val) + { + // Do a coin pulse + machine().bookkeeping().coin_counter_w(0, 0); + machine().bookkeeping().coin_counter_w(0, 1); + + m_ccnt_old_val = data; + } } /*******************************************************************************/ @@ -78,7 +111,7 @@ static ADDRESS_MAP_START( shootout_map, AS_PROGRAM, 8, shootout_state ) AM_RANGE(0x2000, 0x27ff) AM_RAM_WRITE(textram_w) AM_SHARE("textram") AM_RANGE(0x2800, 0x2fff) AM_RAM_WRITE(videoram_w) AM_SHARE("videoram") AM_RANGE(0x4000, 0x7fff) AM_ROMBANK("bank1") - AM_RANGE(0x8000, 0xffff) AM_ROM + AM_RANGE(0x8000, 0xffff) AM_ROM AM_REGION("maincpu", 0x0000) ADDRESS_MAP_END static ADDRESS_MAP_START( shootouj_map, AS_PROGRAM, 8, shootout_state ) @@ -87,13 +120,14 @@ static ADDRESS_MAP_START( shootouj_map, AS_PROGRAM, 8, shootout_state ) AM_RANGE(0x1001, 0x1001) AM_READ_PORT("P1") AM_RANGE(0x1002, 0x1002) AM_READ_PORT("P2") AM_RANGE(0x1003, 0x1003) AM_READ_PORT("DSW2") + AM_RANGE(0x1004, 0x17ff) AM_RAM AM_RANGE(0x1800, 0x1800) AM_WRITE(coincounter_w) AM_RANGE(0x2000, 0x21ff) AM_RAM AM_SHARE("spriteram") AM_RANGE(0x2800, 0x2801) AM_DEVREADWRITE("ymsnd", ym2203_device, read, write) AM_RANGE(0x3000, 0x37ff) AM_RAM_WRITE(textram_w) AM_SHARE("textram") AM_RANGE(0x3800, 0x3fff) AM_RAM_WRITE(videoram_w) AM_SHARE("videoram") AM_RANGE(0x4000, 0x7fff) AM_ROMBANK("bank1") - AM_RANGE(0x8000, 0xffff) AM_ROM + AM_RANGE(0x8000, 0xffff) AM_ROM AM_REGION("maincpu", 0x0000) ADDRESS_MAP_END /*******************************************************************************/ @@ -102,9 +136,9 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( shootout_sound_map, AS_PROGRAM, 8, shootout_state ) AM_RANGE(0x0000, 0x07ff) AM_RAM AM_RANGE(0x4000, 0x4001) AM_DEVREADWRITE("ymsnd", ym2203_device, read, write) - AM_RANGE(0xa000, 0xa000) AM_DEVREAD("soundlatch", generic_latch_8_device, read) - AM_RANGE(0xc000, 0xffff) AM_ROM - AM_RANGE(0xd000, 0xd000) AM_WRITENOP // unknown, NOT irq/nmi mask + AM_RANGE(0xa000, 0xa000) AM_READ(sound_cpu_command_r) + AM_RANGE(0xc000, 0xffff) AM_ROM AM_REGION("audiocpu", 0x0000) + AM_RANGE(0xd000, 0xd000) AM_WRITENOP // Unknown, NOT irq/nmi mask (Always 0x80 ???) ADDRESS_MAP_END /*******************************************************************************/ @@ -173,8 +207,8 @@ static INPUT_PORTS_START( shootout ) PORT_DIPSETTING( 0x20, DEF_STR( Normal ) ) PORT_DIPSETTING( 0x10, DEF_STR( Hard ) ) PORT_DIPSETTING( 0x00, DEF_STR( Very_Hard ) ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SPECIAL ) /* this is set when either coin is inserted */ - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_VBLANK("screen") + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) // This needs to be low to allows both coins to be accepted... + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_VBLANK("screen") INPUT_PORTS_END static INPUT_PORTS_START( shootouj ) @@ -231,23 +265,26 @@ static GFXDECODE_START( shootout ) GFXDECODE_ENTRY( "gfx3", 0, tile_layout, 0, 16 ) /* tiles */ GFXDECODE_END - +void shootout_state::machine_reset () +{ + m_ccnt_old_val = 0x40; +} static MACHINE_CONFIG_START( shootout, shootout_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", DECO_222, 2000000) /* 2 MHz? */ + MCFG_CPU_ADD("maincpu", DECO_222, XTAL_12MHz / 6) // 2 MHz? MCFG_CPU_PROGRAM_MAP(shootout_map) - MCFG_CPU_ADD("audiocpu", M6502, 1500000) + MCFG_CPU_ADD("audiocpu", M6502, XTAL_12MHz / 8) // 1.5 MHz MCFG_CPU_PROGRAM_MAP(shootout_sound_map) /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */) - MCFG_SCREEN_SIZE(32*8, 32*8) - MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 1*8, 31*8-1) + + // Guessed parameters based on the 12 MHz XTAL, but they seem resonable (TODO: Real PCB measurements) + MCFG_SCREEN_RAW_PARAMS (XTAL_12MHz / 2, 384, 0, 256, 262, 8, 248) + MCFG_SCREEN_UPDATE_DRIVER(shootout_state, screen_update_shootout) MCFG_SCREEN_PALETTE("palette") @@ -260,24 +297,24 @@ static MACHINE_CONFIG_START( shootout, shootout_state ) MCFG_GENERIC_LATCH_8_ADD("soundlatch") - MCFG_SOUND_ADD("ymsnd", YM2203, 1500000) + MCFG_SOUND_ADD("ymsnd", YM2203, XTAL_12MHz / 8) // 1.5 MHz MCFG_YM2203_IRQ_HANDLER(INPUTLINE("audiocpu", M6502_IRQ_LINE)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) MACHINE_CONFIG_END static MACHINE_CONFIG_START( shootouj, shootout_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M6502, 2000000) /* 2 MHz? */ + MCFG_CPU_ADD("maincpu", M6502, XTAL_12MHz / 6) // 2 MHz? (Assuming the same XTAL as DE-0219 pcb) MCFG_CPU_PROGRAM_MAP(shootouj_map) /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */) - MCFG_SCREEN_SIZE(32*8, 32*8) - MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 1*8, 31*8-1) + + // Guessed parameters based on the 12 MHz XTAL, but they seem resonable (TODO: Real PCB measurements) + MCFG_SCREEN_RAW_PARAMS (XTAL_12MHz / 2, 384, 0, 256, 262, 8, 248) + MCFG_SCREEN_UPDATE_DRIVER(shootout_state, screen_update_shootouj) MCFG_SCREEN_PALETTE("palette") @@ -290,31 +327,30 @@ static MACHINE_CONFIG_START( shootouj, shootout_state ) MCFG_GENERIC_LATCH_8_ADD("soundlatch") - MCFG_SOUND_ADD("ymsnd", YM2203, 1500000) + MCFG_SOUND_ADD("ymsnd", YM2203, XTAL_12MHz / 8) // 1.5 MHz (Assuming the same XTAL as DE-0219 pcb) MCFG_YM2203_IRQ_HANDLER(INPUTLINE("maincpu", M6502_IRQ_LINE)) MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(shootout_state, bankswitch_w)) MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(shootout_state, flipscreen_w)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( shootouk, shootouj ) /* the Korean 'bootleg' has the usual DECO222 style encryption */ MCFG_DEVICE_REMOVE("maincpu") - MCFG_CPU_ADD("maincpu", DECO_222, 2000000) /* 2 MHz? */ + MCFG_CPU_ADD("maincpu", DECO_222, XTAL_12MHz / 6) // 2 MHz? (Assuming the same XTAL as DE-0219 pcb) MCFG_CPU_PROGRAM_MAP(shootouj_map) MACHINE_CONFIG_END ROM_START( shootout ) - ROM_REGION( 2*0x20000, "maincpu", 0 ) /* 128k for code + 128k for decrypted opcodes */ - ROM_LOAD( "cu00.b1", 0x08000, 0x8000, CRC(090edeb6) SHA1(ab849d123dacf3947b1ebd29b70a20e066911a60) ) /* opcodes encrypted */ - /* banked at 0x4000-0x8000 */ - ROM_LOAD( "cu02.c3", 0x10000, 0x8000, CRC(2a913730) SHA1(584488278d58c4d34a2eebeaf39518f87cf5eecd) ) /* opcodes encrypted */ - ROM_LOAD( "cu01.c1", 0x18000, 0x4000, CRC(8843c3ae) SHA1(c58ed4acac566f890cadf62bcbcced07a59243fc) ) /* opcodes encrypted */ + ROM_REGION( 2 * 0x14000, "maincpu", 0 ) // 80k for code + 80k for decrypted opcodes + ROM_LOAD( "cu00.b1", 0x00000, 0x8000, CRC(090edeb6) SHA1(ab849d123dacf3947b1ebd29b70a20e066911a60) ) /* opcodes encrypted */ + ROM_LOAD( "cu02.c3", 0x08000, 0x8000, CRC(2a913730) SHA1(584488278d58c4d34a2eebeaf39518f87cf5eecd) ) /* opcodes encrypted */ + ROM_LOAD( "cu01.c1", 0x10000, 0x4000, CRC(8843c3ae) SHA1(c58ed4acac566f890cadf62bcbcced07a59243fc) ) /* opcodes encrypted */ - ROM_REGION( 0x10000, "audiocpu", 0 ) - ROM_LOAD( "cu09.j1", 0x0c000, 0x4000, CRC(c4cbd558) SHA1(0e940ae99febc1161e5f35550aa75afca88cb5e9) ) /* Sound CPU */ + ROM_REGION( 0x4000, "audiocpu", 0 ) + ROM_LOAD( "cu09.j1", 0x00000, 0x4000, CRC(c4cbd558) SHA1(0e940ae99febc1161e5f35550aa75afca88cb5e9) ) /* Sound CPU */ ROM_REGION( 0x04000, "gfx1", 0 ) ROM_LOAD( "cu11.h19", 0x00000, 0x4000, CRC(eff00460) SHA1(15daaa3d3125a981a26f31d43283faa5be26e96b) ) /* foreground characters */ @@ -339,10 +375,10 @@ ROM_START( shootout ) ROM_END ROM_START( shootoutj ) - ROM_REGION( 0x20000, "maincpu", 0 ) /* 128k for code */ - ROM_LOAD( "cg02.bin", 0x08000, 0x8000, CRC(8fc5d632) SHA1(809ac4eba09972229fe741c96fa8036d7139b6a8) ) - ROM_LOAD( "cg00.bin", 0x10000, 0x8000, CRC(ef6ced1e) SHA1(feea508c7a60fc6cde1efee52cba628accd26028) ) - ROM_LOAD( "cg01.bin", 0x18000, 0x4000, CRC(74cf11ca) SHA1(59edbc4633cd560e7b928b33e4c42d0125332a1b) ) + ROM_REGION( 0x14000, "maincpu", 0 ) // 80k for code + ROM_LOAD( "cg02.bin", 0x00000, 0x8000, CRC(8fc5d632) SHA1(809ac4eba09972229fe741c96fa8036d7139b6a8) ) + ROM_LOAD( "cg00.bin", 0x08000, 0x8000, CRC(ef6ced1e) SHA1(feea508c7a60fc6cde1efee52cba628accd26028) ) + ROM_LOAD( "cg01.bin", 0x10000, 0x4000, CRC(74cf11ca) SHA1(59edbc4633cd560e7b928b33e4c42d0125332a1b) ) ROM_REGION( 0x04000, "gfx1", 0 ) ROM_LOAD( "cu11.h19", 0x00000, 0x4000, CRC(eff00460) SHA1(15daaa3d3125a981a26f31d43283faa5be26e96b) ) /* foreground characters */ @@ -364,10 +400,10 @@ ROM_START( shootoutj ) ROM_END ROM_START( shootoutb ) - ROM_REGION( 2*0x20000, "maincpu", 0 ) /* 128k for code + 128k for decrypted opcodes */ - ROM_LOAD( "shootout.006", 0x08000, 0x8000, CRC(2c054888) SHA1(cb0de2f7d743506789626304e6bcbbc292fbe8bc) ) - ROM_LOAD( "shootout.008", 0x10000, 0x8000, CRC(9651b656) SHA1(e90eddf2833ef36fa73b7b8d81d28443d2f60220) ) - ROM_LOAD( "cg01.bin", 0x18000, 0x4000, CRC(74cf11ca) SHA1(59edbc4633cd560e7b928b33e4c42d0125332a1b) ) + ROM_REGION( 2 * 0x14000, "maincpu", 0 ) // 80k for code + 80k for decrypted opcodes + ROM_LOAD( "shootout.006", 0x00000, 0x8000, CRC(2c054888) SHA1(cb0de2f7d743506789626304e6bcbbc292fbe8bc) ) + ROM_LOAD( "shootout.008", 0x08000, 0x8000, CRC(9651b656) SHA1(e90eddf2833ef36fa73b7b8d81d28443d2f60220) ) + ROM_LOAD( "cg01.bin", 0x10000, 0x4000, CRC(74cf11ca) SHA1(59edbc4633cd560e7b928b33e4c42d0125332a1b) ) ROM_REGION( 0x04000, "gfx1", 0 ) ROM_LOAD( "cu11.h19", 0x00000, 0x4000, CRC(eff00460) SHA1(15daaa3d3125a981a26f31d43283faa5be26e96b) ) /* foreground characters */ @@ -392,10 +428,10 @@ ROM_END DRIVER_INIT_MEMBER(shootout_state,shootout) { - membank("bank1")->configure_entries(0, 16, memregion("maincpu")->base() + 0x10000, 0x4000); + membank("bank1")->configure_entries(0, 16, memregion("maincpu")->base() + 0x8000, 0x4000); } -GAME( 1985, shootout, 0, shootout, shootout, shootout_state, shootout, ROT0, "Data East USA", "Shoot Out (US)", MACHINE_SUPPORTS_SAVE ) -GAME( 1985, shootoutj, shootout, shootouj, shootouj, shootout_state, shootout, ROT0, "Data East Corporation", "Shoot Out (Japan)", MACHINE_SUPPORTS_SAVE ) -GAME( 1985, shootoutb, shootout, shootouk, shootout, shootout_state, shootout, ROT0, "bootleg", "Shoot Out (Korean Bootleg)", MACHINE_SUPPORTS_SAVE ) +GAME( 1985, shootout, 0, shootout, shootout, shootout_state, shootout, ROT0, "Data East USA", "Shoot Out (US)", MACHINE_SUPPORTS_SAVE ) +GAME( 1985, shootoutj, shootout, shootouj, shootouj, shootout_state, shootout, ROT0, "Data East Corporation", "Shoot Out (Japan)", MACHINE_SUPPORTS_SAVE ) +GAME( 1985, shootoutb, shootout, shootouk, shootout, shootout_state, shootout, ROT0, "bootleg", "Shoot Out (Korean Bootleg)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/includes/shootout.h b/src/mame/includes/shootout.h index fc1486b03fb..4a0965797eb 100644 --- a/src/mame/includes/shootout.h +++ b/src/mame/includes/shootout.h @@ -29,9 +29,11 @@ public: tilemap_t *m_background; tilemap_t *m_foreground; - int m_bFlicker; + + int m_ccnt_old_val; DECLARE_WRITE8_MEMBER(bankswitch_w); + DECLARE_READ8_MEMBER(sound_cpu_command_r); DECLARE_WRITE8_MEMBER(sound_cpu_command_w); DECLARE_WRITE8_MEMBER(flipscreen_w); DECLARE_WRITE8_MEMBER(coincounter_w); @@ -41,7 +43,10 @@ public: DECLARE_INPUT_CHANGED_MEMBER(coin_inserted); DECLARE_DRIVER_INIT(shootout); + + virtual void machine_reset() override; virtual void video_start() override; + DECLARE_PALETTE_INIT(shootout); TILE_GET_INFO_MEMBER(get_bg_tile_info); diff --git a/src/mame/video/shootout.cpp b/src/mame/video/shootout.cpp index ecc52ee6bcf..a8eaf925ff7 100644 --- a/src/mame/video/shootout.cpp +++ b/src/mame/video/shootout.cpp @@ -83,7 +83,7 @@ void shootout_state::video_start() m_foreground = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(shootout_state::get_fg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); m_foreground->set_transparent_pen(0 ); - save_item(NAME(m_bFlicker)); + save_item(NAME(m_ccnt_old_val)); } void shootout_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int bank_bits ) @@ -92,7 +92,7 @@ void shootout_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, c const uint8_t *source = m_spriteram+127*4; int count; - m_bFlicker = !m_bFlicker; + bool m_bFlicker = (screen.frame_number () & 1) != 0; for( count=0; count<128; count++ ) {