From aaff5c704783fae18edac646f2d242a66439013a Mon Sep 17 00:00:00 2001 From: David Haywood Date: Fri, 23 Dec 2016 08:03:06 +0000 Subject: dumped 68705 a71_24.bin from Tokio / Scramble Formation [ShouTime, brizzo] hooked up new 68705 dump to Tokio / Scramble Formation [David Haywood] New Working Games ----------- Tokio / Scramble Formation [ShouTime, brizzo, David Haywood] --- src/mame/drivers/bublbobl.cpp | 53 +++++++++++++------- src/mame/includes/bublbobl.h | 37 ++++++++++++-- src/mame/machine/bublbobl.cpp | 111 +++++++++++++++++++++++++++++++++++------- 3 files changed, 163 insertions(+), 38 deletions(-) diff --git a/src/mame/drivers/bublbobl.cpp b/src/mame/drivers/bublbobl.cpp index 22581d739ab..90c4ea3c780 100644 --- a/src/mame/drivers/bublbobl.cpp +++ b/src/mame/drivers/bublbobl.cpp @@ -389,7 +389,7 @@ static ADDRESS_MAP_START( tokio_map, AS_PROGRAM, 8, bublbobl_state ) AM_RANGE(0xfb00, 0xfb00) AM_WRITE(tokio_videoctrl_w) AM_RANGE(0xfb80, 0xfb80) AM_WRITE(bublbobl_nmitrigger_w) AM_RANGE(0xfc00, 0xfc00) AM_READWRITE(bublbobl_sound_status_r, bublbobl_sound_command_w) - AM_RANGE(0xfe00, 0xfe00) AM_READ(tokio_mcu_r) AM_WRITENOP // ??? + AM_RANGE(0xfe00, 0xfe00) AM_READWRITE(tokio_mcu_r, tokio_mcu_w) ADDRESS_MAP_END static ADDRESS_MAP_START( tokio_slave_map, AS_PROGRAM, 8, bublbobl_state ) @@ -669,8 +669,8 @@ static INPUT_PORTS_START( tokio ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(1) PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_COIN2 ) PORT_IMPULSE(1) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) // data ready from MCU + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, bublbobl_state,tokio_main_sent_r, nullptr) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, bublbobl_state,tokio_mcu_sent_r, nullptr) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) @@ -745,16 +745,24 @@ MACHINE_START_MEMBER(bublbobl_state,tokio) { MACHINE_START_CALL_MEMBER(common); - save_item(NAME(m_tokio_prot_count)); + + save_item(NAME(m_mcu_sent)); + save_item(NAME(m_main_sent)); + save_item(NAME(m_from_main)); + save_item(NAME(m_from_mcu)); + save_item(NAME(m_from_mcu_latch)); + save_item(NAME(m_to_mcu_latch)); + save_item(NAME(m_old_portB)); } + MACHINE_RESET_MEMBER(bublbobl_state,tokio) { MACHINE_RESET_CALL_MEMBER(common); - - m_tokio_prot_count = 0; } + + static MACHINE_CONFIG_START( tokio, bublbobl_state ) /* basic machine hardware */ @@ -769,7 +777,14 @@ static MACHINE_CONFIG_START( tokio, bublbobl_state ) MCFG_CPU_ADD("audiocpu", Z80, MAIN_XTAL/8) // 3 MHz MCFG_CPU_PROGRAM_MAP(tokio_sound_map) // NMIs are triggered by the main CPU, IRQs are triggered by the YM2203 - MCFG_QUANTUM_TIME(attotime::from_hz(6000)) // 100 CPU slices per frame - a high value to ensure proper synchronization of the CPUs + MCFG_CPU_ADD("mcu", M68705_NEW, XTAL_4MHz) // ? Mhz + MCFG_M68705_PORTA_R_CB(READ8(bublbobl_state, tokio_mcu_porta_r)) + MCFG_M68705_PORTA_W_CB(WRITE8(bublbobl_state, tokio_mcu_porta_w)) + MCFG_M68705_PORTB_W_CB(WRITE8(bublbobl_state, tokio_mcu_portb_w)) + MCFG_M68705_PORTC_R_CB(READ8(bublbobl_state, tokio_mcu_portc_r)) + + + MCFG_QUANTUM_PERFECT_CPU("maincpu") MCFG_WATCHDOG_ADD("watchdog") @@ -800,6 +815,9 @@ static MACHINE_CONFIG_START( tokio, bublbobl_state ) MCFG_SOUND_ROUTE(3, "mono", 1.0) MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED( tokiob, tokio ) + MCFG_DEVICE_REMOVE("mcu") +MACHINE_CONFIG_END MACHINE_START_MEMBER(bublbobl_state,bublbobl) { @@ -819,6 +837,7 @@ MACHINE_START_MEMBER(bublbobl_state,bublbobl) save_item(NAME(m_port4_out)); } + MACHINE_RESET_MEMBER(bublbobl_state,bublbobl) { MACHINE_RESET_CALL_MEMBER(common); @@ -980,8 +999,8 @@ ROM_START( tokio ) // newer japan set, has -1 revision of roms 02, 03 and 06 ROM_REGION( 0x10000, "audiocpu", 0 ) /* audio CPU */ ROM_LOAD( "a71-07.ic10", 0x0000, 0x08000, CRC(f298cc7b) SHA1(ebf5c804aa07b7f198ec3e1f8d1e111cd89ebdf3) ) - ROM_REGION( 0x0800, "cpu3", 0 ) /* 2k for the microcontroller (68705P5) */ - ROM_LOAD( "a71-24.ic57", 0x0000, 0x0800, NO_DUMP ) + ROM_REGION( 0x0800, "mcu", 0 ) /* 2k for the microcontroller (68705P5) */ + ROM_LOAD( "a71_24.bin", 0x0000, 0x0800, CRC(0f4b25de) SHA1(e2d82aa8d8cc6a86aaf5715ef9cb62f526fd5b11) ) ROM_REGION( 0x80000, "gfx1", ROMREGION_INVERT ) /* gfx roms, on gfx board */ ROM_LOAD( "a71-08.ic12", 0x00000, 0x8000, CRC(0439ab13) SHA1(84142220a6a29f0e34f7c7c751b583bf394df8ce) ) /* 1st plane */ @@ -1023,8 +1042,8 @@ ROM_START( tokioo ) // older japan set, has older roms 02, 03, 06 ROM_REGION( 0x10000, "audiocpu", 0 ) /* audio CPU */ ROM_LOAD( "a71-07.ic10", 0x0000, 0x08000, CRC(f298cc7b) SHA1(ebf5c804aa07b7f198ec3e1f8d1e111cd89ebdf3) ) - ROM_REGION( 0x0800, "cpu3", 0 ) /* 2k for the microcontroller (68705P5) */ - ROM_LOAD( "a71-24.ic57", 0x0000, 0x0800, NO_DUMP ) + ROM_REGION( 0x0800, "mcu", 0 ) /* 2k for the microcontroller (68705P5) */ + ROM_LOAD( "a71_24.bin", 0x0000, 0x0800, CRC(0f4b25de) SHA1(e2d82aa8d8cc6a86aaf5715ef9cb62f526fd5b11) ) ROM_REGION( 0x80000, "gfx1", ROMREGION_INVERT ) /* gfx roms, on gfx board */ ROM_LOAD( "a71-08.ic12", 0x00000, 0x8000, CRC(0439ab13) SHA1(84142220a6a29f0e34f7c7c751b583bf394df8ce) ) /* 1st plane */ @@ -1066,8 +1085,8 @@ ROM_START( tokiou ) ROM_REGION( 0x10000, "audiocpu", 0 ) /* audio CPU */ ROM_LOAD( "a71-07.ic10", 0x0000, 0x08000, CRC(f298cc7b) SHA1(ebf5c804aa07b7f198ec3e1f8d1e111cd89ebdf3) ) - ROM_REGION( 0x0800, "cpu3", 0 ) /* 2k for the microcontroller (68705P5) */ - ROM_LOAD( "a71-24.ic57", 0x0000, 0x0800, NO_DUMP ) + ROM_REGION( 0x0800, "mcu", 0 ) /* 2k for the microcontroller (68705P5) */ + ROM_LOAD( "a71_24.bin", 0x0000, 0x0800, CRC(0f4b25de) SHA1(e2d82aa8d8cc6a86aaf5715ef9cb62f526fd5b11) ) ROM_REGION( 0x80000, "gfx1", ROMREGION_INVERT ) /* gfx roms, on gfx board */ ROM_LOAD( "a71-08.ic12", 0x00000, 0x8000, CRC(0439ab13) SHA1(84142220a6a29f0e34f7c7c751b583bf394df8ce) ) /* 1st plane */ @@ -1880,10 +1899,10 @@ DRIVER_INIT_MEMBER(bublbobl_state,dland) * *************************************/ -GAME( 1986, tokio, 0, tokio, tokio, bublbobl_state, tokio, ROT90, "Taito Corporation", "Tokio / Scramble Formation (newer)", MACHINE_NOT_WORKING | MACHINE_UNEMULATED_PROTECTION | MACHINE_SUPPORTS_SAVE ) -GAME( 1986, tokioo, tokio, tokio, tokio, bublbobl_state, tokio, ROT90, "Taito Corporation", "Tokio / Scramble Formation (older)", MACHINE_NOT_WORKING | MACHINE_UNEMULATED_PROTECTION | MACHINE_SUPPORTS_SAVE ) -GAME( 1986, tokiou, tokio, tokio, tokio, bublbobl_state, tokio, ROT90, "Taito America Corporation (Romstar license)", "Tokio / Scramble Formation (US)", MACHINE_NOT_WORKING | MACHINE_UNEMULATED_PROTECTION | MACHINE_SUPPORTS_SAVE ) -GAME( 1986, tokiob, tokio, tokio, tokio, bublbobl_state, tokiob, ROT90, "bootleg", "Tokio / Scramble Formation (bootleg)", MACHINE_SUPPORTS_SAVE ) +GAME( 1986, tokio, 0, tokio, tokio, bublbobl_state, tokio, ROT90, "Taito Corporation", "Tokio / Scramble Formation (newer)", MACHINE_SUPPORTS_SAVE ) +GAME( 1986, tokioo, tokio, tokio, tokio, bublbobl_state, tokio, ROT90, "Taito Corporation", "Tokio / Scramble Formation (older)", MACHINE_SUPPORTS_SAVE ) +GAME( 1986, tokiou, tokio, tokio, tokio, bublbobl_state, tokio, ROT90, "Taito America Corporation (Romstar license)", "Tokio / Scramble Formation (US)", MACHINE_SUPPORTS_SAVE ) +GAME( 1986, tokiob, tokio, tokiob, tokio, bublbobl_state, tokiob, ROT90, "bootleg", "Tokio / Scramble Formation (bootleg)", MACHINE_SUPPORTS_SAVE ) GAME( 1986, bublbobl, 0, bublbobl, bublbobl, bublbobl_state, bublbobl, ROT0, "Taito Corporation", "Bubble Bobble (Japan, Ver 0.1)", MACHINE_SUPPORTS_SAVE ) GAME( 1986, bublbobl1, bublbobl, bublbobl, bublbobl, bublbobl_state, bublbobl, ROT0, "Taito Corporation", "Bubble Bobble (Japan, Ver 0.0)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/includes/bublbobl.h b/src/mame/includes/bublbobl.h index c380a5c1439..643c5eee679 100644 --- a/src/mame/includes/bublbobl.h +++ b/src/mame/includes/bublbobl.h @@ -17,13 +17,21 @@ public: m_videoram(*this, "videoram"), m_objectram(*this, "objectram"), m_mcu_sharedram(*this, "mcu_sharedram"), + m_mcu_sent(false), + m_main_sent(false), + m_from_main(0), + m_from_mcu(0), + m_from_mcu_latch(0), + m_to_mcu_latch(0), + m_old_portB(0), m_maincpu(*this, "maincpu"), m_mcu(*this, "mcu"), m_audiocpu(*this, "audiocpu"), m_slave(*this, "slave"), m_gfxdecode(*this, "gfxdecode"), m_palette(*this, "palette"), - m_soundlatch(*this, "soundlatch") { } + m_soundlatch(*this, "soundlatch") + { } /* memory pointers */ required_shared_ptr m_videoram; @@ -39,8 +47,7 @@ public: int m_sound_status; /* mcu-related */ - /* Tokio*/ - int m_tokio_prot_count; + /* Bubble Bobble MCU */ uint8_t m_ddr1; uint8_t m_ddr2; @@ -66,6 +73,14 @@ public: /* Bobble Bobble */ int m_ic43_a; int m_ic43_b; + /* Tokio */ + bool m_mcu_sent; + bool m_main_sent; + uint8_t m_from_main; + uint8_t m_from_mcu; + uint8_t m_from_mcu_latch; + uint8_t m_to_mcu_latch; + uint8_t m_old_portB; /* devices */ required_device m_maincpu; @@ -81,6 +96,8 @@ public: DECLARE_WRITE8_MEMBER(tokio_videoctrl_w); DECLARE_WRITE8_MEMBER(bublbobl_nmitrigger_w); DECLARE_READ8_MEMBER(tokio_mcu_r); + DECLARE_WRITE8_MEMBER(tokio_mcu_w); + DECLARE_READ8_MEMBER(tokiob_mcu_r); DECLARE_WRITE8_MEMBER(bublbobl_sound_command_w); DECLARE_WRITE8_MEMBER(bublbobl_sh_nmi_disable_w); @@ -114,6 +131,20 @@ public: DECLARE_READ8_MEMBER(bublbobl_68705_port_b_r); DECLARE_WRITE8_MEMBER(bublbobl_68705_port_b_w); DECLARE_WRITE8_MEMBER(bublbobl_68705_ddr_b_w); + + + + + DECLARE_CUSTOM_INPUT_MEMBER(tokio_mcu_sent_r); + DECLARE_CUSTOM_INPUT_MEMBER(tokio_main_sent_r); + + + DECLARE_READ8_MEMBER(tokio_mcu_porta_r); + DECLARE_READ8_MEMBER(tokio_mcu_portc_r); + DECLARE_WRITE8_MEMBER(tokio_mcu_porta_w); + DECLARE_WRITE8_MEMBER(tokio_mcu_portb_w); + + DECLARE_DRIVER_INIT(tokiob); DECLARE_DRIVER_INIT(tokio); DECLARE_DRIVER_INIT(dland); diff --git a/src/mame/machine/bublbobl.cpp b/src/mame/machine/bublbobl.cpp index b4ae1801938..8ca3f92b53a 100644 --- a/src/mame/machine/bublbobl.cpp +++ b/src/mame/machine/bublbobl.cpp @@ -57,29 +57,104 @@ WRITE8_MEMBER(bublbobl_state::bublbobl_nmitrigger_w) } -static const uint8_t tokio_prot_data[] = -{ - 0x6c, - 0x7f,0x5f,0x7f,0x6f,0x5f,0x77,0x5f,0x7f,0x5f,0x7f,0x5f,0x7f,0x5b,0x7f,0x5f,0x7f, - 0x5f,0x77,0x59,0x7f,0x5e,0x7e,0x5f,0x6d,0x57,0x7f,0x5d,0x7d,0x5f,0x7e,0x5f,0x7f, - 0x5d,0x7d,0x5f,0x7e,0x5e,0x79,0x5f,0x7f,0x5f,0x7f,0x5d,0x7f,0x5f,0x7b,0x5d,0x7e, - 0x5f,0x7f,0x5d,0x7d,0x5f,0x7e,0x5e,0x7e,0x5f,0x7d,0x5f,0x7f,0x5f,0x7e,0x7f,0x5f, - 0x01,0x00,0x02,0x01,0x01,0x01,0x03,0x00,0x05,0x02,0x04,0x01,0x03,0x00,0x05,0x01, - 0x02,0x03,0x00,0x04,0x04,0x01,0x02,0x00,0x05,0x03,0x02,0x01,0x04,0x05,0x00,0x03, - 0x00,0x05,0x02,0x01,0x03,0x04,0x05,0x00,0x01,0x04,0x04,0x02,0x01,0x04,0x01,0x00, - 0x03,0x01,0x02,0x05,0x00,0x03,0x00,0x01,0x02,0x00,0x03,0x04,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x01,0x02,0x00,0x00,0x00,0x00,0x01,0x02,0x00,0x00,0x00, - 0x01,0x02,0x01,0x00,0x00,0x00,0x02,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x01,0x01, - 0x00,0x00,0x00,0x00,0x02,0x00,0x01,0x02,0x00,0x01,0x01,0x00,0x00,0x02,0x01,0x00, - 0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x01 -}; + +CUSTOM_INPUT_MEMBER(bublbobl_state::tokio_mcu_sent_r) +{ + if (m_mcu_sent) return 0; + else return 1; +} + +CUSTOM_INPUT_MEMBER(bublbobl_state::tokio_main_sent_r) +{ + if (m_main_sent) return 0; + else return 1; +} + READ8_MEMBER(bublbobl_state::tokio_mcu_r) { - m_tokio_prot_count %= sizeof(tokio_prot_data); - return tokio_prot_data[m_tokio_prot_count++]; + if (!m_mcu) + return 0x00; + + m_mcu_sent = false; + +// printf("%s: tokio_mcu_r %02x\n", space.machine().describe_context(), m_from_mcu); + + return m_from_mcu; +} + +WRITE8_MEMBER(bublbobl_state::tokio_mcu_w) +{ + if (!m_mcu) + return; + +// printf("%s: tokio_mcu_w %02x\n", space.machine().describe_context(), data); + + m_from_main = data; + m_main_sent = true; + m_mcu->set_input_line(0, ASSERT_LINE); + +} + + +READ8_MEMBER(bublbobl_state::tokio_mcu_porta_r) +{ +// printf("tokio_mcu_porta_r\n"); + return m_to_mcu_latch; +} + +WRITE8_MEMBER(bublbobl_state::tokio_mcu_porta_w) +{ +// printf("tokio_mcu_porta_w %02x\n", data); + m_from_mcu_latch = data; +} + + +READ8_MEMBER(bublbobl_state::tokio_mcu_portc_r) +{ + uint8_t ret = 0; + + if (!m_main_sent) + ret |= 0x01; + if (m_mcu_sent) + ret |= 0x02; + + ret ^= 0x3; // inverted logic compared to tigerh + +// printf("%s: tokio_mcu_portc_r %02x\n", space.machine().describe_context(), ret); + + return ret; +} + + +WRITE8_MEMBER(bublbobl_state::tokio_mcu_portb_w) +{ +// printf("tokio_mcu_portb_w %02x\n", data); + + if ((mem_mask & 0x02) && (~data & 0x02) && (m_old_portB & 0x02)) + { + if (m_main_sent) + m_mcu->set_input_line(0, CLEAR_LINE); + + m_to_mcu_latch = m_from_main; + m_main_sent = false; + } + if ((mem_mask & 0x04) && (data & 0x04) && (~m_old_portB & 0x04)) + { + m_from_mcu = m_from_mcu_latch; + m_mcu_sent = true; + // printf("sent %02x\n", m_from_mcu); + } + + m_old_portB = data; + } + + + + + READ8_MEMBER(bublbobl_state::tokiob_mcu_r) { return 0xbf; /* ad-hoc value set to pass initial testing */ -- cgit v1.2.3