diff options
author | 2017-05-07 23:18:47 +1000 | |
---|---|---|
committer | 2017-05-14 21:44:11 +1000 | |
commit | 0f0d39ef81562c75e79176dd3bebb1e491ca39d5 (patch) | |
tree | 201cee7fdf55ee800f83859a92efd2cfe66cf2b3 /src/devices/bus/newbrain | |
parent | e6c4be2b4d71c7a6c95be0bae111eb416ff0f9e7 (diff) |
Move static data out of devices into the device types. This is a significant change, so please pay attention.
The core changes are:
* Short name, full name and source file are no longer members of device_t, they are part of the device type
* MACHINE_COFIG_START no longer needs a driver class
* MACHINE_CONFIG_DERIVED_CLASS is no longer necessary
* Specify the state class you want in the GAME/COMP/CONS line
* The compiler will work out the base class where the driver init member is declared
* There is one static device type object per driver rather than one per machine configuration
Use DECLARE_DEVICE_TYPE or DECLARE_DEVICE_TYPE_NS to declare device type.
* DECLARE_DEVICE_TYPE forward-declares teh device type and class, and declares extern object finders.
* DECLARE_DEVICE_TYPE_NS is for devices classes in namespaces - it doesn't forward-declare the device type.
Use DEFINE_DEVICE_TYPE or DEFINE_DEVICE_TYPE_NS to define device types.
* These macros declare storage for the static data, and instantiate the device type and device finder templates.
The rest of the changes are mostly just moving stuff out of headers that shouldn't be there, renaming stuff for consistency, and scoping stuff down where appropriate.
Things I've actually messed with substantially:
* More descriptive names for a lot of devices
* Untangled the fantasy sound from the driver state, which necessitates breaking up sound/flip writes
* Changed DECO BSMT2000 ready callback into a device delegate
* Untangled Microprose 3D noise from driver state
* Used object finders for CoCo multipak, KC85 D002, and Irem sound subdevices
* Started to get TI-99 stuff out of the TI-990 directory and arrange bus devices properly
* Started to break out common parts of Samsung ARM SoC devices
* Turned some of FM, SID, SCSP DSP, EPIC12 and Voodoo cores into something resmbling C++
* Tried to make Z180 table allocation/setup a bit safer
* Converted generic keyboard/terminal to not use WRITE8 - space/offset aren't relevant
* Dynamically allocate generic terminal buffer so derived devices (e.g. teleprinter) can specify size
* Imporved encapsulation of Z80DART channels
* Refactored the SPC7110 bit table generator loop to make it more readable
* Added wrappers for SNES PPU operations so members can be made protected
* Factored out some boilerplate for YM chips with PSG
* toaplan2 gfx
* stic/intv resolution
* Video System video
* Out Run/Y-board sprite alignment
* GIC video hookup
* Amstrad CPC ROM box members
* IQ151 ROM cart region
* MSX cart IRQ callback resolution time
* SMS passthrough control devices starting subslots
I've smoke-tested several drivers, but I've probably missed something. Things I've missed will likely blow up spectacularly with failure to bind errors and the like. Let me know if there's more subtle breakage (could have happened in FM or Voodoo).
And can everyone please, please try to keep stuff clean. In particular, please stop polluting the global namespace. Keep things out of headers that don't need to be there, and use things that can be scoped down rather than macros.
It feels like an uphill battle trying to get this stuff under control while more of it's added.
Diffstat (limited to 'src/devices/bus/newbrain')
-rw-r--r-- | src/devices/bus/newbrain/eim.cpp | 74 | ||||
-rw-r--r-- | src/devices/bus/newbrain/eim.h | 20 | ||||
-rw-r--r-- | src/devices/bus/newbrain/exp.cpp | 22 | ||||
-rw-r--r-- | src/devices/bus/newbrain/exp.h | 34 | ||||
-rw-r--r-- | src/devices/bus/newbrain/fdc.cpp | 40 | ||||
-rw-r--r-- | src/devices/bus/newbrain/fdc.h | 21 |
6 files changed, 102 insertions, 109 deletions
diff --git a/src/devices/bus/newbrain/eim.cpp b/src/devices/bus/newbrain/eim.cpp index 906b8d4d144..e1a70e6f682 100644 --- a/src/devices/bus/newbrain/eim.cpp +++ b/src/devices/bus/newbrain/eim.cpp @@ -37,7 +37,7 @@ // DEVICE DEFINITIONS //************************************************************************** -const device_type NEWBRAIN_EIM = device_creator<newbrain_eim_t>; +DEFINE_DEVICE_TYPE(NEWBRAIN_EIM, newbrain_eim_device, "newbrain_eim", "NewBrain EIM") //------------------------------------------------- @@ -57,7 +57,7 @@ ROM_END // rom_region - device-specific ROM region //------------------------------------------------- -const tiny_rom_entry *newbrain_eim_t::device_rom_region() const +const tiny_rom_entry *newbrain_eim_device::device_rom_region() const { return ROM_NAME( newbrain_eim ); } @@ -72,24 +72,24 @@ static MACHINE_CONFIG_FRAGMENT( newbrain_eim ) MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, XTAL_16MHz/8) MCFG_Z80CTC_ZC0_CB(DEVWRITELINE(MC6850_TAG, acia6850_device, write_rxc)) MCFG_Z80CTC_ZC1_CB(DEVWRITELINE(MC6850_TAG, acia6850_device, write_txc)) - MCFG_Z80CTC_ZC2_CB(WRITELINE(newbrain_eim_t, ctc_z2_w)) + MCFG_Z80CTC_ZC2_CB(WRITELINE(newbrain_eim_device, ctc_z2_w)) - MCFG_TIMER_DRIVER_ADD_PERIODIC("z80ctc_c2", newbrain_eim_t, ctc_c2_tick, attotime::from_hz(XTAL_16MHz/4/13)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("z80ctc_c2", newbrain_eim_device, ctc_c2_tick, attotime::from_hz(XTAL_16MHz/4/13)) MCFG_DEVICE_ADD(ADC0809_TAG, ADC0808, 500000) - MCFG_ADC0808_OUT_EOC_CB(WRITELINE(newbrain_eim_t, adc_eoc_w)) - MCFG_ADC0808_IN_VREF_POS_CB(newbrain_eim_t, adc_vref_pos_r) - MCFG_ADC0808_IN_VREF_NEG_CB(newbrain_eim_t, adc_vref_neg_r) - MCFG_ADC0808_IN_IN_0_CB(newbrain_eim_t, adc_input_r) - MCFG_ADC0808_IN_IN_1_CB(newbrain_eim_t, adc_input_r) - MCFG_ADC0808_IN_IN_2_CB(newbrain_eim_t, adc_input_r) - MCFG_ADC0808_IN_IN_3_CB(newbrain_eim_t, adc_input_r) - MCFG_ADC0808_IN_IN_4_CB(newbrain_eim_t, adc_input_r) - MCFG_ADC0808_IN_IN_5_CB(newbrain_eim_t, adc_input_r) - MCFG_ADC0808_IN_IN_6_CB(newbrain_eim_t, adc_input_r) - MCFG_ADC0808_IN_IN_7_CB(newbrain_eim_t, adc_input_r) + MCFG_ADC0808_OUT_EOC_CB(WRITELINE(newbrain_eim_device, adc_eoc_w)) + MCFG_ADC0808_IN_VREF_POS_CB(newbrain_eim_device, adc_vref_pos_r) + MCFG_ADC0808_IN_VREF_NEG_CB(newbrain_eim_device, adc_vref_neg_r) + MCFG_ADC0808_IN_IN_0_CB(newbrain_eim_device, adc_input_r) + MCFG_ADC0808_IN_IN_1_CB(newbrain_eim_device, adc_input_r) + MCFG_ADC0808_IN_IN_2_CB(newbrain_eim_device, adc_input_r) + MCFG_ADC0808_IN_IN_3_CB(newbrain_eim_device, adc_input_r) + MCFG_ADC0808_IN_IN_4_CB(newbrain_eim_device, adc_input_r) + MCFG_ADC0808_IN_IN_5_CB(newbrain_eim_device, adc_input_r) + MCFG_ADC0808_IN_IN_6_CB(newbrain_eim_device, adc_input_r) + MCFG_ADC0808_IN_IN_7_CB(newbrain_eim_device, adc_input_r) MCFG_DEVICE_ADD(MC6850_TAG, ACIA6850, 0) - MCFG_ACIA6850_IRQ_HANDLER(WRITELINE(newbrain_eim_t, acia_interrupt)) + MCFG_ACIA6850_IRQ_HANDLER(WRITELINE(newbrain_eim_device, acia_interrupt)) MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, nullptr) MCFG_NEWBRAIN_EXPANSION_SLOT_ADD(NEWBRAIN_EXPANSION_SLOT_TAG, XTAL_16MHz/8, newbrain_expansion_cards, "fdc") @@ -105,7 +105,7 @@ MACHINE_CONFIG_END // machine configurations //------------------------------------------------- -machine_config_constructor newbrain_eim_t::device_mconfig_additions() const +machine_config_constructor newbrain_eim_device::device_mconfig_additions() const { return MACHINE_CONFIG_NAME( newbrain_eim ); } @@ -117,11 +117,11 @@ machine_config_constructor newbrain_eim_t::device_mconfig_additions() const //************************************************************************** //------------------------------------------------- -// newbrain_eim_t - constructor +// newbrain_eim_device - constructor //------------------------------------------------- -newbrain_eim_t::newbrain_eim_t(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : - device_t(mconfig, NEWBRAIN_EIM, "Newbrain EIM", tag, owner, clock, "newbrain_eim", __FILE__), +newbrain_eim_device::newbrain_eim_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + device_t(mconfig, NEWBRAIN_EIM, tag, owner, clock), device_newbrain_expansion_slot_interface(mconfig, *this), m_ctc(*this, Z80CTC_TAG), m_acia(*this, MC6850_TAG), @@ -136,7 +136,7 @@ newbrain_eim_t::newbrain_eim_t(const machine_config &mconfig, const char *tag, d // device_start - device-specific startup //------------------------------------------------- -void newbrain_eim_t::device_start() +void newbrain_eim_device::device_start() { // state saving save_item(NAME(m_aciaint)); @@ -148,7 +148,7 @@ void newbrain_eim_t::device_start() // device_reset - device-specific reset //------------------------------------------------- -void newbrain_eim_t::device_reset() +void newbrain_eim_device::device_reset() { } @@ -157,7 +157,7 @@ void newbrain_eim_t::device_reset() // mreq_r - memory request read //------------------------------------------------- -uint8_t newbrain_eim_t::mreq_r(address_space &space, offs_t offset, uint8_t data, bool &romov, int &exrm, bool &raminh) +uint8_t newbrain_eim_device::mreq_r(address_space &space, offs_t offset, uint8_t data, bool &romov, int &exrm, bool &raminh) { return m_exp->mreq_r(space, offset, data, romov, exrm, raminh); } @@ -167,7 +167,7 @@ uint8_t newbrain_eim_t::mreq_r(address_space &space, offs_t offset, uint8_t data // mreq_w - memory request write //------------------------------------------------- -void newbrain_eim_t::mreq_w(address_space &space, offs_t offset, uint8_t data, bool &romov, int &exrm, bool &raminh) +void newbrain_eim_device::mreq_w(address_space &space, offs_t offset, uint8_t data, bool &romov, int &exrm, bool &raminh) { m_exp->mreq_w(space, offset, data, romov, exrm, raminh); } @@ -177,7 +177,7 @@ void newbrain_eim_t::mreq_w(address_space &space, offs_t offset, uint8_t data, b // iorq_r - I/O request read //------------------------------------------------- -uint8_t newbrain_eim_t::iorq_r(address_space &space, offs_t offset, uint8_t data, bool &prtov) +uint8_t newbrain_eim_device::iorq_r(address_space &space, offs_t offset, uint8_t data, bool &prtov) { return m_exp->iorq_r(space, offset, data, prtov); } @@ -187,7 +187,7 @@ uint8_t newbrain_eim_t::iorq_r(address_space &space, offs_t offset, uint8_t data // iorq_w - I/O request write //------------------------------------------------- -void newbrain_eim_t::iorq_w(address_space &space, offs_t offset, uint8_t data, bool &prtov) +void newbrain_eim_device::iorq_w(address_space &space, offs_t offset, uint8_t data, bool &prtov) { m_exp->iorq_w(space, offset, data, prtov); } @@ -197,7 +197,7 @@ void newbrain_eim_t::iorq_w(address_space &space, offs_t offset, uint8_t data, b // anout_r - //------------------------------------------------- -READ8_MEMBER( newbrain_eim_t::anout_r ) +READ8_MEMBER( newbrain_eim_device::anout_r ) { return 0xff; } @@ -207,7 +207,7 @@ READ8_MEMBER( newbrain_eim_t::anout_r ) // anout_w - //------------------------------------------------- -WRITE8_MEMBER( newbrain_eim_t::anout_w ) +WRITE8_MEMBER( newbrain_eim_device::anout_w ) { } @@ -216,7 +216,7 @@ WRITE8_MEMBER( newbrain_eim_t::anout_w ) // anin_r - //------------------------------------------------- -READ8_MEMBER( newbrain_eim_t::anin_r ) +READ8_MEMBER( newbrain_eim_device::anin_r ) { return 0; } @@ -226,7 +226,7 @@ READ8_MEMBER( newbrain_eim_t::anin_r ) // anio_w - //------------------------------------------------- -WRITE8_MEMBER( newbrain_eim_t::anio_w ) +WRITE8_MEMBER( newbrain_eim_device::anio_w ) { } @@ -235,7 +235,7 @@ WRITE8_MEMBER( newbrain_eim_t::anio_w ) // adc_eoc_w - //------------------------------------------------- -WRITE_LINE_MEMBER( newbrain_eim_t::adc_eoc_w ) +WRITE_LINE_MEMBER( newbrain_eim_device::adc_eoc_w ) { m_anint = state; } @@ -245,7 +245,7 @@ WRITE_LINE_MEMBER( newbrain_eim_t::adc_eoc_w ) // adc_vref_pos_r - //------------------------------------------------- -ADC0808_ANALOG_READ_CB( newbrain_eim_t::adc_vref_pos_r ) +ADC0808_ANALOG_READ_CB( newbrain_eim_device::adc_vref_pos_r ) { return 5.0; } @@ -255,7 +255,7 @@ ADC0808_ANALOG_READ_CB( newbrain_eim_t::adc_vref_pos_r ) // adc_vref_neg_r - //------------------------------------------------- -ADC0808_ANALOG_READ_CB( newbrain_eim_t::adc_vref_neg_r ) +ADC0808_ANALOG_READ_CB( newbrain_eim_device::adc_vref_neg_r ) { return 0.0; } @@ -265,7 +265,7 @@ ADC0808_ANALOG_READ_CB( newbrain_eim_t::adc_vref_neg_r ) // adc_input_r - //------------------------------------------------- -ADC0808_ANALOG_READ_CB( newbrain_eim_t::adc_input_r ) +ADC0808_ANALOG_READ_CB( newbrain_eim_device::adc_input_r ) { return 0.0; } @@ -275,7 +275,7 @@ ADC0808_ANALOG_READ_CB( newbrain_eim_t::adc_input_r ) // acia_interrupt - //------------------------------------------------- -WRITE_LINE_MEMBER( newbrain_eim_t::acia_interrupt ) +WRITE_LINE_MEMBER( newbrain_eim_device::acia_interrupt ) { m_aciaint = state; } @@ -285,7 +285,7 @@ WRITE_LINE_MEMBER( newbrain_eim_t::acia_interrupt ) // ctc_z2_w - //------------------------------------------------- -WRITE_LINE_MEMBER( newbrain_eim_t::ctc_z2_w ) +WRITE_LINE_MEMBER( newbrain_eim_device::ctc_z2_w ) { // connected to CTC channel 0/1 clock inputs m_ctc->trg0(state); @@ -297,7 +297,7 @@ WRITE_LINE_MEMBER( newbrain_eim_t::ctc_z2_w ) // adc_input_r - //------------------------------------------------- -TIMER_DEVICE_CALLBACK_MEMBER(newbrain_eim_t::ctc_c2_tick) +TIMER_DEVICE_CALLBACK_MEMBER(newbrain_eim_device::ctc_c2_tick) { m_ctc->trg2(1); m_ctc->trg2(0); diff --git a/src/devices/bus/newbrain/eim.h b/src/devices/bus/newbrain/eim.h index 58024f60cf4..a2406303d9c 100644 --- a/src/devices/bus/newbrain/eim.h +++ b/src/devices/bus/newbrain/eim.h @@ -6,10 +6,10 @@ **********************************************************************/ -#pragma once +#ifndef MAME_BUS_NEWBRAIN_EIM_H +#define MAME_BUS_NEWBRAIN_EIM_H -#ifndef __NEWBRAIN_EIM__ -#define __NEWBRAIN_EIM__ +#pragma once #include "exp.h" #include "bus/rs232/rs232.h" @@ -24,14 +24,13 @@ // TYPE DEFINITIONS //************************************************************************** -// ======================> newbrain_eim_t +// ======================> newbrain_eim_device -class newbrain_eim_t : public device_t, - public device_newbrain_expansion_slot_interface +class newbrain_eim_device : public device_t, public device_newbrain_expansion_slot_interface { public: // construction/destruction - newbrain_eim_t(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + newbrain_eim_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); // optional information overrides virtual const tiny_rom_entry *device_rom_region() const override; @@ -65,7 +64,7 @@ protected: private: required_device<z80ctc_device> m_ctc; required_device<acia6850_device> m_acia; - required_device<newbrain_expansion_slot_t> m_exp; + required_device<newbrain_expansion_slot_device> m_exp; required_memory_region m_rom; optional_shared_ptr<uint8_t> m_ram; @@ -76,7 +75,6 @@ private: // device type definition extern const device_type NEWBRAIN_EIM; +DECLARE_DEVICE_TYPE(NEWBRAIN_EIM, newbrain_eim_device) - - -#endif +#endif // MAME_BUS_NEWBRAIN_EIM_H diff --git a/src/devices/bus/newbrain/exp.cpp b/src/devices/bus/newbrain/exp.cpp index 9e8c989e982..7a27758764a 100644 --- a/src/devices/bus/newbrain/exp.cpp +++ b/src/devices/bus/newbrain/exp.cpp @@ -15,7 +15,7 @@ // GLOBAL VARIABLES //************************************************************************** -const device_type NEWBRAIN_EXPANSION_SLOT = device_creator<newbrain_expansion_slot_t>; +DEFINE_DEVICE_TYPE(NEWBRAIN_EXPANSION_SLOT, newbrain_expansion_slot_device, "newbrain_expansion_slot", "NewBrain expansion port") @@ -30,7 +30,7 @@ const device_type NEWBRAIN_EXPANSION_SLOT = device_creator<newbrain_expansion_sl device_newbrain_expansion_slot_interface::device_newbrain_expansion_slot_interface(const machine_config &mconfig, device_t &device) : device_slot_card_interface(mconfig,device) { - m_slot = dynamic_cast<newbrain_expansion_slot_t *>(device.owner()); + m_slot = dynamic_cast<newbrain_expansion_slot_device *>(device.owner()); } @@ -40,11 +40,11 @@ device_newbrain_expansion_slot_interface::device_newbrain_expansion_slot_interfa //************************************************************************** //------------------------------------------------- -// newbrain_expansion_slot_t - constructor +// newbrain_expansion_slot_device - constructor //------------------------------------------------- -newbrain_expansion_slot_t::newbrain_expansion_slot_t(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : - device_t(mconfig, NEWBRAIN_EXPANSION_SLOT, "NewBrain expansion port", tag, owner, clock, "newbrain_expansion_slot", __FILE__), +newbrain_expansion_slot_device::newbrain_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + device_t(mconfig, NEWBRAIN_EXPANSION_SLOT, tag, owner, clock), device_slot_interface(mconfig, *this), m_card(nullptr) { } @@ -54,7 +54,7 @@ newbrain_expansion_slot_t::newbrain_expansion_slot_t(const machine_config &mconf // device_start - device-specific startup //------------------------------------------------- -void newbrain_expansion_slot_t::device_start() +void newbrain_expansion_slot_device::device_start() { m_card = dynamic_cast<device_newbrain_expansion_slot_interface *>(get_card_device()); } @@ -64,7 +64,7 @@ void newbrain_expansion_slot_t::device_start() // device_reset - device-specific reset //------------------------------------------------- -void newbrain_expansion_slot_t::device_reset() +void newbrain_expansion_slot_device::device_reset() { if (m_card != nullptr) { @@ -77,7 +77,7 @@ void newbrain_expansion_slot_t::device_reset() // mreq_r - memory request read //------------------------------------------------- -uint8_t newbrain_expansion_slot_t::mreq_r(address_space &space, offs_t offset, uint8_t data, bool &romov, int &exrm, bool &raminh) +uint8_t newbrain_expansion_slot_device::mreq_r(address_space &space, offs_t offset, uint8_t data, bool &romov, int &exrm, bool &raminh) { if (m_card != nullptr) { @@ -92,7 +92,7 @@ uint8_t newbrain_expansion_slot_t::mreq_r(address_space &space, offs_t offset, u // mreq_w - memory request write //------------------------------------------------- -void newbrain_expansion_slot_t::mreq_w(address_space &space, offs_t offset, uint8_t data, bool &romov, int &exrm, bool &raminh) +void newbrain_expansion_slot_device::mreq_w(address_space &space, offs_t offset, uint8_t data, bool &romov, int &exrm, bool &raminh) { if (m_card != nullptr) { @@ -105,7 +105,7 @@ void newbrain_expansion_slot_t::mreq_w(address_space &space, offs_t offset, uint // iorq_r - I/O request read //------------------------------------------------- -uint8_t newbrain_expansion_slot_t::iorq_r(address_space &space, offs_t offset, uint8_t data, bool &prtov) +uint8_t newbrain_expansion_slot_device::iorq_r(address_space &space, offs_t offset, uint8_t data, bool &prtov) { if (m_card != nullptr) { @@ -120,7 +120,7 @@ uint8_t newbrain_expansion_slot_t::iorq_r(address_space &space, offs_t offset, u // iorq_w - I/O request write //------------------------------------------------- -void newbrain_expansion_slot_t::iorq_w(address_space &space, offs_t offset, uint8_t data, bool &prtov) +void newbrain_expansion_slot_device::iorq_w(address_space &space, offs_t offset, uint8_t data, bool &prtov) { if (m_card != nullptr) { diff --git a/src/devices/bus/newbrain/exp.h b/src/devices/bus/newbrain/exp.h index 0c07190bdf0..219c819d575 100644 --- a/src/devices/bus/newbrain/exp.h +++ b/src/devices/bus/newbrain/exp.h @@ -34,10 +34,10 @@ **********************************************************************/ -#pragma once +#ifndef MAME_BUS_NEWBRAIN_EXP_H +#define MAME_BUS_NEWBRAIN_EXP_H -#ifndef __NEWBRAIN_EXPANSION_SLOT__ -#define __NEWBRAIN_EXPANSION_SLOT__ +#pragma once @@ -64,17 +64,16 @@ // TYPE DEFINITIONS //************************************************************************** -// ======================> newbrain_expansion_slot_t +// ======================> newbrain_expansion_slot_device class device_newbrain_expansion_slot_interface; -class newbrain_expansion_slot_t : public device_t, +class newbrain_expansion_slot_device : public device_t, public device_slot_interface { public: // construction/destruction - newbrain_expansion_slot_t(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - virtual ~newbrain_expansion_slot_t() { } + newbrain_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); // computer interface uint8_t mreq_r(address_space &space, offs_t offset, uint8_t data, bool &romov, int &exrm, bool &raminh); @@ -98,29 +97,28 @@ protected: class device_newbrain_expansion_slot_interface : public device_slot_card_interface { public: - // construction/destruction - device_newbrain_expansion_slot_interface(const machine_config &mconfig, device_t &device); - virtual ~device_newbrain_expansion_slot_interface() { } - // memory access - virtual uint8_t mreq_r(address_space &space, offs_t offset, uint8_t data, bool &romov, int &exrm, bool &raminh) { return data; }; - virtual void mreq_w(address_space &space, offs_t offset, uint8_t data, bool &romov, int &exrm, bool &raminh) { }; + virtual uint8_t mreq_r(address_space &space, offs_t offset, uint8_t data, bool &romov, int &exrm, bool &raminh) { return data; } + virtual void mreq_w(address_space &space, offs_t offset, uint8_t data, bool &romov, int &exrm, bool &raminh) { } // I/O access - virtual uint8_t iorq_r(address_space &space, offs_t offset, uint8_t data, bool &prtov) { return data; }; - virtual void iorq_w(address_space &space, offs_t offset, uint8_t data, bool &prtov) { }; + virtual uint8_t iorq_r(address_space &space, offs_t offset, uint8_t data, bool &prtov) { return data; } + virtual void iorq_w(address_space &space, offs_t offset, uint8_t data, bool &prtov) { } protected: - newbrain_expansion_slot_t *m_slot; + // construction/destruction + device_newbrain_expansion_slot_interface(const machine_config &mconfig, device_t &device); + + newbrain_expansion_slot_device *m_slot; }; // device type definition -extern const device_type NEWBRAIN_EXPANSION_SLOT; +DECLARE_DEVICE_TYPE(NEWBRAIN_EXPANSION_SLOT, newbrain_expansion_slot_device) SLOT_INTERFACE_EXTERN( newbrain_expansion_cards ); -#endif +#endif // MAME_BUS_NEWBRAIN_EXP_H diff --git a/src/devices/bus/newbrain/fdc.cpp b/src/devices/bus/newbrain/fdc.cpp index b63d7ddffa8..4618588353a 100644 --- a/src/devices/bus/newbrain/fdc.cpp +++ b/src/devices/bus/newbrain/fdc.cpp @@ -35,7 +35,7 @@ // DEVICE DEFINITIONS //************************************************************************** -const device_type NEWBRAIN_FDC = device_creator<newbrain_fdc_t>; +DEFINE_DEVICE_TYPE(NEWBRAIN_FDC, newbrain_fdc_device, "newbrain_fdc", "NewBrain FDC") //------------------------------------------------- @@ -59,7 +59,7 @@ ROM_END // rom_region - device-specific ROM region //------------------------------------------------- -const tiny_rom_entry *newbrain_fdc_t::device_rom_region() const +const tiny_rom_entry *newbrain_fdc_device::device_rom_region() const { return ROM_NAME( newbrain_fdc ); } @@ -69,7 +69,7 @@ const tiny_rom_entry *newbrain_fdc_t::device_rom_region() const // ADDRESS_MAP( newbrain_fdc_mem ) //------------------------------------------------- -static ADDRESS_MAP_START( newbrain_fdc_mem, AS_PROGRAM, 8, newbrain_fdc_t ) +static ADDRESS_MAP_START( newbrain_fdc_mem, AS_PROGRAM, 8, newbrain_fdc_device ) ADDRESS_MAP_UNMAP_HIGH AM_RANGE(0x0000, 0x1fff) AM_ROM ADDRESS_MAP_END @@ -79,7 +79,7 @@ ADDRESS_MAP_END // ADDRESS_MAP( newbrain_fdc_io ) //------------------------------------------------- -static ADDRESS_MAP_START( newbrain_fdc_io, AS_IO, 8, newbrain_fdc_t ) +static ADDRESS_MAP_START( newbrain_fdc_io, AS_IO, 8, newbrain_fdc_device ) ADDRESS_MAP_UNMAP_HIGH ADDRESS_MAP_GLOBAL_MASK(0x71) AM_RANGE(0x00, 0x01) AM_MIRROR(0x10) AM_DEVICE(UPD765_TAG, upd765a_device, map) @@ -107,7 +107,7 @@ static MACHINE_CONFIG_FRAGMENT( newbrain_fdc ) MCFG_CPU_IO_MAP(newbrain_fdc_io) MCFG_UPD765A_ADD(UPD765_TAG, false, true) - MCFG_UPD765_INTRQ_CALLBACK(WRITELINE(newbrain_fdc_t, fdc_int_w)) + MCFG_UPD765_INTRQ_CALLBACK(WRITELINE(newbrain_fdc_device, fdc_int_w)) MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":0", newbrain_floppies, "525dd", floppy_image_device::default_floppy_formats) MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":1", newbrain_floppies, "525dd", floppy_image_device::default_floppy_formats) @@ -123,7 +123,7 @@ MACHINE_CONFIG_END // machine configurations //------------------------------------------------- -machine_config_constructor newbrain_fdc_t::device_mconfig_additions() const +machine_config_constructor newbrain_fdc_device::device_mconfig_additions() const { return MACHINE_CONFIG_NAME( newbrain_fdc ); } @@ -134,11 +134,11 @@ machine_config_constructor newbrain_fdc_t::device_mconfig_additions() const //************************************************************************** //------------------------------------------------- -// newbrain_fdc_t - constructor +// newbrain_fdc_device - constructor //------------------------------------------------- -newbrain_fdc_t::newbrain_fdc_t(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : - device_t(mconfig, NEWBRAIN_FDC, "NewBrain FDC", tag, owner, clock, "newbrain_fdc", __FILE__), +newbrain_fdc_device::newbrain_fdc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + device_t(mconfig, NEWBRAIN_FDC, tag, owner, clock), device_newbrain_expansion_slot_interface(mconfig, *this), m_maincpu(*this, Z80_TAG), m_fdc(*this, UPD765_TAG), @@ -155,7 +155,7 @@ newbrain_fdc_t::newbrain_fdc_t(const machine_config &mconfig, const char *tag, d // device_start - device-specific startup //------------------------------------------------- -void newbrain_fdc_t::device_start() +void newbrain_fdc_device::device_start() { save_item(NAME(m_paging)); save_item(NAME(m_ma16)); @@ -170,7 +170,7 @@ void newbrain_fdc_t::device_start() // device_reset - device-specific reset //------------------------------------------------- -void newbrain_fdc_t::device_reset() +void newbrain_fdc_device::device_reset() { m_maincpu->reset(); @@ -184,7 +184,7 @@ void newbrain_fdc_t::device_reset() // mreq_r - memory request read //------------------------------------------------- -uint8_t newbrain_fdc_t::mreq_r(address_space &space, offs_t offset, uint8_t data, bool &romov, int &exrm, bool &raminh) +uint8_t newbrain_fdc_device::mreq_r(address_space &space, offs_t offset, uint8_t data, bool &romov, int &exrm, bool &raminh) { return m_exp->mreq_r(space, offset, data, romov, exrm, raminh); } @@ -194,7 +194,7 @@ uint8_t newbrain_fdc_t::mreq_r(address_space &space, offs_t offset, uint8_t data // mreq_w - memory request write //------------------------------------------------- -void newbrain_fdc_t::mreq_w(address_space &space, offs_t offset, uint8_t data, bool &romov, int &exrm, bool &raminh) +void newbrain_fdc_device::mreq_w(address_space &space, offs_t offset, uint8_t data, bool &romov, int &exrm, bool &raminh) { m_exp->mreq_w(space, offset, data, romov, exrm, raminh); } @@ -204,7 +204,7 @@ void newbrain_fdc_t::mreq_w(address_space &space, offs_t offset, uint8_t data, b // iorq_r - I/O request read //------------------------------------------------- -uint8_t newbrain_fdc_t::iorq_r(address_space &space, offs_t offset, uint8_t data, bool &prtov) +uint8_t newbrain_fdc_device::iorq_r(address_space &space, offs_t offset, uint8_t data, bool &prtov) { return m_exp->iorq_r(space, offset, data, prtov); } @@ -214,7 +214,7 @@ uint8_t newbrain_fdc_t::iorq_r(address_space &space, offs_t offset, uint8_t data // iorq_w - I/O request write //------------------------------------------------- -void newbrain_fdc_t::iorq_w(address_space &space, offs_t offset, uint8_t data, bool &prtov) +void newbrain_fdc_device::iorq_w(address_space &space, offs_t offset, uint8_t data, bool &prtov) { m_exp->iorq_w(space, offset, data, prtov); @@ -229,7 +229,7 @@ void newbrain_fdc_t::iorq_w(address_space &space, offs_t offset, uint8_t data, b // moton - floppy motor on //------------------------------------------------- -void newbrain_fdc_t::moton(int state) +void newbrain_fdc_device::moton(int state) { if (m_floppy0->get_device()) m_floppy0->get_device()->mon_w(!state); if (m_floppy1->get_device()) m_floppy1->get_device()->mon_w(!state); @@ -242,7 +242,7 @@ void newbrain_fdc_t::moton(int state) // fdc_int_w - //------------------------------------------------- -WRITE_LINE_MEMBER( newbrain_fdc_t::fdc_int_w ) +WRITE_LINE_MEMBER( newbrain_fdc_device::fdc_int_w ) { m_fdc_int = state; } @@ -252,7 +252,7 @@ WRITE_LINE_MEMBER( newbrain_fdc_t::fdc_int_w ) // fdc_auxiliary_w - //------------------------------------------------- -WRITE8_MEMBER( newbrain_fdc_t::fdc_auxiliary_w ) +WRITE8_MEMBER( newbrain_fdc_device::fdc_auxiliary_w ) { /* @@ -286,7 +286,7 @@ WRITE8_MEMBER( newbrain_fdc_t::fdc_auxiliary_w ) // fdc_control_r - //------------------------------------------------- -READ8_MEMBER( newbrain_fdc_t::fdc_control_r ) +READ8_MEMBER( newbrain_fdc_device::fdc_control_r ) { /* @@ -311,7 +311,7 @@ READ8_MEMBER( newbrain_fdc_t::fdc_control_r ) // io_dec_w - 0x20f //------------------------------------------------- -WRITE8_MEMBER( newbrain_fdc_t::io_dec_w ) +WRITE8_MEMBER( newbrain_fdc_device::io_dec_w ) { /* diff --git a/src/devices/bus/newbrain/fdc.h b/src/devices/bus/newbrain/fdc.h index b34e88441ee..c429d8ea447 100644 --- a/src/devices/bus/newbrain/fdc.h +++ b/src/devices/bus/newbrain/fdc.h @@ -6,10 +6,10 @@ **********************************************************************/ -#pragma once +#ifndef MAME_BUS_NEWBRAIN_FDC_H +#define MAME_BUS_NEWBRAIN_FDC_H -#ifndef __NEWBRAIN_FDC__ -#define __NEWBRAIN_FDC__ +#pragma once #include "exp.h" #include "cpu/z80/z80.h" @@ -21,14 +21,13 @@ // TYPE DEFINITIONS //************************************************************************** -// ======================> newbrain_fdc_t +// ======================> newbrain_fdc_device -class newbrain_fdc_t : public device_t, - public device_newbrain_expansion_slot_interface +class newbrain_fdc_device : public device_t, public device_newbrain_expansion_slot_interface { public: // construction/destruction - newbrain_fdc_t(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + newbrain_fdc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); // optional information overrides virtual const tiny_rom_entry *device_rom_region() const override; @@ -57,7 +56,7 @@ private: required_device<floppy_connector> m_floppy1; required_device<floppy_connector> m_floppy2; required_device<floppy_connector> m_floppy3; - required_device<newbrain_expansion_slot_t> m_exp; + required_device<newbrain_expansion_slot_device> m_exp; void moton(int state); @@ -71,8 +70,6 @@ private: // device type definition -extern const device_type NEWBRAIN_FDC; - - +DECLARE_DEVICE_TYPE(NEWBRAIN_FDC, newbrain_fdc_device) -#endif +#endif // MAME_BUS_NEWBRAIN_FDC_H |