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/cpu/mcs96 | |
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/cpu/mcs96')
-rw-r--r-- | src/devices/cpu/mcs96/i8x9x.cpp | 12 | ||||
-rw-r--r-- | src/devices/cpu/mcs96/i8x9x.h | 14 | ||||
-rw-r--r-- | src/devices/cpu/mcs96/i8xc196.cpp | 4 | ||||
-rw-r--r-- | src/devices/cpu/mcs96/i8xc196.h | 10 | ||||
-rw-r--r-- | src/devices/cpu/mcs96/mcs96.cpp | 7 | ||||
-rw-r--r-- | src/devices/cpu/mcs96/mcs96.h | 22 |
6 files changed, 36 insertions, 33 deletions
diff --git a/src/devices/cpu/mcs96/i8x9x.cpp b/src/devices/cpu/mcs96/i8x9x.cpp index 151a4809cb8..1118ef80c36 100644 --- a/src/devices/cpu/mcs96/i8x9x.cpp +++ b/src/devices/cpu/mcs96/i8x9x.cpp @@ -11,8 +11,8 @@ #include "emu.h" #include "i8x9x.h" -i8x9x_device::i8x9x_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source) : - mcs96_device(mconfig, type, name, tag, owner, clock, 8, "i8x9x", __FILE__), +i8x9x_device::i8x9x_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) : + mcs96_device(mconfig, type, tag, owner, clock, 8), io_config("io", ENDIANNESS_LITTLE, 16, 16, -1), io(nullptr), base_timer2(0), ad_done(0), hso_command(0), ad_command(0), hso_time(0), ad_result(0), ios0(0), ios1(0), ioc0(0), ioc1(0), sbuf(0), sp_stat(0), serial_send_buf(0), serial_send_timer(0) { @@ -359,16 +359,16 @@ void i8x9x_device::internal_update(uint64_t current_time) } c8095_device::c8095_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : - i8x9x_device(mconfig, C8095, "C8095", tag, owner, clock, "c8095", __FILE__) + i8x9x_device(mconfig, C8095, tag, owner, clock) { } p8098_device::p8098_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : - i8x9x_device(mconfig, P8098, "P8098", tag, owner, clock, "p8098", __FILE__) + i8x9x_device(mconfig, P8098, tag, owner, clock) { } -const device_type C8095 = device_creator<c8095_device>; -const device_type P8098 = C8095; +DEFINE_DEVICE_TYPE(C8095, c8095_device, "c8095", "C8095") +DEFINE_DEVICE_TYPE(P8098, p8098_device, "p8098", "P8098") #include "cpu/mcs96/i8x9x.hxx" diff --git a/src/devices/cpu/mcs96/i8x9x.h b/src/devices/cpu/mcs96/i8x9x.h index efb8997dabb..1951f672ada 100644 --- a/src/devices/cpu/mcs96/i8x9x.h +++ b/src/devices/cpu/mcs96/i8x9x.h @@ -8,8 +8,8 @@ ***************************************************************************/ -#ifndef __I8X9X_H__ -#define __I8X9X_H__ +#ifndef MAME_CPU_MCS96_I8X9X_H +#define MAME_CPU_MCS96_I8X9X_H #include "mcs96.h" @@ -21,11 +21,11 @@ public: P0, P1, P2 }; - i8x9x_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source); - void serial_w(uint8_t val); protected: + i8x9x_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); + virtual void device_start() override; virtual void device_reset() override; virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override; @@ -92,7 +92,7 @@ public: p8098_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); }; -extern const device_type C8095; -extern const device_type P8098; +DECLARE_DEVICE_TYPE(C8095, c8095_device) +DECLARE_DEVICE_TYPE(P8098, p8098_device) -#endif +#endif // MAME_CPU_MCS96_I8X9X_H diff --git a/src/devices/cpu/mcs96/i8xc196.cpp b/src/devices/cpu/mcs96/i8xc196.cpp index ce9c9b9d8ac..adffde72dc0 100644 --- a/src/devices/cpu/mcs96/i8xc196.cpp +++ b/src/devices/cpu/mcs96/i8xc196.cpp @@ -11,8 +11,8 @@ #include "emu.h" #include "i8xc196.h" -i8xc196_device::i8xc196_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source) : - mcs96_device(mconfig, type, name, tag, owner, clock, 16, shortname, source) +i8xc196_device::i8xc196_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) : + mcs96_device(mconfig, type, tag, owner, clock, 16) { } diff --git a/src/devices/cpu/mcs96/i8xc196.h b/src/devices/cpu/mcs96/i8xc196.h index 54e811e35b0..bd5489a1721 100644 --- a/src/devices/cpu/mcs96/i8xc196.h +++ b/src/devices/cpu/mcs96/i8xc196.h @@ -8,14 +8,14 @@ ***************************************************************************/ -#ifndef __I8XC196_H__ -#define __I8XC196_H__ +#ifndef MAME_CPU_MCS96_I8XC196_H +#define MAME_CPU_MCS96_I8XC196_H #include "mcs96.h" class i8xc196_device : public mcs96_device { -public: - i8xc196_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source); +protected: + i8xc196_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); static const disasm_entry disasm_entries[0x100]; @@ -43,4 +43,4 @@ public: #undef O }; -#endif +#endif // MAME_CPU_MCS96_I8XC196_H diff --git a/src/devices/cpu/mcs96/mcs96.cpp b/src/devices/cpu/mcs96/mcs96.cpp index be96adecaa7..11d9cf23f30 100644 --- a/src/devices/cpu/mcs96/mcs96.cpp +++ b/src/devices/cpu/mcs96/mcs96.cpp @@ -12,9 +12,10 @@ #include "debugger.h" #include "mcs96.h" -mcs96_device::mcs96_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, int data_width, const char *shortname, const char *source) : - cpu_device(mconfig, type, name, tag, owner, clock, shortname, source), - program_config("program", ENDIANNESS_LITTLE, data_width, 16), program(nullptr), direct(nullptr), icount(0), bcount(0), inst_state(0), cycles_scaling(0), pending_irq(0), +mcs96_device::mcs96_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, int data_width) : + cpu_device(mconfig, type, tag, owner, clock), + program_config("program", ENDIANNESS_LITTLE, data_width, 16), + program(nullptr), direct(nullptr), icount(0), bcount(0), inst_state(0), cycles_scaling(0), pending_irq(0), PC(0), PPC(0), PSW(0), OP1(0), OP2(0), OP3(0), OPI(0), TMP(0), irq_requested(false) { } diff --git a/src/devices/cpu/mcs96/mcs96.h b/src/devices/cpu/mcs96/mcs96.h index f4cda34c224..57c4e2cedd4 100644 --- a/src/devices/cpu/mcs96/mcs96.h +++ b/src/devices/cpu/mcs96/mcs96.h @@ -8,8 +8,10 @@ ***************************************************************************/ -#ifndef __MCS96_H__ -#define __MCS96_H__ +#ifndef MAME_CPU_MCS96_MCS96_H +#define MAME_CPU_MCS96_MCS96_H + +#pragma once class mcs96_device : public cpu_device { public: @@ -17,7 +19,11 @@ public: EXINT_LINE = 1 }; - mcs96_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, int data_width, const char *shortname, const char *source); + enum { + MCS96_PC = 1, + MCS96_PSW, + MCS96_R // 0x74 entries + }; protected: enum { @@ -68,6 +74,8 @@ protected: DASM_indexed_3 /* Indexed, short or long, 3 operators */ }; + mcs96_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, int data_width); + // device-level overrides virtual void device_start() override; virtual void device_reset() override; @@ -247,10 +255,4 @@ protected: #undef O }; -enum { - MCS96_PC = 1, - MCS96_PSW, - MCS96_R // 0x74 entries -}; - -#endif +#endif // MAME_CPU_MCS96_MCS96_H |