Share the memory maps for the System 11/A/B/C mainboard maincpu and audiocpu between the s11, s11a, s11b, s11c drivers to remove redundant identical copies in each driver. Made the MC1408 dac a member device of the s11 main class to get rid of some init-time tag lookups and prepare for future enhancements. Put the initialization order of devices in the sound-board specific machine configs in a more sane order. [Lord Nightmare]

This commit is contained in:
Lord-Nightmare 2020-08-16 20:37:44 -04:00
parent c44d930015
commit d9024aef70
8 changed files with 34 additions and 98 deletions

View File

@ -467,9 +467,9 @@ void s11_state::s11(machine_config &config)
INPUT_MERGER_ANY_HIGH(config, m_audioirq).output_handler().set_inputline(m_audiocpu, M6808_IRQ_LINE);
SPEAKER(config, "speaker").front_center();
MC1408(config, "dac", 0).add_route(ALL_OUTPUTS, "speaker", 0.25);
MC1408(config, m_dac, 0).add_route(ALL_OUTPUTS, "speaker", 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);
vref.add_route(0, m_dac, 1.0, DAC_VREF_POS_INPUT); vref.add_route(0, m_dac, -1.0, DAC_VREF_NEG_INPUT);
SPEAKER(config, "speech").front_center();
HC55516(config, m_hc55516, 0).add_route(ALL_OUTPUTS, "speech", 0.5);
@ -478,7 +478,7 @@ void s11_state::s11(machine_config &config)
m_pias->readpa_handler().set(FUNC(s11_state::sound_r));
m_pias->set_port_a_input_overrides_output_mask(0xff);
m_pias->writepa_handler().set(FUNC(s11_state::sound_w));
m_pias->writepb_handler().set("dac", FUNC(dac_byte_interface::data_w));
m_pias->writepb_handler().set(m_dac, FUNC(dac_byte_interface::data_w));
m_pias->ca2_handler().set(m_hc55516, FUNC(hc55516_device::clock_w));
m_pias->cb2_handler().set(m_hc55516, FUNC(hc55516_device::digit_w));
m_pias->irqa_handler().set(m_audioirq, FUNC(input_merger_device::in_w<0>));
@ -488,10 +488,10 @@ void s11_state::s11(machine_config &config)
void s11_state::s11_bgs(machine_config &config)
{
s11(config);
m_pia34->ca2_handler().set(m_bg, FUNC(s11c_bg_device::resetq_w));
/* Add the background sound card */
SPEAKER(config, "bgspk").front_center();
S11_BGS(config, m_bg);
m_pia34->ca2_handler().set(m_bg, FUNC(s11_bgs_device::resetq_w));
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->add_route(ALL_OUTPUTS, "bgspk", 0.5);
@ -500,10 +500,10 @@ void s11_state::s11_bgs(machine_config &config)
void s11_state::s11_bgm(machine_config &config)
{
s11(config);
m_pia34->ca2_handler().set(m_bg, FUNC(s11c_bg_device::resetq_w));
/* Add the background music card */
SPEAKER(config, "bgspk").front_center();
S11_BGM(config, m_bg);
m_pia34->ca2_handler().set(m_bg, FUNC(s11_bgm_device::resetq_w));
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->add_route(ALL_OUTPUTS, "bgspk", 1.0);

View File

@ -32,28 +32,6 @@ Note: To start a game, certain switches need to be activated. You must first pr
#include "s11a.lh"
void s11a_state::s11a_main_map(address_map &map)
{
map(0x0000, 0x0fff).ram().share("nvram");
map(0x2100, 0x2103).mirror(0x00fc).rw(m_pia21, FUNC(pia6821_device::read), FUNC(pia6821_device::write)); // sound+solenoids
map(0x2200, 0x2200).mirror(0x01ff).w(FUNC(s11a_state::sol3_w)); // solenoids
map(0x2400, 0x2403).mirror(0x03fc).rw(m_pia24, FUNC(pia6821_device::read), FUNC(pia6821_device::write)); // lamps
map(0x2800, 0x2803).mirror(0x03fc).rw(m_pia28, FUNC(pia6821_device::read), FUNC(pia6821_device::write)); // display
map(0x2c00, 0x2c03).mirror(0x03fc).rw(m_pia2c, FUNC(pia6821_device::read), FUNC(pia6821_device::write)); // alphanumeric display
map(0x3000, 0x3003).mirror(0x03fc).rw(m_pia30, FUNC(pia6821_device::read), FUNC(pia6821_device::write)); // inputs
map(0x3400, 0x3403).mirror(0x0bfc).rw(m_pia34, FUNC(pia6821_device::read), FUNC(pia6821_device::write)); // widget
map(0x4000, 0xffff).rom();
}
void s11a_state::s11a_audio_map(address_map &map)
{
map(0x0000, 0x07ff).mirror(0x0800).ram();
map(0x1000, 0x1fff).w(FUNC(s11a_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");
}
static INPUT_PORTS_START( s11a )
PORT_START("SW.0")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_TILT ) // always plumb-bob tilt
@ -168,11 +146,11 @@ void s11a_state::init_s11a()
s11_state::init_s11();
}
void s11a_state::s11a_common(machine_config &config)
void s11a_state::s11a_base(machine_config &config)
{
/* basic machine hardware */
M6808(config, m_maincpu, XTAL(4'000'000));
m_maincpu->set_addrmap(AS_PROGRAM, &s11a_state::s11a_main_map);
m_maincpu->set_addrmap(AS_PROGRAM, &s11_state::s11_main_map);
MCFG_MACHINE_RESET_OVERRIDE(s11a_state, s11a)
INPUT_MERGER_ANY_HIGH(config, m_mainirq).output_handler().set(FUNC(s11_state::main_irq));
INPUT_MERGER_ANY_HIGH(config, m_piairq).output_handler().set(FUNC(s11_state::pia_irq));
@ -228,7 +206,6 @@ void s11a_state::s11a_common(machine_config &config)
PIA6821(config, m_pia34, 0);
m_pia34->writepa_handler().set(FUNC(s11_state::pia34_pa_w));
m_pia34->writepb_handler().set(FUNC(s11_state::pia34_pb_w));
m_pia34->ca2_handler().set(m_bg, FUNC(s11c_bg_device::resetq_w));
m_pia34->cb2_handler().set(FUNC(s11_state::pia34_cb2_w));
m_pia34->irqa_handler().set(m_piairq, FUNC(input_merger_device::in_w<11>));
m_pia34->irqb_handler().set(m_piairq, FUNC(input_merger_device::in_w<12>));
@ -238,13 +215,13 @@ void s11a_state::s11a_common(machine_config &config)
/* Add the soundcard */
M6802(config, m_audiocpu, XTAL(4'000'000));
m_audiocpu->set_ram_enable(false);
m_audiocpu->set_addrmap(AS_PROGRAM, &s11a_state::s11a_audio_map);
m_audiocpu->set_addrmap(AS_PROGRAM, &s11_state::s11_audio_map);
INPUT_MERGER_ANY_HIGH(config, m_audioirq).output_handler().set_inputline(m_audiocpu, M6802_IRQ_LINE);
SPEAKER(config, "speaker").front_center();
MC1408(config, "dac", 0).add_route(ALL_OUTPUTS, "speaker", 0.25);
MC1408(config, m_dac, 0).add_route(ALL_OUTPUTS, "speaker", 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);
vref.add_route(0, m_dac, 1.0, DAC_VREF_POS_INPUT); vref.add_route(0, m_dac, -1.0, DAC_VREF_NEG_INPUT);
SPEAKER(config, "speech").front_center();
HC55516(config, m_hc55516, 0).add_route(ALL_OUTPUTS, "speech", 0.50);
@ -253,7 +230,7 @@ void s11a_state::s11a_common(machine_config &config)
m_pias->readpa_handler().set(FUNC(s11_state::sound_r));
m_pias->set_port_a_input_overrides_output_mask(0xff);
m_pias->writepa_handler().set(FUNC(s11_state::sound_w));
m_pias->writepb_handler().set("dac", FUNC(dac_byte_interface::data_w));
m_pias->writepb_handler().set(m_dac, FUNC(dac_byte_interface::data_w));
m_pias->ca2_handler().set(m_hc55516, FUNC(hc55516_device::clock_w));
m_pias->cb2_handler().set(m_hc55516, FUNC(hc55516_device::digit_w));
m_pias->irqa_handler().set(m_audioirq, FUNC(input_merger_device::in_w<0>));
@ -262,10 +239,11 @@ void s11a_state::s11a_common(machine_config &config)
void s11a_state::s11a(machine_config &config)
{
s11a_common(config);
s11a_base(config);
/* Add the background music card */
SPEAKER(config, "bgspk").front_center();
S11_BG(config, m_bg);
m_pia34->ca2_handler().set(m_bg, FUNC(s11_bg_device::resetq_w));
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->add_route(ALL_OUTPUTS, "bgspk", 1.0);
@ -273,10 +251,11 @@ void s11a_state::s11a(machine_config &config)
void s11a_state::s11a_obg(machine_config &config)
{
s11a_common(config);
s11a_base(config);
/* Add the older-style background music card */
SPEAKER(config, "bgspk").front_center();
S11_OBG(config, m_bg);
m_pia34->ca2_handler().set(m_bg, FUNC(s11_obg_device::resetq_w));
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->add_route(ALL_OUTPUTS, "bgspk", 1.0);

View File

@ -51,28 +51,6 @@
#include "s11b.lh"
void s11b_state::s11b_main_map(address_map &map)
{
map(0x0000, 0x0fff).ram().share("nvram");
map(0x2100, 0x2103).mirror(0x00fc).rw(m_pia21, FUNC(pia6821_device::read), FUNC(pia6821_device::write)); // sound+solenoids
map(0x2200, 0x2200).mirror(0x01ff).w(FUNC(s11b_state::sol3_w)); // solenoids
map(0x2400, 0x2403).mirror(0x03fc).rw(m_pia24, FUNC(pia6821_device::read), FUNC(pia6821_device::write)); // lamps
map(0x2800, 0x2803).mirror(0x03fc).rw(m_pia28, FUNC(pia6821_device::read), FUNC(pia6821_device::write)); // display
map(0x2c00, 0x2c03).mirror(0x03fc).rw(m_pia2c, FUNC(pia6821_device::read), FUNC(pia6821_device::write)); // alphanumeric display
map(0x3000, 0x3003).mirror(0x03fc).rw(m_pia30, FUNC(pia6821_device::read), FUNC(pia6821_device::write)); // inputs
map(0x3400, 0x3403).mirror(0x0bfc).rw(m_pia34, FUNC(pia6821_device::read), FUNC(pia6821_device::write)); // widget
map(0x4000, 0xffff).rom();
}
void s11b_state::s11b_audio_map(address_map &map)
{
map(0x0000, 0x07ff).mirror(0x0800).ram();
map(0x1000, 0x1000).mirror(0x0fff).w(FUNC(s11b_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");
}
static INPUT_PORTS_START( s11b )
PORT_START("SW.0")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_TILT ) // always plumb-bob tilt
@ -254,7 +232,7 @@ void s11b_state::s11b_base(machine_config &config)
{
/* basic machine hardware */
M6808(config, m_maincpu, XTAL(4'000'000));
m_maincpu->set_addrmap(AS_PROGRAM, &s11b_state::s11b_main_map);
m_maincpu->set_addrmap(AS_PROGRAM, &s11_state::s11_main_map);
MCFG_MACHINE_RESET_OVERRIDE(s11b_state, s11b)
INPUT_MERGER_ANY_HIGH(config, m_mainirq).output_handler().set(FUNC(s11_state::main_irq));
INPUT_MERGER_ANY_HIGH(config, m_piairq).output_handler().set(FUNC(s11_state::pia_irq));
@ -310,7 +288,6 @@ void s11b_state::s11b_base(machine_config &config)
PIA6821(config, m_pia34, 0);
m_pia34->writepa_handler().set(FUNC(s11b_state::pia34_pa_w));
m_pia34->writepb_handler().set(FUNC(s11_state::pia34_pb_w));
m_pia34->cb2_handler().set(FUNC(s11_state::pia34_cb2_w));
m_pia34->irqa_handler().set(m_piairq, FUNC(input_merger_device::in_w<11>));
m_pia34->irqb_handler().set(m_piairq, FUNC(input_merger_device::in_w<12>));
@ -320,13 +297,13 @@ void s11b_state::s11b_base(machine_config &config)
/* Add the soundcard */
M6802(config, m_audiocpu, XTAL(4'000'000));
m_audiocpu->set_ram_enable(false);
m_audiocpu->set_addrmap(AS_PROGRAM, &s11b_state::s11b_audio_map);
m_audiocpu->set_addrmap(AS_PROGRAM, &s11_state::s11_audio_map);
INPUT_MERGER_ANY_HIGH(config, m_audioirq).output_handler().set_inputline(m_audiocpu, M6802_IRQ_LINE);
SPEAKER(config, "speaker").front_center();
MC1408(config, "dac", 0).add_route(ALL_OUTPUTS, "speaker", 0.25);
MC1408(config, m_dac, 0).add_route(ALL_OUTPUTS, "speaker", 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);
vref.add_route(0, m_dac, 1.0, DAC_VREF_POS_INPUT); vref.add_route(0, m_dac, -1.0, DAC_VREF_NEG_INPUT);
SPEAKER(config, "speech").front_center();
HC55516(config, m_hc55516, 0).add_route(ALL_OUTPUTS, "speech", 0.50);
@ -335,7 +312,7 @@ void s11b_state::s11b_base(machine_config &config)
m_pias->readpa_handler().set(FUNC(s11_state::sound_r));
m_pias->set_port_a_input_overrides_output_mask(0xff);
m_pias->writepa_handler().set(FUNC(s11_state::sound_w));
m_pias->writepb_handler().set("dac", FUNC(dac_byte_interface::data_w));
m_pias->writepb_handler().set(m_dac, FUNC(dac_byte_interface::data_w));
m_pias->ca2_handler().set(m_hc55516, FUNC(hc55516_device::clock_w));
m_pias->cb2_handler().set(m_hc55516, FUNC(hc55516_device::digit_w));
m_pias->irqa_handler().set(m_audioirq, FUNC(input_merger_device::in_w<0>));
@ -345,24 +322,24 @@ void s11b_state::s11b_base(machine_config &config)
void s11b_state::s11b(machine_config &config)
{
s11b_base(config);
m_pia34->ca2_handler().set(m_bg, FUNC(s11c_bg_device::resetq_w));
/* Add the background music card */
SPEAKER(config, "bgspk").front_center();
S11_BG(config, m_bg);
m_pia34->ca2_handler().set(m_bg, FUNC(s11_bg_device::resetq_w));
m_bg->pb_cb().set(m_pia34, FUNC(pia6821_device::portb_w));
m_bg->cb2_cb().set(m_pia34, FUNC(pia6821_device::cb1_w));
SPEAKER(config, "bgspk").front_center();
m_bg->add_route(ALL_OUTPUTS, "bgspk", 1.0);
}
void s11b_state::s11b_jokerz(machine_config &config)
{
s11b_base(config);
m_pia34->ca2_handler().set(m_ps88, FUNC(pinsnd88_device::resetq_w));
/* Add the pin sound 88 music card */
PINSND88(config, m_ps88);
m_pia34->ca2_handler().set(m_ps88, FUNC(pinsnd88_device::resetq_w));
m_ps88->syncq_cb().set(m_pia34, FUNC(pia6821_device::ca1_w)); // the sync connection comes from sound connector pin 16 to MCA1, not the usual pin 12 to MCB1
SPEAKER(config, "cabinet").front_floor(); // the cabinet speaker is aimed down underneath the pinball table itself
SPEAKER(config, "backbox").front_center(); // the backbox speakers are roughly level with the user, but farther in front of them than the cabinet
PINSND88(config, m_ps88);
m_ps88->syncq_cb().set(m_pia34, FUNC(pia6821_device::ca1_w)); // the sync connection comes from sound connector pin 16 to MCA1, not the usual pin 12 to MCB1
m_ps88->add_route(0, "cabinet", 1.0);
m_ps88->add_route(1, "backbox", 1.0);
}

View File

@ -13,20 +13,6 @@
#include "s11c.lh"
void s11c_state::s11c_main_map(address_map &map)
{
map(0x0000, 0x0fff).ram().share("nvram");
map(0x2100, 0x2103).mirror(0x00fc).rw(m_pia21, FUNC(pia6821_device::read), FUNC(pia6821_device::write)); // sound+solenoids
map(0x2200, 0x2200).mirror(0x01ff).w(FUNC(s11c_state::sol3_w)); // solenoids
map(0x2400, 0x2403).mirror(0x03fc).rw(m_pia24, FUNC(pia6821_device::read), FUNC(pia6821_device::write)); // lamps
map(0x2800, 0x2803).mirror(0x03fc).rw(m_pia28, FUNC(pia6821_device::read), FUNC(pia6821_device::write)); // display
map(0x2c00, 0x2c03).mirror(0x03fc).rw(m_pia2c, FUNC(pia6821_device::read), FUNC(pia6821_device::write)); // alphanumeric display
map(0x3000, 0x3003).mirror(0x03fc).rw(m_pia30, FUNC(pia6821_device::read), FUNC(pia6821_device::write)); // inputs
map(0x3400, 0x3403).mirror(0x0bfc).rw(m_pia34, FUNC(pia6821_device::read), FUNC(pia6821_device::write)); // widget
map(0x4000, 0xffff).rom();
}
static INPUT_PORTS_START( s11c )
PORT_START("SW.0")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_TILT ) // always plumb-bob tilt
@ -135,7 +121,7 @@ void s11c_state::s11c(machine_config &config)
{
/* basic machine hardware */
M6808(config, m_maincpu, XTAL(4'000'000));
m_maincpu->set_addrmap(AS_PROGRAM, &s11c_state::s11c_main_map);
m_maincpu->set_addrmap(AS_PROGRAM, &s11_state::s11_main_map);
INPUT_MERGER_ANY_HIGH(config, m_mainirq).output_handler().set(FUNC(s11_state::main_irq));
INPUT_MERGER_ANY_HIGH(config, m_piairq).output_handler().set(FUNC(s11_state::pia_irq));
@ -190,7 +176,6 @@ void s11c_state::s11c(machine_config &config)
PIA6821(config, m_pia34, 0);
m_pia34->writepa_handler().set(FUNC(s11b_state::pia34_pa_w));
m_pia34->writepb_handler().set(FUNC(s11b_state::pia34_pb_w));
m_pia34->ca2_handler().set(m_bg, FUNC(s11c_bg_device::resetq_w));
m_pia34->cb2_handler().set(FUNC(s11b_state::pia34_cb2_w));
m_pia34->irqa_handler().set(m_piairq, FUNC(input_merger_device::in_w<11>));
m_pia34->irqb_handler().set(m_piairq, FUNC(input_merger_device::in_w<12>));
@ -202,6 +187,7 @@ void s11c_state::s11c(machine_config &config)
/* Add the background music card */
SPEAKER(config, "speaker").front_center();
S11C_BG(config, m_bg);
m_pia34->ca2_handler().set(m_bg, FUNC(s11c_bg_device::resetq_w));
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->add_route(ALL_OUTPUTS, "speaker", 1.0);

View File

@ -45,6 +45,7 @@ public:
, m_audiocpu(*this, "audiocpu")
, m_audioirq(*this, "audioirq")
, m_hc55516(*this, "hc55516")
, m_dac(*this, "dac")
, m_pias(*this, "pias")
, m_pia21(*this, "pia21")
, m_pia24(*this, "pia24")
@ -98,18 +99,21 @@ public:
void switch_w(uint8_t data);
uint8_t pia28_w7_r();
void s11_main_map(address_map &map);
void s11_audio_map(address_map &map);
protected:
DECLARE_MACHINE_RESET(s11);
void s11_audio_map(address_map &map);
void s11_main_map(address_map &map);
// devices
required_device<cpu_device> m_maincpu;
required_device<input_merger_device> m_mainirq;
required_device<input_merger_device> m_piairq;
// the following devices are optional because certain board variants (i.e. system 11c) do not have the audio section on the mainboard populated
optional_device<m6802_cpu_device> m_audiocpu;
optional_device<input_merger_device> m_audioirq;
optional_device<hc55516_device> m_hc55516;
optional_device<mc1408_device> m_dac;
optional_device<pia6821_device> m_pias;
required_device<pia6821_device> m_pia21;
required_device<pia6821_device> m_pia24;

View File

@ -18,7 +18,7 @@ public:
: s11_state(mconfig, type, tag)
{ }
void s11a_common(machine_config &config);
void s11a_base(machine_config &config);
void s11a(machine_config &config);
void s11a_obg(machine_config &config);
@ -28,9 +28,6 @@ public:
private:
DECLARE_MACHINE_RESET(s11a);
void s11a_audio_map(address_map &map);
void s11a_main_map(address_map &map);
};
#endif // MAME_INCLUDES_S11A_H

View File

@ -36,9 +36,6 @@ protected:
private:
DECLARE_MACHINE_RESET(s11b);
void s11b_audio_map(address_map &map);
void s11b_main_map(address_map &map);
bool m_invert; // later System 11B games start expecting inverted data to the display LED segments.
};

View File

@ -24,10 +24,6 @@ public:
protected:
virtual void machine_reset() override;
private:
void s11c_main_map(address_map &map);
};