get rid of mconfig trampoline in a few more devices, make handlers protected

This commit is contained in:
Vas Crabb 2017-05-22 22:48:40 +10:00
parent ed231988f1
commit f51fe78056
10 changed files with 96 additions and 126 deletions

View File

@ -727,18 +727,6 @@ INPUT_PORTS_START( hle_type5_jp_device )
PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Kana") PORT_CODE(KEYCODE_RALT) // かな
INPUT_PORTS_END
/***************************************************************************
MACHINE CONFIGURATION FRAGMENTS
***************************************************************************/
MACHINE_CONFIG_START(sparc_keyboard)
MCFG_SPEAKER_STANDARD_MONO("bell")
MCFG_SOUND_ADD("beeper", BEEP, ATTOSECONDS_TO_HZ(480 * ATTOSECONDS_PER_MICROSECOND))
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "bell", 1.0)
MACHINE_CONFIG_END
} // anonymous namespace
@ -783,17 +771,6 @@ hle_device_base::~hle_device_base()
}
/*--------------------------------------------------
hle_device_base::device_mconfig_additions
get machine configuration additions
--------------------------------------------------*/
machine_config_constructor hle_device_base::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME(sparc_keyboard);
}
/*--------------------------------------------------
hle_device_base::input_txd
handle serial input line changes
@ -805,6 +782,18 @@ WRITE_LINE_MEMBER( hle_device_base::input_txd )
}
/*--------------------------------------------------
hle_device_base::device_add_mconfig
add machine configuration
--------------------------------------------------*/
MACHINE_CONFIG_MEMBER(hle_device_base::device_add_mconfig)
MCFG_SPEAKER_STANDARD_MONO("bell")
MCFG_SOUND_ADD("beeper", BEEP, ATTOSECONDS_TO_HZ(480 * ATTOSECONDS_PER_MICROSECOND))
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "bell", 1.0)
MACHINE_CONFIG_END
/*--------------------------------------------------
hle_device_base::device_start
perform expensive initialisations, allocate

View File

@ -21,8 +21,6 @@ class hle_device_base
public:
virtual ~hle_device_base() override;
virtual machine_config_constructor device_mconfig_additions() const override;
virtual DECLARE_WRITE_LINE_MEMBER( input_txd ) override;
protected:
@ -35,6 +33,7 @@ protected:
uint32_t clock);
// device overrides
virtual void device_add_mconfig(machine_config &config) override;
virtual void device_start() override;
virtual void device_reset() override;
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;

View File

@ -35,6 +35,16 @@ xxx_device::xxx_device(const machine_config &mconfig, const char *tag, device_t
//-------------------------------------------------
// add_device_mconfig - device-specific machine
// configuration addiitons
//-------------------------------------------------
MACHINE_CONFIG_MEMBER(xxx_device::add_device_mconfig)
//MCFG_CPU_ADD(...)
MACHINE_CONFIG_END
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------

View File

@ -40,6 +40,7 @@ public:
protected:
// device-level overrides
//virtual void device_validity_check(validity_checker &valid) const override;
virtual void device_add_mconfig() override;
virtual void device_start() override;
virtual void device_reset() override;
};

View File

@ -45,34 +45,6 @@
*/
namespace {
MACHINE_CONFIG_START( taito68705 )
MCFG_CPU_ADD("mcu", M68705P5, DERIVED_CLOCK(1, 1))
MCFG_M68705_PORTC_R_CB(READ8(taito68705_mcu_device, mcu_portc_r))
MCFG_M68705_PORTA_W_CB(WRITE8(taito68705_mcu_device, mcu_pa_w))
MCFG_M68705_PORTB_W_CB(WRITE8(taito68705_mcu_device, mcu_portb_w))
MACHINE_CONFIG_END
MACHINE_CONFIG_START( arkanoid_68705p3 )
MCFG_CPU_ADD("mcu", M68705P3, DERIVED_CLOCK(1, 1))
MCFG_M68705_PORTB_R_CB(READ8(arkanoid_mcu_device_base, mcu_pb_r))
MCFG_M68705_PORTC_R_CB(READ8(arkanoid_mcu_device_base, mcu_pc_r))
MCFG_M68705_PORTA_W_CB(WRITE8(arkanoid_mcu_device_base, mcu_pa_w))
MCFG_M68705_PORTC_W_CB(WRITE8(arkanoid_mcu_device_base, mcu_pc_w))
MACHINE_CONFIG_END
MACHINE_CONFIG_START( arkanoid_68705p5 )
MCFG_CPU_ADD("mcu", M68705P5, DERIVED_CLOCK(1, 1))
MCFG_M68705_PORTB_R_CB(READ8(arkanoid_mcu_device_base, mcu_pb_r))
MCFG_M68705_PORTC_R_CB(READ8(arkanoid_mcu_device_base, mcu_pc_r))
MCFG_M68705_PORTA_W_CB(WRITE8(arkanoid_mcu_device_base, mcu_pa_w))
MCFG_M68705_PORTC_W_CB(WRITE8(arkanoid_mcu_device_base, mcu_pc_w))
MACHINE_CONFIG_END
} // anonymous namespace
DEFINE_DEVICE_TYPE(TAITO68705_MCU, taito68705_mcu_device, "taito68705", "Taito MC68705 MCU Interface")
DEFINE_DEVICE_TYPE(TAITO68705_MCU_TIGER, taito68705_mcu_tiger_device, "taito68705tiger", "Taito MC68705 MCU Interface (Tiger Heli)")
DEFINE_DEVICE_TYPE(ARKANOID_68705P3, arkanoid_68705p3_device, "arkanoid68705p3", "Arkanoid MC68705P3 Interface")
@ -114,11 +86,6 @@ WRITE_LINE_MEMBER(taito68705_mcu_device_base::reset_w)
m_mcu->set_input_line(INPUT_LINE_RESET, state);
}
WRITE8_MEMBER(taito68705_mcu_device_base::mcu_pa_w)
{
m_pa_output = data;
}
taito68705_mcu_device_base::taito68705_mcu_device_base(
machine_config const &mconfig,
device_type type,
@ -138,6 +105,11 @@ taito68705_mcu_device_base::taito68705_mcu_device_base(
{
}
WRITE8_MEMBER(taito68705_mcu_device_base::mcu_pa_w)
{
m_pa_output = data;
}
void taito68705_mcu_device_base::device_start()
{
m_semaphore_cb.resolve_safe();
@ -217,10 +189,12 @@ taito68705_mcu_device::taito68705_mcu_device(const machine_config &mconfig, devi
{
}
machine_config_constructor taito68705_mcu_device::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME(taito68705);
}
MACHINE_CONFIG_MEMBER(taito68705_mcu_device::device_add_mconfig)
MCFG_CPU_ADD("mcu", M68705P5, DERIVED_CLOCK(1, 1))
MCFG_M68705_PORTC_R_CB(READ8(taito68705_mcu_device, mcu_portc_r))
MCFG_M68705_PORTA_W_CB(WRITE8(taito68705_mcu_device, mcu_pa_w))
MCFG_M68705_PORTB_W_CB(WRITE8(taito68705_mcu_device, mcu_portb_w))
MACHINE_CONFIG_END
void taito68705_mcu_device::device_start()
{
@ -295,6 +269,18 @@ READ8_MEMBER(taito68705_mcu_tiger_device::mcu_portc_r)
// Arkanoid/Puzznic (latch control on PC2 and PC3 instead of PB1 and PB2)
arkanoid_mcu_device_base::arkanoid_mcu_device_base(
machine_config const &mconfig,
device_type type,
char const *tag,
device_t *owner,
u32 clock)
: taito68705_mcu_device_base(mconfig, type, tag, owner, clock)
, m_portb_r_cb(*this)
, m_pc_output(0xff)
{
}
READ8_MEMBER(arkanoid_mcu_device_base::mcu_pb_r)
{
return m_portb_r_cb(space, offset, mem_mask);
@ -314,18 +300,6 @@ WRITE8_MEMBER(arkanoid_mcu_device_base::mcu_pc_w)
latch_control(data, m_pc_output, 2, 3);
}
arkanoid_mcu_device_base::arkanoid_mcu_device_base(
machine_config const &mconfig,
device_type type,
char const *tag,
device_t *owner,
u32 clock)
: taito68705_mcu_device_base(mconfig, type, tag, owner, clock)
, m_portb_r_cb(*this)
, m_pc_output(0xff)
{
}
void arkanoid_mcu_device_base::device_start()
{
taito68705_mcu_device_base::device_start();
@ -347,10 +321,13 @@ arkanoid_68705p3_device::arkanoid_68705p3_device(
{
}
machine_config_constructor arkanoid_68705p3_device::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME(arkanoid_68705p3);
}
MACHINE_CONFIG_MEMBER(arkanoid_68705p3_device::device_add_mconfig)
MCFG_CPU_ADD("mcu", M68705P3, DERIVED_CLOCK(1, 1))
MCFG_M68705_PORTB_R_CB(READ8(arkanoid_68705p3_device, mcu_pb_r))
MCFG_M68705_PORTC_R_CB(READ8(arkanoid_68705p3_device, mcu_pc_r))
MCFG_M68705_PORTA_W_CB(WRITE8(arkanoid_68705p3_device, mcu_pa_w))
MCFG_M68705_PORTC_W_CB(WRITE8(arkanoid_68705p3_device, mcu_pc_w))
MACHINE_CONFIG_END
arkanoid_68705p5_device::arkanoid_68705p5_device(
@ -362,7 +339,10 @@ arkanoid_68705p5_device::arkanoid_68705p5_device(
{
}
machine_config_constructor arkanoid_68705p5_device::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME(arkanoid_68705p5);
}
MACHINE_CONFIG_MEMBER(arkanoid_68705p5_device::device_add_mconfig)
MCFG_CPU_ADD("mcu", M68705P5, DERIVED_CLOCK(1, 1))
MCFG_M68705_PORTB_R_CB(READ8(arkanoid_68705p5_device, mcu_pb_r))
MCFG_M68705_PORTC_R_CB(READ8(arkanoid_68705p5_device, mcu_pc_r))
MCFG_M68705_PORTA_W_CB(WRITE8(arkanoid_68705p5_device, mcu_pa_w))
MCFG_M68705_PORTC_W_CB(WRITE8(arkanoid_68705p5_device, mcu_pc_w))
MACHINE_CONFIG_END

View File

@ -29,9 +29,6 @@ public:
DECLARE_CUSTOM_INPUT_MEMBER(host_semaphore_r) { return m_host_flag ? 1 : 0; }
DECLARE_CUSTOM_INPUT_MEMBER(mcu_semaphore_r) { return m_mcu_flag ? 1 : 0; }
// MCU callbacks
DECLARE_WRITE8_MEMBER(mcu_pa_w);
protected:
taito68705_mcu_device_base(
machine_config const &mconfig,
@ -40,6 +37,9 @@ protected:
device_t *owner,
u32 clock);
// MCU callbacks
DECLARE_WRITE8_MEMBER(mcu_pa_w);
virtual void device_start() override;
virtual void device_reset() override;
@ -74,13 +74,13 @@ public:
taito68705_mcu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual DECLARE_READ8_MEMBER(mcu_portc_r);
DECLARE_WRITE8_MEMBER(mcu_portb_w);
protected:
taito68705_mcu_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock);
virtual machine_config_constructor device_mconfig_additions() const override;
virtual DECLARE_READ8_MEMBER(mcu_portc_r);
DECLARE_WRITE8_MEMBER(mcu_portb_w);
virtual void device_add_mconfig(machine_config &config) override;
virtual void device_start() override;
devcb_write8 m_aux_strobe_cb;
@ -93,7 +93,9 @@ class taito68705_mcu_tiger_device : public taito68705_mcu_device
{
public:
taito68705_mcu_tiger_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
virtual DECLARE_READ8_MEMBER( mcu_portc_r ) override;
protected:
virtual DECLARE_READ8_MEMBER(mcu_portc_r) override;
};
@ -109,11 +111,6 @@ public:
template <typename Obj> static devcb_base &set_portb_r_cb(device_t &device, Obj &&object)
{ return downcast<arkanoid_mcu_device_base &>(device).m_portb_r_cb.set_callback(std::forward<Obj>(object)); }
// MCU callbacks
DECLARE_READ8_MEMBER(mcu_pb_r);
DECLARE_READ8_MEMBER(mcu_pc_r);
DECLARE_WRITE8_MEMBER(mcu_pc_w);
protected:
arkanoid_mcu_device_base(
machine_config const &mconfig,
@ -122,6 +119,11 @@ protected:
device_t *owner,
u32 clock);
// MCU callbacks
DECLARE_READ8_MEMBER(mcu_pb_r);
DECLARE_READ8_MEMBER(mcu_pc_r);
DECLARE_WRITE8_MEMBER(mcu_pc_w);
virtual void device_start() override;
devcb_read8 m_portb_r_cb;
@ -136,7 +138,7 @@ public:
arkanoid_68705p3_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock);
protected:
virtual machine_config_constructor device_mconfig_additions() const override;
virtual void device_add_mconfig(machine_config &config) override;
};
@ -146,7 +148,7 @@ public:
arkanoid_68705p5_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock);
protected:
virtual machine_config_constructor device_mconfig_additions() const override;
virtual void device_add_mconfig(machine_config &config) override;
};
#endif // MAME_MACHINE_TAITO68705INTERFACE_H

View File

@ -237,21 +237,6 @@ INPUT_PORTS_START(zorba_keyboard)
INPUT_PORTS_END
MACHINE_CONFIG_START(zorba_keyboard)
// MC68705P3S
MCFG_CPU_ADD("mcu", M68705P3, XTAL_3_579545MHz)
MCFG_M68705_PORTA_R_CB(READ8(zorba_keyboard_device, mcu_pa_r));
MCFG_M68705_PORTB_R_CB(READ8(zorba_keyboard_device, mcu_pb_r));
MCFG_M68705_PORTB_W_CB(WRITE8(zorba_keyboard_device, mcu_pb_w));
MCFG_M68705_PORTC_W_CB(WRITE8(zorba_keyboard_device, mcu_pc_w));
// TODO: beeper frequency is unknown, using value from Sun keyboard for now
MCFG_SPEAKER_STANDARD_MONO("bell")
MCFG_SOUND_ADD("beeper", BEEP, ATTOSECONDS_TO_HZ(480 * ATTOSECONDS_PER_MICROSECOND))
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "bell", 0.4)
MACHINE_CONFIG_END
ROM_START(zorba_keyboard)
ROM_REGION(0x0800, "mcu", 0)
ROM_LOAD( "8999-1 3-28-83", 0x080, 0x780, CRC(79fe6c0d) SHA1(4b6fca9379d5199d1347ad1187cbfdebfc4c73e7) )
@ -324,10 +309,19 @@ void zorba_keyboard_device::device_start()
}
machine_config_constructor zorba_keyboard_device::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME(zorba_keyboard);
}
MACHINE_CONFIG_MEMBER(zorba_keyboard_device::device_add_mconfig)
// MC68705P3S
MCFG_CPU_ADD("mcu", M68705P3, XTAL_3_579545MHz)
MCFG_M68705_PORTA_R_CB(READ8(zorba_keyboard_device, mcu_pa_r));
MCFG_M68705_PORTB_R_CB(READ8(zorba_keyboard_device, mcu_pb_r));
MCFG_M68705_PORTB_W_CB(WRITE8(zorba_keyboard_device, mcu_pb_w));
MCFG_M68705_PORTC_W_CB(WRITE8(zorba_keyboard_device, mcu_pc_w));
// TODO: beeper frequency is unknown, using value from Sun keyboard for now
MCFG_SPEAKER_STANDARD_MONO("bell")
MCFG_SOUND_ADD("beeper", BEEP, ATTOSECONDS_TO_HZ(480 * ATTOSECONDS_PER_MICROSECOND))
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "bell", 0.4)
MACHINE_CONFIG_END
ioport_constructor zorba_keyboard_device::device_input_ports() const

