From aa2d65e8109de884913afb51be746bd7af8aa68b Mon Sep 17 00:00:00 2001 From: Robbbert Date: Fri, 20 Apr 2018 02:08:20 +1000 Subject: crashrd: added some sound --- src/mame/audio/8080bw.cpp | 78 +++++++++++++++++++++++++++++++++++++++++++++ src/mame/drivers/8080bw.cpp | 20 +++++++++++- src/mame/includes/8080bw.h | 4 +++ 3 files changed, 101 insertions(+), 1 deletion(-) diff --git a/src/mame/audio/8080bw.cpp b/src/mame/audio/8080bw.cpp index b8ec710d20f..a62568a5ae8 100644 --- a/src/mame/audio/8080bw.cpp +++ b/src/mame/audio/8080bw.cpp @@ -1137,6 +1137,84 @@ WRITE8_MEMBER(_8080bw_state::schasercv_sh_port_2_w) +/*****************************************/ +/* Crash Road preliminary sound */ +/* Much more work needs to be done */ +/*****************************************/ + +WRITE8_MEMBER(_8080bw_state::crashrd_port03_w) +{ + int effect; + + /* bit 0 - Dot Sound Pitch (SX1) + bit 2 - Explosion (SX5) + bit 4 - Dot Sound Enable (SX0) + bit 5 - Effect Sound C (SX4) */ + + m_discrete->write(space, SCHASER_SND_EN, BIT(data,5)); + machine().sound().system_enable(BIT(data,5)); + m_discrete->write(space, SCHASER_DOT_EN, BIT(data, 4)); + m_discrete->write(space, SCHASER_DOT_SEL, BIT(data, 0)); + + /* The effect is a variable rate 555 timer. A diode/resistor array is used to + * select the frequency. Because of the diode voltage drop, we can not use the + * standard 555 time formulas. Also, when effect=0, the charge resistor + * is disconnected. This causes the charge on the cap to slowly bleed off, but + * but the bleed time is so long, that we can just cheat and put the time on hold + * when effect = 0. */ + effect = 0; //(data >> 2) & 0x07; + if (m_schaser_last_effect != effect) + { + if (effect) + { + if (m_schaser_effect_555_time_remain != attotime::zero) + { + /* timer re-enabled, use up remaining 555 high time */ + m_schaser_effect_555_timer->adjust(m_schaser_effect_555_time_remain, effect); + } + else if (!m_schaser_effect_555_is_low) + { + /* set 555 high time */ + attotime new_time = attotime(0, ATTOSECONDS_PER_SECOND * .8873 * schaser_effect_rc[effect]); + m_schaser_effect_555_timer->adjust(new_time, effect); + } + } + else + { + /* disable effect - stops at end of low cycle */ + if (!m_schaser_effect_555_is_low) + { + m_schaser_effect_555_time_remain = m_schaser_effect_555_timer->time_left(); + m_schaser_effect_555_time_remain_savable = m_schaser_effect_555_time_remain.as_double(); + m_schaser_effect_555_timer->adjust(attotime::never); + } + } + m_schaser_last_effect = effect; + } + + m_schaser_explosion = BIT(data, 2); + if (m_schaser_explosion) + { + m_sn->amplitude_res_w(1.0 / (1.0/RES_K(200) + 1.0/RES_K(68))); + } + else + { + m_sn->amplitude_res_w(RES_K(200)); + } + m_sn->enable_w(!(m_schaser_effect_555_is_low || m_schaser_explosion)); + m_sn->one_shot_cap_voltage_w(!(m_schaser_effect_555_is_low || m_schaser_explosion) ? 0 : sn76477_device::EXTERNAL_VOLTAGE_DISCONNECT); + m_sn->mixer_b_w(m_schaser_explosion); +} + +WRITE8_MEMBER(_8080bw_state::crashrd_port05_w) +{ + // bit 0 = bitstream audio + // bit 4 = not sure + m_discrete->write(space, SCHASER_MUSIC_BIT, BIT(data, 0)); +} + + + /*******************************************************************/ /* Yosakdon preliminary sound */ /* No information available as what the correct sounds are */ diff --git a/src/mame/drivers/8080bw.cpp b/src/mame/drivers/8080bw.cpp index ffe0fdb9588..909199a7368 100644 --- a/src/mame/drivers/8080bw.cpp +++ b/src/mame/drivers/8080bw.cpp @@ -1614,8 +1614,20 @@ void _8080bw_state::schasercv_io_map(address_map &map) map(0x03, 0x03).r(m_mb14241, FUNC(mb14241_device::shift_result_r)).w(this, FUNC(_8080bw_state::schasercv_sh_port_1_w)); map(0x04, 0x04).w(m_mb14241, FUNC(mb14241_device::shift_data_w)); map(0x05, 0x05).w(this, FUNC(_8080bw_state::schasercv_sh_port_2_w)); + //map(0x06, 0x06).w(m_watchdog, FUNC(watchdog_timer_device::reset_w)); } +void _8080bw_state::crashrd_io_map(address_map &map) +{ + map(0x01, 0x01).portr("IN1"); + map(0x02, 0x02).portr("IN2").w(m_mb14241, FUNC(mb14241_device::shift_count_w)); + map(0x03, 0x03).r(m_mb14241, FUNC(mb14241_device::shift_result_r)).w(this, FUNC(_8080bw_state::crashrd_port03_w)); + map(0x04, 0x04).w(m_mb14241, FUNC(mb14241_device::shift_data_w)); + map(0x05, 0x05).w(this, FUNC(_8080bw_state::crashrd_port05_w)); + map(0x06, 0x06).w(m_watchdog, FUNC(watchdog_timer_device::reset_w)); +} + + static INPUT_PORTS_START( schasercv ) PORT_START("IN0") @@ -1691,6 +1703,12 @@ MACHINE_CONFIG_START(_8080bw_state::schasercv) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) MACHINE_CONFIG_END +MACHINE_CONFIG_START(_8080bw_state::crashrd) + schaser(config); + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_IO_MAP(crashrd_io_map) +MACHINE_CONFIG_END + /*******************************************************/ @@ -5204,7 +5222,7 @@ GAME( 1979, schaserb, schaser, schaser, schaser, _8080bw_state, 0, GAME( 1979, schaserc, schaser, schaser, schaser, _8080bw_state, 0, ROT270, "Taito", "Space Chaser (set 4)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_COLORS ) GAME( 1979, schasercv, schaser, schasercv, schasercv, _8080bw_state, 0, ROT270, "Taito", "Space Chaser (CV version - set 1)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_COLORS ) GAME( 1979, schaserm, schaser, schaser, schaserm, _8080bw_state, 0, ROT270, "bootleg (Model Racing)", "Space Chaser (Model Racing bootleg)", MACHINE_SUPPORTS_SAVE ) // on original Taito PCB, hacked to be harder? -GAME( 1979, crashrd, schaser, schaser, schaserm, _8080bw_state, 0, ROT270, "bootleg (Centromatic)", "Crash Road (bootleg of Space Chaser)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND ) // PCB marked 'Imbader'; "Taito Corporation" on title screen replaced with a Spanish phone number +GAME( 1979, crashrd, schaser, crashrd, schaserm, _8080bw_state, 0, ROT270, "bootleg (Centromatic)", "Crash Road (bootleg of Space Chaser)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_NO_COCKTAIL ) // PCB marked 'Imbader'; "Taito Corporation" on title screen replaced with a Spanish phone number GAME( 1979, sflush, 0, sflush, sflush, _8080bw_state, 0, ROT270, "Taito", "Straight Flush", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND | MACHINE_IMPERFECT_COLORS | MACHINE_NO_COCKTAIL) diff --git a/src/mame/includes/8080bw.h b/src/mame/includes/8080bw.h index 4bf4ae01ab0..5445758f042 100644 --- a/src/mame/includes/8080bw.h +++ b/src/mame/includes/8080bw.h @@ -102,6 +102,8 @@ public: DECLARE_READ8_MEMBER(schasercv_02_r); DECLARE_WRITE8_MEMBER(schasercv_sh_port_1_w); DECLARE_WRITE8_MEMBER(schasercv_sh_port_2_w); + DECLARE_WRITE8_MEMBER(crashrd_port03_w); + DECLARE_WRITE8_MEMBER(crashrd_port05_w); DECLARE_WRITE8_MEMBER(yosakdon_sh_port_1_w); DECLARE_WRITE8_MEMBER(yosakdon_sh_port_2_w); DECLARE_READ8_MEMBER(shuttlei_ff_r); @@ -194,6 +196,7 @@ public: void darthvdr(machine_config &config); void ballbomb(machine_config &config); void spacecom(machine_config &config); + void crashrd(machine_config &config); void schasercv(machine_config &config); void lupin3(machine_config &config); void spacerng(machine_config &config); @@ -206,6 +209,7 @@ public: void cosmicmo_io_map(address_map &map); void cosmo_io_map(address_map &map); void cosmo_map(address_map &map); + void crashrd_io_map(address_map &map); void darthvdr_io_map(address_map &map); void darthvdr_map(address_map &map); void escmars_map(address_map &map); -- cgit v1.2.3