mirror of
https://github.com/holub/mame
synced 2025-10-06 09:00:04 +03:00
mpu4.cpp: device_finder (nw)
This commit is contained in:
parent
ae2bb8f6c7
commit
6ab9e423d5
@ -104,6 +104,7 @@ public:
|
||||
, m_maincpu(*this, "maincpu")
|
||||
, m_vfd(*this, "vfd")
|
||||
, m_6840ptm(*this, "ptm_ic2")
|
||||
, m_ptm_ic3ss(*this, "ptm_ic3ss")
|
||||
, m_pia3(*this, "pia_ic3")
|
||||
, m_pia4(*this, "pia_ic4")
|
||||
, m_pia5(*this, "pia_ic5")
|
||||
@ -125,66 +126,14 @@ public:
|
||||
, m_reel7(*this, "reel7")
|
||||
, m_palette(*this, "palette")
|
||||
, m_meters(*this, "meters")
|
||||
, m_ym2413(*this, "ym2413")
|
||||
, m_ay8913(*this, "ay8913")
|
||||
, m_lamps(*this, "lamp%u", 0U)
|
||||
, m_mpu4leds(*this, "mpu4led%u", 0U)
|
||||
, m_digits(*this, "digit%u", 0U)
|
||||
, m_triacs(*this, "triac%u", 0U)
|
||||
{ }
|
||||
|
||||
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
DECLARE_WRITE8_MEMBER(bankswitch_w);
|
||||
DECLARE_READ8_MEMBER(bankswitch_r);
|
||||
DECLARE_WRITE8_MEMBER(bankset_w);
|
||||
DECLARE_WRITE8_MEMBER(characteriser_w);
|
||||
DECLARE_READ8_MEMBER(characteriser_r);
|
||||
DECLARE_WRITE8_MEMBER(bwb_characteriser_w);
|
||||
DECLARE_READ8_MEMBER(bwb_characteriser_r);
|
||||
DECLARE_WRITE8_MEMBER(mpu4_ym2413_w);
|
||||
DECLARE_READ8_MEMBER(mpu4_ym2413_r);
|
||||
DECLARE_READ8_MEMBER(crystal_sound_r);
|
||||
DECLARE_WRITE8_MEMBER(crystal_sound_w);
|
||||
DECLARE_WRITE8_MEMBER(ic3ss_w);
|
||||
DECLARE_WRITE_LINE_MEMBER(cpu0_irq);
|
||||
DECLARE_WRITE_LINE_MEMBER(ic2_o1_callback);
|
||||
DECLARE_WRITE_LINE_MEMBER(ic2_o2_callback);
|
||||
DECLARE_WRITE_LINE_MEMBER(ic2_o3_callback);
|
||||
DECLARE_WRITE8_MEMBER(pia_ic3_porta_w);
|
||||
DECLARE_WRITE8_MEMBER(pia_ic3_portb_w);
|
||||
DECLARE_WRITE_LINE_MEMBER(pia_ic3_ca2_w);
|
||||
DECLARE_WRITE_LINE_MEMBER(pia_ic3_cb2_w);
|
||||
DECLARE_WRITE8_MEMBER(pia_ic4_porta_w);
|
||||
DECLARE_WRITE8_MEMBER(pia_ic4_portb_w);
|
||||
DECLARE_READ8_MEMBER(pia_ic4_portb_r);
|
||||
DECLARE_WRITE_LINE_MEMBER(pia_ic4_ca2_w);
|
||||
DECLARE_WRITE_LINE_MEMBER(pia_ic4_cb2_w);
|
||||
DECLARE_READ8_MEMBER(pia_ic5_porta_r);
|
||||
DECLARE_WRITE8_MEMBER(pia_ic5_porta_w);
|
||||
DECLARE_WRITE8_MEMBER(pia_ic5_portb_w);
|
||||
DECLARE_READ8_MEMBER(pia_ic5_portb_r);
|
||||
DECLARE_WRITE_LINE_MEMBER(pia_ic5_ca2_w);
|
||||
DECLARE_WRITE_LINE_MEMBER(pia_ic5_cb2_w);
|
||||
DECLARE_WRITE8_MEMBER(pia_ic6_portb_w);
|
||||
DECLARE_WRITE8_MEMBER(pia_ic6_porta_w);
|
||||
DECLARE_WRITE_LINE_MEMBER(pia_ic6_ca2_w);
|
||||
DECLARE_WRITE_LINE_MEMBER(pia_ic6_cb2_w);
|
||||
DECLARE_WRITE8_MEMBER(pia_ic7_porta_w);
|
||||
DECLARE_WRITE8_MEMBER(pia_ic7_portb_w);
|
||||
DECLARE_READ8_MEMBER(pia_ic7_portb_r);
|
||||
DECLARE_WRITE_LINE_MEMBER(pia_ic7_ca2_w);
|
||||
DECLARE_WRITE_LINE_MEMBER(pia_ic7_cb2_w);
|
||||
DECLARE_READ8_MEMBER(pia_ic8_porta_r);
|
||||
DECLARE_WRITE8_MEMBER(pia_ic8_portb_w);
|
||||
DECLARE_WRITE_LINE_MEMBER(pia_ic8_ca2_w);
|
||||
DECLARE_WRITE_LINE_MEMBER(pia_ic8_cb2_w);
|
||||
DECLARE_WRITE8_MEMBER(pia_gb_porta_w);
|
||||
DECLARE_WRITE8_MEMBER(pia_gb_portb_w);
|
||||
DECLARE_READ8_MEMBER(pia_gb_portb_r);
|
||||
DECLARE_WRITE_LINE_MEMBER(pia_gb_ca2_w);
|
||||
DECLARE_WRITE_LINE_MEMBER(pia_gb_cb2_w);
|
||||
void init_m4default_alt();
|
||||
void init_crystali();
|
||||
void init_m4tst2();
|
||||
@ -245,17 +194,7 @@ public:
|
||||
void init_m4andyfh();
|
||||
void init_m4andyge();
|
||||
void init_m4apachg();
|
||||
DECLARE_MACHINE_START(mod2);
|
||||
DECLARE_MACHINE_RESET(mpu4);
|
||||
DECLARE_MACHINE_START(mpu4yam);
|
||||
DECLARE_MACHINE_START(mpu4oki);
|
||||
DECLARE_MACHINE_START(mpu4oki_alt);
|
||||
DECLARE_MACHINE_START(mod4oki_5r);
|
||||
DECLARE_MACHINE_START(mod2_alt);
|
||||
DECLARE_MACHINE_START(mpu4bwb);
|
||||
DECLARE_MACHINE_START(mpu4cry);
|
||||
TIMER_DEVICE_CALLBACK_MEMBER(gen_50hz);
|
||||
template <unsigned N> DECLARE_WRITE_LINE_MEMBER(reel_optic_cb) { if (state) m_optic_pattern |= (1 << N); else m_optic_pattern &= ~(1 << N); }
|
||||
|
||||
void bwboki(machine_config &config);
|
||||
void mod2(machine_config &config);
|
||||
void mod2_alt(machine_config &config);
|
||||
@ -293,11 +232,11 @@ public:
|
||||
void mpu4_bwb_7reel(machine_config &config);
|
||||
void mpu4base(machine_config &config);
|
||||
|
||||
void mpu4_6809_map(address_map &map);
|
||||
void mpu4_memmap(address_map &map);
|
||||
protected:
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
|
||||
|
||||
void mpu4_6809_map(address_map &map);
|
||||
void mpu4_memmap(address_map &map);
|
||||
void lamp_extend_small(int data);
|
||||
void lamp_extend_large(int data,int column,int active);
|
||||
void led_write_latch(int latch, int data, int column);
|
||||
@ -310,10 +249,76 @@ protected:
|
||||
void mpu4_install_mod4oki_space(address_space &space);
|
||||
void mpu4_install_mod4bwb_space(address_space &space);
|
||||
void mpu4_config_common();
|
||||
DECLARE_MACHINE_START(mod2);
|
||||
DECLARE_MACHINE_RESET(mpu4);
|
||||
DECLARE_MACHINE_START(mpu4yam);
|
||||
DECLARE_MACHINE_START(mpu4oki);
|
||||
DECLARE_MACHINE_START(mpu4oki_alt);
|
||||
DECLARE_MACHINE_START(mod4oki_5r);
|
||||
DECLARE_MACHINE_START(mod2_alt);
|
||||
DECLARE_MACHINE_START(mpu4bwb);
|
||||
DECLARE_MACHINE_START(mpu4cry);
|
||||
TIMER_DEVICE_CALLBACK_MEMBER(gen_50hz);
|
||||
template <unsigned N> DECLARE_WRITE_LINE_MEMBER(reel_optic_cb) { if (state) m_optic_pattern |= (1 << N); else m_optic_pattern &= ~(1 << N); }
|
||||
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
DECLARE_WRITE8_MEMBER(bankswitch_w);
|
||||
DECLARE_READ8_MEMBER(bankswitch_r);
|
||||
DECLARE_WRITE8_MEMBER(bankset_w);
|
||||
DECLARE_WRITE8_MEMBER(characteriser_w);
|
||||
DECLARE_READ8_MEMBER(characteriser_r);
|
||||
DECLARE_WRITE8_MEMBER(bwb_characteriser_w);
|
||||
DECLARE_READ8_MEMBER(bwb_characteriser_r);
|
||||
DECLARE_WRITE8_MEMBER(mpu4_ym2413_w);
|
||||
DECLARE_READ8_MEMBER(mpu4_ym2413_r);
|
||||
DECLARE_READ8_MEMBER(crystal_sound_r);
|
||||
DECLARE_WRITE8_MEMBER(crystal_sound_w);
|
||||
DECLARE_WRITE8_MEMBER(ic3ss_w);
|
||||
DECLARE_WRITE_LINE_MEMBER(cpu0_irq);
|
||||
DECLARE_WRITE_LINE_MEMBER(ic2_o1_callback);
|
||||
DECLARE_WRITE_LINE_MEMBER(ic2_o2_callback);
|
||||
DECLARE_WRITE_LINE_MEMBER(ic2_o3_callback);
|
||||
DECLARE_WRITE8_MEMBER(pia_ic3_porta_w);
|
||||
DECLARE_WRITE8_MEMBER(pia_ic3_portb_w);
|
||||
DECLARE_WRITE_LINE_MEMBER(pia_ic3_ca2_w);
|
||||
DECLARE_WRITE_LINE_MEMBER(pia_ic3_cb2_w);
|
||||
DECLARE_WRITE8_MEMBER(pia_ic4_porta_w);
|
||||
DECLARE_WRITE8_MEMBER(pia_ic4_portb_w);
|
||||
DECLARE_READ8_MEMBER(pia_ic4_portb_r);
|
||||
DECLARE_WRITE_LINE_MEMBER(pia_ic4_ca2_w);
|
||||
DECLARE_WRITE_LINE_MEMBER(pia_ic4_cb2_w);
|
||||
DECLARE_READ8_MEMBER(pia_ic5_porta_r);
|
||||
DECLARE_WRITE8_MEMBER(pia_ic5_porta_w);
|
||||
DECLARE_WRITE8_MEMBER(pia_ic5_portb_w);
|
||||
DECLARE_READ8_MEMBER(pia_ic5_portb_r);
|
||||
DECLARE_WRITE_LINE_MEMBER(pia_ic5_ca2_w);
|
||||
DECLARE_WRITE_LINE_MEMBER(pia_ic5_cb2_w);
|
||||
DECLARE_WRITE8_MEMBER(pia_ic6_portb_w);
|
||||
DECLARE_WRITE8_MEMBER(pia_ic6_porta_w);
|
||||
DECLARE_WRITE_LINE_MEMBER(pia_ic6_ca2_w);
|
||||
DECLARE_WRITE_LINE_MEMBER(pia_ic6_cb2_w);
|
||||
DECLARE_WRITE8_MEMBER(pia_ic7_porta_w);
|
||||
DECLARE_WRITE8_MEMBER(pia_ic7_portb_w);
|
||||
DECLARE_READ8_MEMBER(pia_ic7_portb_r);
|
||||
DECLARE_WRITE_LINE_MEMBER(pia_ic7_ca2_w);
|
||||
DECLARE_WRITE_LINE_MEMBER(pia_ic7_cb2_w);
|
||||
DECLARE_READ8_MEMBER(pia_ic8_porta_r);
|
||||
DECLARE_WRITE8_MEMBER(pia_ic8_portb_w);
|
||||
DECLARE_WRITE_LINE_MEMBER(pia_ic8_ca2_w);
|
||||
DECLARE_WRITE_LINE_MEMBER(pia_ic8_cb2_w);
|
||||
DECLARE_WRITE8_MEMBER(pia_gb_porta_w);
|
||||
DECLARE_WRITE8_MEMBER(pia_gb_portb_w);
|
||||
DECLARE_READ8_MEMBER(pia_gb_portb_r);
|
||||
DECLARE_WRITE_LINE_MEMBER(pia_gb_ca2_w);
|
||||
DECLARE_WRITE_LINE_MEMBER(pia_gb_cb2_w);
|
||||
|
||||
required_device<cpu_device> m_maincpu;
|
||||
optional_device<rocvfd_device> m_vfd;
|
||||
optional_device<ptm6840_device> m_6840ptm;
|
||||
optional_device<ptm6840_device> m_ptm_ic3ss;
|
||||
optional_device<pia6821_device> m_pia3;
|
||||
optional_device<pia6821_device> m_pia4;
|
||||
optional_device<pia6821_device> m_pia5;
|
||||
@ -335,6 +340,8 @@ protected:
|
||||
optional_device<stepper_device> m_reel7;
|
||||
optional_device<palette_device> m_palette;
|
||||
required_device<meters_device> m_meters;
|
||||
optional_device<ym2413_device> m_ym2413;
|
||||
optional_device<ay8913_device> m_ay8913;
|
||||
|
||||
// not all systems have this many lamps/LEDs/digits but the driver is too much of a mess to split up now
|
||||
|
||||
|
@ -1096,8 +1096,7 @@ BDIR BC1 |
|
||||
/* PSG function selected */
|
||||
void mpu4_state::update_ay(device_t *device)
|
||||
{
|
||||
ay8910_device *ay8910 = machine().device<ay8910_device>("ay8913");
|
||||
if (!ay8910) return;
|
||||
if (!m_ay8913) return;
|
||||
|
||||
pia6821_device *pia = downcast<pia6821_device *>(device);
|
||||
if (!pia->cb2_output())
|
||||
@ -1115,14 +1114,14 @@ void mpu4_state::update_ay(device_t *device)
|
||||
|
||||
case 0x02:
|
||||
/* CA2 = 0 CB2 = 1? : Write to selected PSG register and write data to Port A */
|
||||
ay8910->data_w(generic_space(), 0, m_pia6->a_output());
|
||||
m_ay8913->data_w(generic_space(), 0, m_pia6->a_output());
|
||||
LOG(("AY Chip Write \n"));
|
||||
break;
|
||||
|
||||
case 0x03:
|
||||
/* CA2 = 1 CB2 = 1? : The register will now be selected and the user can read from or write to it.
|
||||
The register will remain selected until another is chosen.*/
|
||||
ay8910->address_w(generic_space(), 0, m_pia6->a_output());
|
||||
m_ay8913->address_w(generic_space(), 0, m_pia6->a_output());
|
||||
LOG(("AY Chip Select \n"));
|
||||
break;
|
||||
|
||||
@ -1423,8 +1422,7 @@ calculate the oscillation frequency in advance. We're running the timer for inte
|
||||
purposes, but the frequency calculation is done by plucking the values out as they are written.*/
|
||||
WRITE8_MEMBER(mpu4_state::ic3ss_w)
|
||||
{
|
||||
device_t *ic3ss = machine().device("ptm_ic3ss");
|
||||
downcast<ptm6840_device *>(ic3ss)->write(offset,data);
|
||||
m_ptm_ic3ss->write(offset,data);
|
||||
|
||||
if (offset == 3)
|
||||
{
|
||||
@ -2117,14 +2115,12 @@ READ8_MEMBER(mpu4_state::bwb_characteriser_r)
|
||||
|
||||
WRITE8_MEMBER(mpu4_state::mpu4_ym2413_w)
|
||||
{
|
||||
ym2413_device *ym2413 = machine().device<ym2413_device>("ym2413");
|
||||
if (ym2413) ym2413->write(space,offset,data);
|
||||
if (m_ym2413) m_ym2413->write(space,offset,data);
|
||||
}
|
||||
|
||||
READ8_MEMBER(mpu4_state::mpu4_ym2413_r)
|
||||
{
|
||||
// ym2413_device *ym2413 = machine().device<ym2413_device>("ym2413");
|
||||
// if (ym2413) return ym2413->read(space,offset);
|
||||
// if (m_ym2413) return m_ym2413->read(space,offset);
|
||||
return 0xff;
|
||||
}
|
||||
|
||||
@ -2137,11 +2133,10 @@ void mpu4_state::mpu4_install_mod4yam_space(address_space &space)
|
||||
|
||||
void mpu4_state::mpu4_install_mod4oki_space(address_space &space)
|
||||
{
|
||||
pia6821_device *pia_ic4ss = machine().device<pia6821_device>("pia_ic4ss");
|
||||
ptm6840_device *ptm_ic3ss = machine().device<ptm6840_device>("ptm_ic3ss");
|
||||
|
||||
pia6821_device *pia_ic4ss = subdevice<pia6821_device>("pia_ic4ss");
|
||||
|
||||
space.install_readwrite_handler(0x0880, 0x0883, read8_delegate(FUNC(pia6821_device::read), pia_ic4ss), write8_delegate(FUNC(pia6821_device::write), pia_ic4ss));
|
||||
space.install_read_handler(0x08c0, 0x08c7, read8_delegate(FUNC(ptm6840_device::read), ptm_ic3ss));
|
||||
space.install_read_handler(0x08c0, 0x08c7, read8_delegate(FUNC(ptm6840_device::read), (ptm6840_device*)m_ptm_ic3ss));
|
||||
space.install_write_handler(0x08c0, 0x08c7, write8_delegate(FUNC(mpu4_state::ic3ss_w),this));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user