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/video/ef9365.h | |
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/video/ef9365.h')
-rw-r--r-- | src/devices/video/ef9365.h | 67 |
1 files changed, 25 insertions, 42 deletions
diff --git a/src/devices/video/ef9365.h b/src/devices/video/ef9365.h index 4352076528f..3f5beda3dde 100644 --- a/src/devices/video/ef9365.h +++ b/src/devices/video/ef9365.h @@ -8,25 +8,22 @@ *********************************************************************/ -#pragma once - -#ifndef __EF9365_H__ -#define __EF9365_H__ +#ifndef MAME_VIDEO_EF9365_H +#define MAME_VIDEO_EF9365_H -#define EF936X_BITPLANE_MAX_SIZE 0x8000 -#define EF936X_MAX_BITPLANES 8 +#pragma once -#define MCFG_EF936X_PALETTE(_palette_tag) \ - ef9365_device::static_set_palette_tag(*device, "^" _palette_tag); +#define MCFG_EF936X_PALETTE(palette_tag) \ + ef9365_device::static_set_palette_tag(*device, ("^" palette_tag)); -#define MCFG_EF936X_BITPLANES_CNT(_bitplanes_number) \ - ef9365_device::static_set_nb_bitplanes(*device,_bitplanes_number); +#define MCFG_EF936X_BITPLANES_CNT(bitplanes_number) \ + ef9365_device::static_set_nb_bitplanes(*device, (bitplanes_number)); -#define MCFG_EF936X_DISPLAYMODE(_display_mode) \ - ef9365_device::static_set_display_mode(*device,_display_mode); +#define MCFG_EF936X_DISPLAYMODE(display_mode) \ + ef9365_device::static_set_display_mode(*device, (ef9365_device::display_mode)); -#define MCFG_EF936X_IRQ_HANDLER(_devcb) \ - devcb = &ef9365_device::set_irq_handler(*device, DEVCB_##_devcb); +#define MCFG_EF936X_IRQ_HANDLER(cb) \ + devcb = &ef9365_device::set_irq_handler(*device, (DEVCB_##cb)); //************************************************************************** // TYPE DEFINITIONS @@ -39,6 +36,15 @@ class ef9365_device : public device_t, public device_video_interface { public: + static constexpr unsigned BITPLANE_MAX_SIZE = 0x8000; + static constexpr unsigned MAX_BITPLANES = 8; + + static constexpr int DISPLAY_MODE_256x256 = 0x00; + static constexpr int DISPLAY_MODE_512x512 = 0x01; + static constexpr int DISPLAY_MODE_512x256 = 0x02; + static constexpr int DISPLAY_MODE_128x128 = 0x03; + static constexpr int DISPLAY_MODE_64x64 = 0x04; + // construction/destruction ef9365_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); @@ -73,8 +79,6 @@ protected: // address space configurations const address_space_config m_space_config; - // inline helper - private: int get_char_pix( unsigned char c, int x, int y ); void plot(int x_pos,int y_pos); @@ -94,7 +98,7 @@ private: void update_interrupts(); // internal state - static const device_timer_id BUSY_TIMER = 0; + static constexpr device_timer_id BUSY_TIMER = 0; required_region_ptr<uint8_t> m_charset; address_space *m_videoram; @@ -118,7 +122,7 @@ private: uint16_t overflow_mask_y; int vsync_scanline_pos; - uint8_t m_readback_latch[EF936X_MAX_BITPLANES]; // Last DRAM Readback buffer (Filled after a Direct Memory Access Request command) + uint8_t m_readback_latch[MAX_BITPLANES]; // Last DRAM Readback buffer (Filled after a Direct Memory Access Request command) int m_readback_latch_pix_offset; uint32_t clock_freq; @@ -132,27 +136,6 @@ private: }; // device type definition -extern const device_type EF9365; - -#define EF936X_REG_STATUS 0x00 -#define EF936X_REG_CMD 0x00 -#define EF936X_REG_CTRL1 0x01 -#define EF936X_REG_CTRL2 0x02 -#define EF936X_REG_CSIZE 0x03 -#define EF936X_REG_DELTAX 0x05 -#define EF936X_REG_DELTAY 0x07 -#define EF936X_REG_X_MSB 0x08 -#define EF936X_REG_X_LSB 0x09 -#define EF936X_REG_Y_MSB 0x0A -#define EF936X_REG_Y_LSB 0x0B -#define EF936X_REG_XLP 0x0C -#define EF936X_REG_YLP 0x0D - -#define EF936X_256x256_DISPLAY_MODE 0x00 -#define EF936X_512x512_DISPLAY_MODE 0x01 -#define EF936X_512x256_DISPLAY_MODE 0x02 -#define EF936X_128x128_DISPLAY_MODE 0x03 -#define EF936X_64x64_DISPLAY_MODE 0x04 - - -#endif +DECLARE_DEVICE_TYPE(EF9365, ef9365_device) + +#endif // MAME_VIDEO_EF9365_H |