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/ti99/peb/evpc.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/bus/ti99/peb/evpc.h')
-rw-r--r-- | src/devices/bus/ti99/peb/evpc.h | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/src/devices/bus/ti99/peb/evpc.h b/src/devices/bus/ti99/peb/evpc.h new file mode 100644 index 00000000000..bb53e285a28 --- /dev/null +++ b/src/devices/bus/ti99/peb/evpc.h @@ -0,0 +1,89 @@ +// license:LGPL-2.1+ +// copyright-holders:Michael Zapf +/**************************************************************************** + + SNUG Enhanced Video Processor Card (evpc) + See evpc.c for documentation. + + Michael Zapf + + October 2010: Rewritten as device + February 2012: Rewritten as class + +*****************************************************************************/ + +#ifndef MAME_BUS_TI99_PEB_EVPC_H +#define MAME_BUS_TI99_PEB_EVPC_H + +#pragma once + +#include "peribox.h" +#include "video/v9938.h" +#include "sound/sn76496.h" +#include "bus/ti99x/ti99defs.h" +#include "bus/ti99/colorbus/colorbus.h" + +DECLARE_DEVICE_TYPE(TI99_EVPC, snug_enhanced_video_device) + +class snug_enhanced_video_device : public ti_expansion_card_device, public device_nvram_interface +{ +public: + snug_enhanced_video_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + DECLARE_READ8Z_MEMBER(readz) override; + DECLARE_WRITE8_MEMBER(write) override; + DECLARE_SETADDRESS_DBIN_MEMBER(setaddress_dbin) override; + + DECLARE_WRITE_LINE_MEMBER( ready_line ); + + DECLARE_READ8Z_MEMBER(crureadz) override; + DECLARE_WRITE8_MEMBER(cruwrite) override; + DECLARE_WRITE_LINE_MEMBER( video_interrupt_in ); + + TIMER_DEVICE_CALLBACK_MEMBER( hblank_interrupt ); + +protected: + struct evpc_palette + { + uint8_t read_index, write_index, mask; + int read; + int state; + struct { uint8_t red, green, blue; } color[0x100]; + //int dirty; + }; + + void device_start() override; + void device_reset() override; + void device_stop() override; + + virtual const tiny_rom_entry *device_rom_region() const override; + virtual ioport_constructor device_input_ports() const override; + machine_config_constructor device_mconfig_additions() const override; + + void nvram_default() override; + void nvram_read(emu_file &file) override; + void nvram_write(emu_file &file) override; + +private: + int m_address; + int m_dsr_page; + bool m_inDsrArea; + bool m_novram_accessed; + bool m_palette_accessed; + bool m_RAMEN; + bool m_sound_accessed; + bool m_video_accessed; + + int m_intlevel; + + uint8_t* m_dsrrom; + + std::unique_ptr<uint8_t[]> m_novram; // NOVRAM area + + evpc_palette m_palette; + required_device<v9938_device> m_video; + required_device<sn76496_base_device> m_sound; + required_device<ti99_colorbus_device> m_colorbus; + evpc_clock_connector* m_console_conn; +}; + +#endif // MAME_BUS_TI99_PEB_EVPC_H |