clean up cane/orbite additions (nw)

This commit is contained in:
Vas Crabb 2019-10-31 23:27:33 +11:00
parent f31b19f9c9
commit ef37c69c9b
6 changed files with 65 additions and 69 deletions

View File

@ -2688,6 +2688,7 @@ files {
MAME_DIR .. "src/mame/drivers/8080bw.cpp", MAME_DIR .. "src/mame/drivers/8080bw.cpp",
MAME_DIR .. "src/mame/includes/8080bw.h", MAME_DIR .. "src/mame/includes/8080bw.h",
MAME_DIR .. "src/mame/audio/8080bw.cpp", MAME_DIR .. "src/mame/audio/8080bw.cpp",
MAME_DIR .. "src/mame/audio/8080bw.h",
MAME_DIR .. "src/mame/video/8080bw.cpp", MAME_DIR .. "src/mame/video/8080bw.cpp",
MAME_DIR .. "src/mame/drivers/m79amb.cpp", MAME_DIR .. "src/mame/drivers/m79amb.cpp",
MAME_DIR .. "src/mame/includes/m79amb.h", MAME_DIR .. "src/mame/includes/m79amb.h",

View File

@ -895,9 +895,9 @@ void sn76477_device::open_wav_file()
std::string s = tag(); std::string s = tag();
std::replace(s.begin(), s.end(), ':', '_'); std::replace(s.begin(), s.end(), ':', '_');
char const* wav_file_name = util::string_format(LOG_WAV_FILE_NAME, s).c_str(); const std::string wav_file_name = util::string_format(LOG_WAV_FILE_NAME, s).c_str();
m_file = wav_open(wav_file_name, m_our_sample_rate, 2); m_file = wav_open(wav_file_name.c_str(), m_our_sample_rate, 2);
LOG(1, "SN76477: Logging output: %s\n", wav_file_name); LOG(1, "SN76477: Logging output: %s\n", wav_file_name);
} }

View File

