mirror of
https://github.com/holub/mame
synced 2025-04-23 00:39:36 +03:00
Williams System 11C "background" Audio Board: Add PIA portb and cb2 write callbacks and synchronize fences, and hook them up, this fixes the "MUSIC ERROR" and various bg-music feedback-triggered sounds in Williams System 11C pinballs, i.e. the "song" in Dr. Dude works correctly now. This is also preparation for renaming this device to "Williams D-11581 Audio Board" as the same PCB is also used on some Midway Y-unit arcade games, some Williams System 11A pinballs and all Williams System 11B pinballs (except Jokerz), not just on Williams System 11C pinballs. [Lord Nightmare]
This commit is contained in:
parent
0fa6e8255b
commit
261fe5d3bd
@ -24,6 +24,8 @@ s11c_bg_device::s11c_bg_device(const machine_config &mconfig, const char *tag, d
|
||||
, m_pia40(*this, "pia40")
|
||||
, m_cpubank(*this, "bgbank")
|
||||
, m_rom(*this, finder_base::DUMMY_TAG)
|
||||
, m_cb2_cb(*this)
|
||||
, m_pb_cb(*this)
|
||||
{
|
||||
}
|
||||
|
||||
@ -38,19 +40,42 @@ void s11c_bg_device::s11c_bg_map(address_map &map)
|
||||
map(0x8000, 0xffff).bankr("bgbank");
|
||||
}
|
||||
|
||||
TIMER_CALLBACK_MEMBER(s11c_bg_device::deferred_cb2_w)
|
||||
{
|
||||
if (!m_cb2_cb.isnull())
|
||||
m_cb2_cb(param);
|
||||
else
|
||||
logerror("S11C_BG CB2 writeback called, but callback is not registered!\n");
|
||||
}
|
||||
|
||||
TIMER_CALLBACK_MEMBER(s11c_bg_device::deferred_pb_w)
|
||||
{
|
||||
if (!m_pb_cb.isnull())
|
||||
m_pb_cb(param);
|
||||
else
|
||||
logerror("S11C_BG PB writeback called, but callback is not registered!\n");
|
||||
}
|
||||
|
||||
|
||||
WRITE_LINE_MEMBER( s11c_bg_device::pia40_cb2_w)
|
||||
{
|
||||
// m_pia34->cb1_w(state); // To Widget MCB1 through CPU Data interface
|
||||
machine().scheduler().synchronize(timer_expired_delegate(FUNC(s11c_bg_device::deferred_cb2_w),this), state);
|
||||
}
|
||||
|
||||
void s11c_bg_device::pia40_pb_w(uint8_t data)
|
||||
{
|
||||
// m_pia34->portb_w(data);
|
||||
machine().scheduler().synchronize(timer_expired_delegate(FUNC(s11c_bg_device::deferred_pb_w),this), data);
|
||||
}
|
||||
|
||||
void s11c_bg_device::ctrl_w(uint8_t data)
|
||||
|
||||
WRITE_LINE_MEMBER( s11c_bg_device::extra_w )
|
||||
{
|
||||
m_pia40->cb1_w(data);
|
||||
m_pia40->cb2_w(state);
|
||||
}
|
||||
|
||||
WRITE_LINE_MEMBER( s11c_bg_device::ctrl_w )
|
||||
{
|
||||
m_pia40->cb1_w(state);
|
||||
}
|
||||
|
||||
void s11c_bg_device::data_w(uint8_t data)
|
||||
@ -65,15 +90,15 @@ void s11c_bg_device::device_add_mconfig(machine_config &config)
|
||||
config.set_maximum_quantum(attotime::from_hz(50));
|
||||
|
||||
YM2151(config, m_ym2151, XTAL(3'579'545)); // "3.58 MHz" on schematics and parts list
|
||||
m_ym2151->irq_handler().set(FUNC(s11c_bg_device::ym2151_irq_w));
|
||||
m_ym2151->add_route(ALL_OUTPUTS, *this, 0.25);
|
||||
m_ym2151->irq_handler().set(m_pia40, FUNC(pia6821_device::ca1_w)).invert(); // IRQ is not true state
|
||||
m_ym2151->add_route(ALL_OUTPUTS, *this, 0.1);
|
||||
|
||||
MC1408(config, "dac", 0).add_route(ALL_OUTPUTS, *this, 0.25);
|
||||
voltage_regulator_device &vref(VOLTAGE_REGULATOR(config, "vref"));
|
||||
vref.add_route(0, "dac", 1.0, DAC_VREF_POS_INPUT);
|
||||
vref.add_route(0, "dac", -1.0, DAC_VREF_NEG_INPUT);
|
||||
|
||||
HC55516(config, m_hc55516, 0).add_route(ALL_OUTPUTS, *this, 0.5);
|
||||
HC55516(config, m_hc55516, 0).add_route(ALL_OUTPUTS, *this, 0.6);
|
||||
|
||||
PIA6821(config, m_pia40, 0);
|
||||
m_pia40->writepa_handler().set("dac", FUNC(dac_byte_interface::data_w));
|
||||
@ -86,6 +111,9 @@ void s11c_bg_device::device_add_mconfig(machine_config &config)
|
||||
|
||||
void s11c_bg_device::device_start()
|
||||
{
|
||||
/* resolve lines */
|
||||
m_cb2_cb.resolve();
|
||||
m_pb_cb.resolve();
|
||||
}
|
||||
|
||||
void s11c_bg_device::device_reset()
|
||||
@ -96,14 +124,6 @@ void s11c_bg_device::device_reset()
|
||||
m_cpu->pulse_input_line(INPUT_LINE_RESET, attotime::zero);
|
||||
}
|
||||
|
||||
WRITE_LINE_MEMBER( s11c_bg_device::ym2151_irq_w)
|
||||
{
|
||||
if(state == CLEAR_LINE)
|
||||
m_pia40->ca1_w(1);
|
||||
else
|
||||
m_pia40->ca1_w(0);
|
||||
}
|
||||
|
||||
void s11c_bg_device::bg_cvsd_clock_set_w(uint8_t data)
|
||||
{
|
||||
m_hc55516->clock_w(1);
|
||||
|
@ -23,11 +23,16 @@ public:
|
||||
// construction/destruction
|
||||
s11c_bg_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
|
||||
|
||||
void bg_cvsd_clock_set_w(uint8_t data);
|
||||
void bg_cvsd_digit_clock_clear_w(uint8_t data);
|
||||
void bgbank_w(uint8_t data);
|
||||
void ctrl_w(uint8_t data);
|
||||
void data_w(uint8_t data);
|
||||
// note to keep synchronization working, the host machine should have synchronization timer expired delegates
|
||||
// before writing to the following 3 things:
|
||||
DECLARE_WRITE_LINE_MEMBER(extra_w); // external write to board CB2 (J4 pin 12), does anything actually do this?
|
||||
DECLARE_WRITE_LINE_MEMBER(ctrl_w); // external write to board CB1 (J4 pin 13)
|
||||
void data_w(uint8_t data); // external write to board data bus (J4 pins 3 thru 10 for D0-D7)
|
||||
virtual void device_reset() override; // external write to board /RESET (J4 pin 18)
|
||||
|
||||
// callbacks
|
||||
auto cb2_cb() { return m_cb2_cb.bind(); }
|
||||
auto pb_cb() { return m_pb_cb.bind(); }
|
||||
|
||||
template <typename T> void set_romregion(T &&tag) { m_rom.set_tag(std::forward<T>(tag)); }
|
||||
|
||||
@ -35,9 +40,11 @@ public:
|
||||
protected:
|
||||
// overrides
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
virtual void device_add_mconfig(machine_config &config) override;
|
||||
|
||||
TIMER_CALLBACK_MEMBER(deferred_cb2_w);
|
||||
TIMER_CALLBACK_MEMBER(deferred_pb_w);
|
||||
|
||||
private:
|
||||
required_device<cpu_device> m_cpu;
|
||||
required_device<ym2151_device> m_ym2151;
|
||||
@ -46,9 +53,15 @@ private:
|
||||
required_memory_bank m_cpubank;
|
||||
required_region_ptr<uint8_t> m_rom;
|
||||
|
||||
DECLARE_WRITE_LINE_MEMBER(ym2151_irq_w);
|
||||
void pia40_pb_w(uint8_t data);
|
||||
devcb_write_line m_cb2_cb;
|
||||
devcb_write8 m_pb_cb;
|
||||
|
||||
DECLARE_WRITE_LINE_MEMBER(pia40_cb2_w);
|
||||
void pia40_pb_w(uint8_t data);
|
||||
|
||||
void bg_cvsd_clock_set_w(uint8_t data);
|
||||
void bg_cvsd_digit_clock_clear_w(uint8_t data);
|
||||
void bgbank_w(uint8_t data);
|
||||
};
|
||||
|
||||
DECLARE_DEVICE_TYPE(S11C_BG, s11c_bg_device)
|
||||
|
@ -26,25 +26,6 @@ void s11c_state::s11c_main_map(address_map &map)
|
||||
map(0x4000, 0xffff).rom();
|
||||
}
|
||||
|
||||
void s11c_state::s11c_audio_map(address_map &map)
|
||||
{
|
||||
map(0x0000, 0x07ff).mirror(0x0800).ram();
|
||||
map(0x1000, 0x1000).mirror(0x0fff).w(FUNC(s11c_state::bank_w));
|
||||
map(0x2000, 0x2003).mirror(0x0ffc).rw(m_pias, FUNC(pia6821_device::read), FUNC(pia6821_device::write));
|
||||
map(0x8000, 0xbfff).bankr("bank0");
|
||||
map(0xc000, 0xffff).bankr("bank1");
|
||||
}
|
||||
|
||||
void s11c_state::s11c_bg_map(address_map &map)
|
||||
{
|
||||
map(0x0000, 0x07ff).mirror(0x1800).ram();
|
||||
map(0x2000, 0x2001).mirror(0x1ffe).rw(m_ym2151, FUNC(ym2151_device::read), FUNC(ym2151_device::write));
|
||||
map(0x4000, 0x4003).mirror(0x1ffc).rw(m_pia40, FUNC(pia6821_device::read), FUNC(pia6821_device::write));
|
||||
map(0x6000, 0x6000).mirror(0x07ff).w(FUNC(s11c_state::bg_cvsd_digit_clock_clear_w));
|
||||
map(0x6800, 0x6800).mirror(0x07ff).w(FUNC(s11c_state::bg_cvsd_clock_set_w));
|
||||
map(0x7800, 0x7800).mirror(0x07ff).w(FUNC(s11c_state::bgbank_w));
|
||||
map(0x8000, 0xffff).bankr("bgbank");
|
||||
}
|
||||
|
||||
static INPUT_PORTS_START( s11c )
|
||||
PORT_START("SW.0")
|
||||
@ -219,6 +200,8 @@ void s11c_state::s11c(machine_config &config)
|
||||
/* Add the background music card */
|
||||
SPEAKER(config, "speaker").front_center();
|
||||
S11C_BG(config, m_bg);
|
||||
m_bg->pb_cb().set(m_pia34, FUNC(pia6821_device::portb_w));
|
||||
m_bg->cb2_cb().set(m_pia34, FUNC(pia6821_device::cb1_w));
|
||||
m_bg->set_romregion(m_bgcpu);
|
||||
m_bg->add_route(ALL_OUTPUTS, "speaker", 1.0);
|
||||
}
|
||||
|
@ -28,8 +28,6 @@ protected:
|
||||
private:
|
||||
|
||||
void s11c_main_map(address_map &map);
|
||||
void s11c_audio_map(address_map &map);
|
||||
void s11c_bg_map(address_map &map);
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user