summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/t11
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2017-05-07 23:18:47 +1000
committer Vas Crabb <vas@vastheman.com>2017-05-14 21:44:11 +1000
commit0f0d39ef81562c75e79176dd3bebb1e491ca39d5 (patch)
tree201cee7fdf55ee800f83859a92efd2cfe66cf2b3 /src/devices/cpu/t11
parente6c4be2b4d71c7a6c95be0bae111eb416ff0f9e7 (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/t11')
-rw-r--r--src/devices/cpu/t11/t11.cpp20
-rw-r--r--src/devices/cpu/t11/t11.h19
2 files changed, 16 insertions, 23 deletions
diff --git a/src/devices/cpu/t11/t11.cpp b/src/devices/cpu/t11/t11.cpp
index f02649af571..9ff4654cce7 100644
--- a/src/devices/cpu/t11/t11.cpp
+++ b/src/devices/cpu/t11/t11.cpp
@@ -12,8 +12,8 @@
*****************************************************************************/
#include "emu.h"
-#include "debugger.h"
#include "t11.h"
+#include "debugger.h"
/*************************************
@@ -35,17 +35,17 @@
#define PSW m_psw.b.l
-const device_type T11 = device_creator<t11_device>;
-const device_type K1801VM2 = device_creator<k1801vm2_device>;
+DEFINE_DEVICE_TYPE(T11, t11_device, "t11", "T11")
+DEFINE_DEVICE_TYPE(K1801VM2, k1801vm2_device, "k1801vm2", "K1801VM2")
k1801vm2_device::k1801vm2_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : t11_device(mconfig, K1801VM2, "K1801VM2", tag, owner, clock, "k1801vm2", __FILE__)
+ : t11_device(mconfig, K1801VM2, tag, owner, clock)
{
}
-t11_device::t11_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)
- : cpu_device(mconfig, type, name, tag, owner, clock, shortname, source)
+t11_device::t11_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
+ : cpu_device(mconfig, type, tag, owner, clock)
, m_program_config("program", ENDIANNESS_LITTLE, 16, 16, 0)
, c_initial_mode(0)
, m_out_reset_func(*this)
@@ -56,14 +56,8 @@ t11_device::t11_device(const machine_config &mconfig, device_type type, const ch
}
t11_device::t11_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : cpu_device(mconfig, T11, "T11", tag, owner, clock, "t11", __FILE__)
- , m_program_config("program", ENDIANNESS_LITTLE, 16, 16, 0)
- , c_initial_mode(0)
- , m_out_reset_func(*this)
+ : t11_device(mconfig, T11, tag, owner, clock)
{
- m_program_config.m_is_octal = true;
- memset(m_reg, 0x00, sizeof(m_reg));
- memset(&m_psw, 0x00, sizeof(m_psw));
}
diff --git a/src/devices/cpu/t11/t11.h b/src/devices/cpu/t11/t11.h
index a25f35f1a17..dbf62e6f5e5 100644
--- a/src/devices/cpu/t11/t11.h
+++ b/src/devices/cpu/t11/t11.h
@@ -2,10 +2,10 @@
// copyright-holders:Aaron Giles
/*** T-11: Portable DEC T-11 emulator ******************************************/
-#pragma once
+#ifndef MAME_CPU_T11_T11_H
+#define MAME_CPU_T11_T11_H
-#ifndef __T11_H__
-#define __T11_H__
+#pragma once
enum
@@ -39,13 +39,14 @@ class t11_device : public cpu_device
public:
// construction/destruction
t11_device(const machine_config &mconfig, const char *_tag, device_t *_owner, uint32_t _clock);
- t11_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);
// static configuration helpers
static void set_initial_mode(device_t &device, const uint16_t mode) { downcast<t11_device &>(device).c_initial_mode = mode; }
- template<class _Object> static devcb_base &set_out_reset_func(device_t &device, _Object object) { return downcast<t11_device &>(device).m_out_reset_func.set_callback(object); }
+ template <class Object> static devcb_base &set_out_reset_func(device_t &device, Object &&cb) { return downcast<t11_device &>(device).m_out_reset_func.set_callback(std::forward<Object>(cb)); }
protected:
+ t11_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
+
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
@@ -69,7 +70,6 @@ protected:
virtual uint32_t disasm_max_opcode_bytes() const override { return 6; }
virtual offs_t disasm_disassemble(std::ostream &stream, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t options) override;
-protected:
address_space_config m_program_config;
uint16_t c_initial_mode;
@@ -1153,8 +1153,7 @@ protected:
};
-extern const device_type T11;
-extern const device_type K1801VM2;
-
+DECLARE_DEVICE_TYPE(T11, t11_device)
+DECLARE_DEVICE_TYPE(K1801VM2, k1801vm2_device)
-#endif /* __T11_H__ */
+#endif // MAME_CPU_T11_T11_H