diff options
author | Miodrag Milanovic <mmicko@gmail.com> | 2012-08-21 10:41:19 +0000 |
---|---|---|
committer | Miodrag Milanovic <mmicko@gmail.com> | 2012-08-21 10:41:19 +0000 |
commit | 7285b359d259b2ae0fdf85096571c386ec8c991a (patch) | |
tree | a027aff57f1a255f9ec6cfd3b68cabe4b6683998 /src/mess/machine/ti99/datamux.h | |
parent | 67c425e90757876a6716b7867df30c0149912e74 (diff) |
Merge of MESS sources (no whatsnew)
Diffstat (limited to 'src/mess/machine/ti99/datamux.h')
-rw-r--r-- | src/mess/machine/ti99/datamux.h | 115 |
1 files changed, 115 insertions, 0 deletions
diff --git a/src/mess/machine/ti99/datamux.h b/src/mess/machine/ti99/datamux.h new file mode 100644 index 00000000000..9f5dd7711f6 --- /dev/null +++ b/src/mess/machine/ti99/datamux.h @@ -0,0 +1,115 @@ +/**************************************************************************** + + TI-99/4(A) databus multiplexer circuit + See datamux.c for documentation + + Michael Zapf + + February 2012: Rewritten as class + +*****************************************************************************/ + +#ifndef __DMUX__ +#define __DMUX__ + +#include "ti99defs.h" + +extern const device_type DATAMUX; + +/* + Device that is attached to this datamux. + The configuration setting is used for certain configurations + where devices may only be used if others are turned off. In particular, + if the HGSPL expansion card is used, the GROMs in the console must be + removed. +*/ +typedef struct _dmux_device_list_entry +{ + const char *name; // Name of the device (used for looking up the device) + UINT16 select; // State of the address line bits when addressing this device + UINT16 address_mask; // Bits of the address bus used to address this device + UINT16 write_select; // Bits set when doing write accesses to this device (ffff = write-only) + const char *setting; // configuration switch that may have an effect for the presence of this device + UINT8 set; // bits that must be set for this switch so that this device is present + UINT8 unset; // bits that must be reset for this switch so that this device is present +} dmux_device_list_entry; + +#define DMUX_CONFIG(name) \ + const datamux_config(name) = + +typedef struct _datamux_config +{ + devcb_write_line ready; + const dmux_device_list_entry *devlist; +} datamux_config; + +/* + Device list of this datamux. +*/ +class attached_device +{ + friend class simple_list<attached_device>; + friend class ti99_datamux_device; + +public: + attached_device(device_t *busdevice, const dmux_device_list_entry &entry) + : m_device(busdevice), m_config(&entry) { }; + +private: + attached_device *m_next; + device_t *m_device; // the actual device + const dmux_device_list_entry *m_config; +}; + +/* + Main class +*/ +class ti99_datamux_device : public device_t +{ +public: + ti99_datamux_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + DECLARE_READ16_MEMBER( read ); + DECLARE_WRITE16_MEMBER( write ); + + void clock_in(int state); + +protected: + /* Constructor */ + virtual void device_start(void); + virtual void device_stop(void); + virtual void device_reset(void); + ioport_constructor device_input_ports() const; + +private: + // Ready line to the CPU + devcb_resolved_write_line m_ready; + + /* All devices that are attached to the 8-bit bus. */ + simple_list<attached_device> m_devices; + + /* Latch which stores the first (odd) byte */ + UINT8 m_latch; + + /* Counter for the wait states. */ + int m_waitcount; + + /* Memory expansion (internal, 16 bit). */ + UINT16 *m_ram16b; + + /* Use the memory expansion? */ + bool m_use32k; + + /* Reference to the CPU; avoid lookups. */ + device_t *m_cpu; + + /* Reference to the address space, maybe unnecessary. */ + address_space *m_space; +}; + +/******************************************************************************/ + +#define MCFG_DMUX_ADD(_tag, _devices) \ + MCFG_DEVICE_ADD(_tag, DATAMUX, 0) \ + MCFG_DEVICE_CONFIG( _devices ) +#endif + |