From f51fe7805693345ead257b430a5a8e4ca6e58f13 Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Mon, 22 May 2017 22:48:40 +1000 Subject: get rid of mconfig trampoline in a few more devices, make handlers protected --- src/devices/bus/sunkbd/hlekbd.cpp | 33 ++++------- src/devices/bus/sunkbd/hlekbd.h | 3 +- src/mame/etc/template_device.cpp | 10 ++++ src/mame/etc/template_device.h | 1 + src/mame/machine/taito68705interface.cpp | 94 +++++++++++++------------------- src/mame/machine/taito68705interface.h | 32 ++++++----- src/mame/machine/zorbakbd.cpp | 32 +++++------ src/mame/machine/zorbakbd.h | 4 +- src/mame/video/stfight_dev.cpp | 7 +-- src/mame/video/stfight_dev.h | 4 +- 10 files changed, 95 insertions(+), 125 deletions(-) diff --git a/src/devices/bus/sunkbd/hlekbd.cpp b/src/devices/bus/sunkbd/hlekbd.cpp index b083cd7a239..1820e3aa626 100644 --- a/src/devices/bus/sunkbd/hlekbd.cpp +++ b/src/devices/bus/sunkbd/hlekbd.cpp @@ -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 @@ -784,25 +772,26 @@ hle_device_base::~hle_device_base() /*-------------------------------------------------- - hle_device_base::device_mconfig_additions - get machine configuration additions + hle_device_base::input_txd + handle serial input line changes --------------------------------------------------*/ -machine_config_constructor hle_device_base::device_mconfig_additions() const +WRITE_LINE_MEMBER( hle_device_base::input_txd ) { - return MACHINE_CONFIG_NAME(sparc_keyboard); + device_buffered_serial_interface::rx_w(state); } /*-------------------------------------------------- - hle_device_base::input_txd - handle serial input line changes + hle_device_base::device_add_mconfig + add machine configuration --------------------------------------------------*/ -WRITE_LINE_MEMBER( hle_device_base::input_txd ) -{ - device_buffered_serial_interface::rx_w(state); -} +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 /*-------------------------------------------------- diff --git a/src/devices/bus/sunkbd/hlekbd.h b/src/devices/bus/sunkbd/hlekbd.h index 0a3fea3938c..7cb931b0fda 100644 --- a/src/devices/bus/sunkbd/hlekbd.h +++ b/src/devices/bus/sunkbd/hlekbd.h @@ -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; diff --git a/src/mame/etc/template_device.cpp b/src/mame/etc/template_device.cpp index f29b85215eb..a7cb33b4e06 100644 --- a/src/mame/etc/template_device.cpp +++ b/src/mame/etc/template_device.cpp @@ -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 //------------------------------------------------- diff --git a/src/mame/etc/template_device.h b/src/mame/etc/template_device.h index afcf02d44aa..8085a8dd9fd 100644 --- a/src/mame/etc/template_device.h +++ b/src/mame/etc/template_device.h @@ -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; }; diff --git a/src/mame/machine/taito68705interface.cpp b/src/mame/machine/taito68705interface.cpp index 722759b5401..8cbb2e65f5d 100644 --- a/src/mame/machine/taito68705interface.cpp +++ b/src/mame/machine/taito68705interface.cpp @@ -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 diff --git a/src/mame/machine/taito68705interface.h b/src/mame/machine/taito68705interface.h index dd718e68510..c806ffae13a 100644 --- a/src/mame/machine/taito68705interface.h +++ b/src/mame/machine/taito68705interface.h @@ -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 static devcb_base &set_portb_r_cb(device_t &device, Obj &&object) { return downcast(device).m_portb_r_cb.set_callback(std::forward(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 diff --git a/src/mame/machine/zorbakbd.cpp b/src/mame/machine/zorbakbd.cpp index b9c95958b50..92e1e0ee0c9 100644 --- a/src/mame/machine/zorbakbd.cpp +++ b/src/mame/machine/zorbakbd.cpp @@ -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 diff --git a/src/mame/machine/zorbakbd.h b/src/mame/machine/zorbakbd.h index 451e4102d8d..8fe8c99d6a7 100644 --- a/src/mame/machine/zorbakbd.h +++ b/src/mame/machine/zorbakbd.h @@ -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; diff --git a/src/mame/video/stfight_dev.cpp b/src/mame/video/stfight_dev.cpp index 0bc3521ecfb..192021015de 100644 --- a/src/mame/video/stfight_dev.cpp +++ b/src/mame/video/stfight_dev.cpp @@ -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 =================== diff --git a/src/mame/video/stfight_dev.h b/src/mame/video/stfight_dev.h index e399726116e..7925c16eb80 100644 --- a/src/mame/video/stfight_dev.h +++ b/src/mame/video/stfight_dev.h @@ -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; -- cgit v1.2.3