View File

@ -23,14 +23,14 @@ public:
DECLARE_WRITE_LINE_MEMBER(txd_w);
protected:
DECLARE_READ8_MEMBER(mcu_pa_r);
DECLARE_READ8_MEMBER(mcu_pb_r);
DECLARE_WRITE8_MEMBER(mcu_pb_w);
DECLARE_WRITE8_MEMBER(mcu_pc_w);
protected:
virtual void device_start() override;
virtual machine_config_constructor device_mconfig_additions() const override;
virtual void device_add_mconfig(machine_config &config) override;
virtual ioport_constructor device_input_ports() const override;
virtual tiny_rom_entry const *device_rom_region() const override;

View File

@ -109,7 +109,7 @@ static GFXDECODE_START( stfight )
GFXDECODE_ENTRY( "spr_gfx", 0x0000, spritelayout, 0, 32 )
GFXDECODE_END
static MACHINE_CONFIG_START( stfight_vid )
MACHINE_CONFIG_MEMBER(stfight_video_device::device_add_mconfig)
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60)
@ -122,11 +122,6 @@ static MACHINE_CONFIG_START( stfight_vid )
MCFG_GFXDECODE_ADD("gfxdecode", "^palette", stfight)
MACHINE_CONFIG_END
machine_config_constructor stfight_video_device::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME( stfight_vid );
}
/*
Graphics ROM Format
===================

View File

@ -25,10 +25,10 @@ public:
DECLARE_WRITE8_MEMBER(stfight_sprite_bank_w);
DECLARE_WRITE8_MEMBER(stfight_vh_latch_w);
protected:
uint32_t screen_update_stfight(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
protected:
virtual machine_config_constructor device_mconfig_additions() const override;
virtual void device_add_mconfig(machine_config &config) override;
virtual void device_start() override;
virtual void device_reset() override;