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/snes/sdd1.cpp | |
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/snes/sdd1.cpp')
-rw-r--r-- | src/devices/bus/snes/sdd1.cpp | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/src/devices/bus/snes/sdd1.cpp b/src/devices/bus/snes/sdd1.cpp index cddff2082f4..e6f0ee179d2 100644 --- a/src/devices/bus/snes/sdd1.cpp +++ b/src/devices/bus/snes/sdd1.cpp @@ -20,13 +20,13 @@ // Input Manager -void SDD1_IM::IM_prepareDecomp(uint32_t in_buf) +void sns_rom_sdd1_device::SDD1_IM::IM_prepareDecomp(uint32_t in_buf) { m_byte_ptr = in_buf; m_bit_count = 4; } -uint8_t SDD1_IM::IM_getCodeword(uint8_t *ROM, uint32_t *mmc, const uint8_t code_len) +uint8_t sns_rom_sdd1_device::SDD1_IM::IM_getCodeword(uint8_t *ROM, uint32_t *mmc, const uint8_t code_len) { uint8_t codeword = ROM[SSD1_ADD(m_byte_ptr)] << m_bit_count; @@ -49,9 +49,9 @@ uint8_t SDD1_IM::IM_getCodeword(uint8_t *ROM, uint32_t *mmc, const uint8_t code_ // GCD -void SDD1_GCD::GCD_getRunCount(uint8_t *ROM, uint32_t *mmc, uint8_t code_num, uint8_t* MPScount, uint8_t* LPSind) +void sns_rom_sdd1_device::SDD1_GCD::GCD_getRunCount(uint8_t *ROM, uint32_t *mmc, uint8_t code_num, uint8_t* MPScount, uint8_t* LPSind) { - const uint8_t run_count[] = + static constexpr uint8_t run_count[] = { 0x00, 0x00, 0x01, 0x00, 0x03, 0x01, 0x02, 0x00, 0x07, 0x03, 0x05, 0x01, 0x06, 0x02, 0x04, 0x00, @@ -102,13 +102,13 @@ void SDD1_GCD::GCD_getRunCount(uint8_t *ROM, uint32_t *mmc, uint8_t code_num, ui // BG -void SDD1_BG::BG_prepareDecomp() +void sns_rom_sdd1_device::SDD1_BG::BG_prepareDecomp() { m_MPScount = 0; m_LPSind = 0; } -uint8_t SDD1_BG::BG_getBit(uint8_t *ROM, uint32_t *mmc, uint8_t* endOfRun) +uint8_t sns_rom_sdd1_device::SDD1_BG::BG_getBit(uint8_t *ROM, uint32_t *mmc, uint8_t* endOfRun) { uint8_t bit; @@ -149,7 +149,7 @@ struct SDD1_PEM_state uint8_t nextIfLPS; }; -static const SDD1_PEM_state PEM_evolution_table[33] = +static constexpr SDD1_PEM_state PEM_evolution_table[33] = { { 0,25,25}, { 0, 2, 1}, @@ -186,7 +186,7 @@ static const SDD1_PEM_state PEM_evolution_table[33] = { 7,24,22} }; -void SDD1_PEM::PEM_prepareDecomp() +void sns_rom_sdd1_device::SDD1_PEM::PEM_prepareDecomp() { for (auto & elem : m_contextInfo) { @@ -195,7 +195,7 @@ void SDD1_PEM::PEM_prepareDecomp() } } -uint8_t SDD1_PEM::PEM_getBit(uint8_t *ROM, uint32_t *mmc, uint8_t context) +uint8_t sns_rom_sdd1_device::SDD1_PEM::PEM_getBit(uint8_t *ROM, uint32_t *mmc, uint8_t context) { uint8_t endOfRun; uint8_t bit; @@ -228,7 +228,7 @@ uint8_t SDD1_PEM::PEM_getBit(uint8_t *ROM, uint32_t *mmc, uint8_t context) // CM -void SDD1_CM::CM_prepareDecomp(uint8_t *ROM, uint32_t *mmc, uint32_t first_byte) +void sns_rom_sdd1_device::SDD1_CM::CM_prepareDecomp(uint8_t *ROM, uint32_t *mmc, uint32_t first_byte) { int32_t i = 0; m_bitplanesInfo = ROM[SSD1_ADD(first_byte)] & 0xc0; @@ -252,7 +252,7 @@ void SDD1_CM::CM_prepareDecomp(uint8_t *ROM, uint32_t *mmc, uint32_t first_byte) } } -uint8_t SDD1_CM::CM_getBit(uint8_t *ROM, uint32_t *mmc) +uint8_t sns_rom_sdd1_device::SDD1_CM::CM_getBit(uint8_t *ROM, uint32_t *mmc) { uint8_t currContext; uint16_t *context_bits; @@ -309,14 +309,14 @@ uint8_t SDD1_CM::CM_getBit(uint8_t *ROM, uint32_t *mmc) // OL -void SDD1_OL::OL_prepareDecomp(uint8_t *ROM, uint32_t *mmc, uint32_t first_byte, uint16_t out_len, uint8_t *out_buf) +void sns_rom_sdd1_device::SDD1_OL::OL_prepareDecomp(uint8_t *ROM, uint32_t *mmc, uint32_t first_byte, uint16_t out_len, uint8_t *out_buf) { m_bitplanesInfo = ROM[SSD1_ADD(first_byte)] & 0xc0; m_length = out_len; m_buffer = out_buf; } -void SDD1_OL::OL_launch(uint8_t *ROM, uint32_t *mmc) +void sns_rom_sdd1_device::SDD1_OL::OL_launch(uint8_t *ROM, uint32_t *mmc) { uint8_t i; uint8_t register1, register2 = 0; @@ -366,7 +366,7 @@ void SDD1_OL::OL_launch(uint8_t *ROM, uint32_t *mmc) // S-DD1 -SDD1_emu::SDD1_emu(running_machine &machine) +sns_rom_sdd1_device::SDD1_emu::SDD1_emu(running_machine &machine) : m_machine(machine) { m_IM = std::make_unique<SDD1_IM>(); @@ -385,7 +385,7 @@ SDD1_emu::SDD1_emu(running_machine &machine) m_OL = std::make_unique<SDD1_OL>(m_CM.get()); } -void SDD1_emu::SDD1emu_decompress(uint8_t *ROM, uint32_t *mmc, uint32_t in_buf, uint16_t out_len, uint8_t *out_buf) +void sns_rom_sdd1_device::SDD1_emu::SDD1emu_decompress(uint8_t *ROM, uint32_t *mmc, uint32_t in_buf, uint16_t out_len, uint8_t *out_buf) { m_IM->IM_prepareDecomp(in_buf); m_BG0->BG_prepareDecomp(); @@ -408,19 +408,19 @@ void SDD1_emu::SDD1emu_decompress(uint8_t *ROM, uint32_t *mmc, uint32_t in_buf, // sns_rom_sdd1_device - constructor //------------------------------------------------- -const device_type SNS_LOROM_SDD1 = device_creator<sns_rom_sdd1_device>; +DEFINE_DEVICE_TYPE(SNS_LOROM_SDD1, sns_rom_sdd1_device, "sns_rom_sdd1", "SNES Cart + S-DD1") -sns_rom_sdd1_device::sns_rom_sdd1_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) - : device_t(mconfig, type, name, tag, owner, clock, shortname, source), - device_sns_cart_interface( mconfig, *this ), m_sdd1_enable(0), m_xfer_enable(0), m_sdd1emu(nullptr) - { +sns_rom_sdd1_device::sns_rom_sdd1_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, type, tag, owner, clock) + , device_sns_cart_interface(mconfig, *this) + , m_sdd1_enable(0), m_xfer_enable(0), m_sdd1emu(nullptr) +{ } sns_rom_sdd1_device::sns_rom_sdd1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : device_t(mconfig, SNS_LOROM_SDD1, "SNES Cart + S-DD1", tag, owner, clock, "sns_rom_sdd1", __FILE__), - device_sns_cart_interface( mconfig, *this ), m_sdd1_enable(0), m_xfer_enable(0), m_sdd1emu(nullptr) - { + : sns_rom_sdd1_device(mconfig, SNS_LOROM_SDD1, tag, owner, clock) +{ } |