@ -10,6 +10,9 @@
#include "sound/discrete.h" #include "sound/discrete.h"
#include "speaker.h" #include "speaker.h"
//#define VERBOSE 1
#include "logmacro.h"
/*******************************************************/ /*******************************************************/
/* */ /* */
@ -1456,19 +1459,19 @@ INPUT_PORTS_END
cane_audio_device::cane_audio_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock) : cane_audio_device::cane_audio_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock) :
device_t(mconfig, CANE_AUDIO, tag, owner, clock), device_t(mconfig, CANE_AUDIO, tag, owner, clock),
m_cane_vco_timer(*this, "cane_vco_timer"), m_vco_timer(*this, "vco_timer"),
m_sn(*this, "snsnd"), m_sn(*this, "snsnd"),
m_discrete(*this, "discrete"), m_discrete(*this, "discrete"),
m_cane_vco_rc_chargetime(INT_MAX) m_vco_rc_chargetime(INT_MAX)
{ {
} }
void cane_audio_device::device_add_mconfig(machine_config &config) void cane_audio_device::device_add_mconfig(machine_config &config)
{ {
// provare a commentare // provare a commentare
m_cane_vco_rc_chargetime = INT_MAX; m_vco_rc_chargetime = INT_MAX;
TIMER(config, "cane_vco_timer").configure_periodic(FUNC(cane_vco_voltage_timer), attotime::from_hz(1000)); TIMER(config, m_vco_timer).configure_periodic(FUNC(cane_audio_device::vco_voltage_timer), attotime::from_hz(1000));
SPEAKER(config, "mono").front_center(); SPEAKER(config, "mono").front_center();
@ -1503,7 +1506,7 @@ void cane_audio_device::device_start()
{ {
} }
void cane_audio_device::cane_sh_port_1_w(u8 data) void cane_audio_device::sh_port_1_w(u8 data)
{ {
/* /*
bit 0 - SX0 - Sound enable on mixer bit 0 - SX0 - Sound enable on mixer
@ -1520,8 +1523,8 @@ void cane_audio_device::cane_sh_port_1_w(u8 data)
m_sn->enable_w(1); m_sn->enable_w(1);
m_sn->set_mixer_params(BIT(data, 2), BIT(data, 3), BIT(data, 1)); m_sn->set_mixer_params(BIT(data, 2), BIT(data, 3), BIT(data, 1));
m_cane_vco_timer->adjust(attotime::zero, m_cane_vco_timer->param(), attotime::from_hz(1000)); m_vco_timer->adjust(attotime::zero, m_vco_timer->param(), attotime::from_hz(1000));
m_cane_vco_rc_chargetime = m_cane_vco_timer->start_time().as_double(); m_vco_rc_chargetime = m_vco_timer->start_time().as_double();
// Little hack... // Little hack...
// To be precise I should enable the 76477 every time the CPU reads or write to a port different from port 3 // To be precise I should enable the 76477 every time the CPU reads or write to a port different from port 3
@ -1530,18 +1533,18 @@ void cane_audio_device::cane_sh_port_1_w(u8 data)
m_sn->enable_w(0); m_sn->enable_w(0);
} }
void cane_audio_device::cane_music_w(u8 data) void cane_audio_device::music_w(u8 data)
{ {
m_sn->enable_w(1); m_sn->enable_w(1);
m_discrete->write(CANE_MUSIC_DATA, data); m_discrete->write(CANE_MUSIC_DATA, data);
} }
void cane_audio_device::cane_76477_en_w(u8 data) void cane_audio_device::sn76477_en_w(u8 data)
{ {
m_sn->enable_w(0); m_sn->enable_w(0);
} }
void cane_audio_device::cane_76477_dis_w(u8 data) void cane_audio_device::sn76477_dis_w(u8 data)
{ {
m_sn->enable_w(1); m_sn->enable_w(1);
} }
@ -1667,13 +1670,13 @@ DISCRETE_SOUND_START(cane_discrete)
*/ */
DISCRETE_SOUND_END DISCRETE_SOUND_END
TIMER_DEVICE_CALLBACK_MEMBER(cane_audio_device::cane_vco_voltage_timer) TIMER_DEVICE_CALLBACK_MEMBER(cane_audio_device::vco_voltage_timer)
{ {
double voltage; double voltage;
voltage = 5 * (1 - exp(- (m_cane_vco_timer->fire_time().as_double() - m_cane_vco_rc_chargetime) / 47)); voltage = 5 * (1 - exp(- (m_vco_timer->fire_time().as_double() - m_vco_rc_chargetime) / 47));
logerror("t = %d\n", m_cane_vco_timer->fire_time().as_double() - m_cane_vco_rc_chargetime); LOG("t = %d\n", m_vco_timer->fire_time().as_double() - m_vco_rc_chargetime);
logerror("vco_voltage = %d\n", voltage); LOG("vco_voltage = %d\n", voltage);
m_sn->vco_voltage_w(voltage); m_sn->vco_voltage_w(voltage);
} }

View File

@ -1,4 +1,5 @@
// license:BSD-3-Clause // license:BSD-3-Clause
// copyright-holders:Nicola Salmoria, Tormod Tjaberg, Mirko Buffoni,Lee Taylor, Valerio Verrando, Zsolt Vasvari,Aaron Giles,Jonathan Gevaryahu,hap,Robbbert
/*************************************************************************** /***************************************************************************
8080-based black and white sound hardware 8080-based black and white sound hardware
@ -19,10 +20,10 @@ class cane_audio_device : public device_t
public: public:
cane_audio_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock = 0); cane_audio_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock = 0);
void cane_sh_port_1_w(u8 data); void sh_port_1_w(u8 data);
void cane_music_w(u8 data); void music_w(u8 data);
void cane_76477_en_w(u8 data); void sn76477_en_w(u8 data);
void cane_76477_dis_w(u8 data); void sn76477_dis_w(u8 data);
protected: protected:
virtual void device_add_mconfig(machine_config &config) override; virtual void device_add_mconfig(machine_config &config) override;
@ -30,13 +31,13 @@ protected:
virtual void device_start() override; virtual void device_start() override;
private: private:
TIMER_DEVICE_CALLBACK_MEMBER(cane_vco_voltage_timer); TIMER_DEVICE_CALLBACK_MEMBER(vco_voltage_timer);
required_device<timer_device> m_cane_vco_timer; required_device<timer_device> m_vco_timer;
required_device<sn76477_device> m_sn; required_device<sn76477_device> m_sn;
required_device<discrete_sound_device> m_discrete; required_device<discrete_sound_device> m_discrete;
double m_cane_vco_rc_chargetime; double m_vco_rc_chargetime;
}; };
DECLARE_DEVICE_TYPE(CANE_AUDIO, cane_audio_device) DECLARE_DEVICE_TYPE(CANE_AUDIO, cane_audio_device)

View File

@ -3582,11 +3582,6 @@ void _8080bw_state::init_invmulti()
Being unreleased this games has not an official name, thus the name used in the source files was used instead. Being unreleased this games has not an official name, thus the name used in the source files was used instead.
***********************************************************************************************************************************/ ***********************************************************************************************************************************/
void cane_state::machine_start()
{
mw8080bw_state::machine_start();
}
void cane_state::cane_map(address_map &map) void cane_state::cane_map(address_map &map)
{ {
map(0x0000, 0x1fff).rom().nopw(); map(0x0000, 0x1fff).rom().nopw();
@ -3778,11 +3773,11 @@ Source file: CANE1.ED, CANE2.ED
map(0x01, 0x01).portr("IN1").w(m_mb14241, FUNC(mb14241_device::shift_count_w)); map(0x01, 0x01).portr("IN1").w(m_mb14241, FUNC(mb14241_device::shift_count_w));
map(0x02, 0x02).w(m_mb14241, FUNC(mb14241_device::shift_data_w)); map(0x02, 0x02).w(m_mb14241, FUNC(mb14241_device::shift_data_w));
map(0x03, 0x03).r(m_mb14241, FUNC(mb14241_device::shift_result_r)).w("soundboard", FUNC(cane_audio_device::cane_sh_port_1_w)); map(0x03, 0x03).r(m_mb14241, FUNC(mb14241_device::shift_result_r)).w("soundboard", FUNC(cane_audio_device::sh_port_1_w));
map(0x04, 0x04).w(m_watchdog, FUNC(watchdog_timer_device::reset_w)); map(0x04, 0x04).w(m_watchdog, FUNC(watchdog_timer_device::reset_w));
map(0x05, 0x05).w("soundboard", FUNC(cane_audio_device::cane_music_w)); map(0x05, 0x05).w("soundboard", FUNC(cane_audio_device::music_w));
} }
static INPUT_PORTS_START( cane ) static INPUT_PORTS_START( cane )
@ -3951,9 +3946,10 @@ INPUT_PORTS_END
void orbite_state::machine_start() void orbite_state::machine_start()
{ {
_8080bw_state::machine_start();
m_scattered_colorram = std::make_unique<uint8_t []>(0x800); m_scattered_colorram = std::make_unique<uint8_t []>(0x800);
save_pointer(&m_scattered_colorram[0], "m_scattered_colorram", 0x800); save_pointer(&m_scattered_colorram[0], "m_scattered_colorram", 0x800);
mw8080bw_state::machine_start();
} }
void orbite_state::orbite(machine_config &config) void orbite_state::orbite(machine_config &config)

View File

@ -294,8 +294,7 @@ class cane_state : public _8080bw_state
{ {
public: public:
cane_state(machine_config const &mconfig, device_type type, char const *tag) : cane_state(machine_config const &mconfig, device_type type, char const *tag) :
_8080bw_state(mconfig, type, tag), _8080bw_state(mconfig, type, tag)
m_soundboard(*this, "soundboard")
{ {
} }
@ -306,12 +305,8 @@ protected:
void cane_unknown_port0_w(u8 data); void cane_unknown_port0_w(u8 data);
private: private:
virtual void machine_start() override;
void cane_io_map(address_map &map); void cane_io_map(address_map &map);
void cane_map(address_map &map); void cane_map(address_map &map);
required_device<cane_audio_device> m_soundboard;
}; };
DISCRETE_SOUND_EXTERN( cane_discrete ); DISCRETE_SOUND_EXTERN( cane_discrete );
@ -336,12 +331,12 @@ protected:
required_shared_ptr<uint8_t> m_main_ram; required_shared_ptr<uint8_t> m_main_ram;
std::unique_ptr<uint8_t[]> m_scattered_colorram; std::unique_ptr<uint8_t[]> m_scattered_colorram;
virtual void machine_start() override;
u8 orbite_scattered_colorram_r(ATTR_UNUSED address_space &space, ATTR_UNUSED offs_t offset, ATTR_UNUSED u8 mem_mask = 0xff); u8 orbite_scattered_colorram_r(ATTR_UNUSED address_space &space, ATTR_UNUSED offs_t offset, ATTR_UNUSED u8 mem_mask = 0xff);
void orbite_scattered_colorram_w(ATTR_UNUSED address_space &space, ATTR_UNUSED offs_t offset, ATTR_UNUSED u8 data, ATTR_UNUSED u8 mem_mask = 0xff); void orbite_scattered_colorram_w(ATTR_UNUSED address_space &space, ATTR_UNUSED offs_t offset, ATTR_UNUSED u8 data, ATTR_UNUSED u8 mem_mask = 0xff);
private: private:
virtual void machine_start() override;
void orbite_io_map(address_map &map); void orbite_io_map(address_map &map);
void orbite_map(address_map &map); void orbite_map(address_map &map);