src/mess/machine/a2thunderclock.c
| r0 | r14892 | |
| 1 | /********************************************************************* |
| 2 | |
| 3 | a2thunderclock.c |
| 4 | |
| 5 | Implemention of the Thunderware Thunderclock Plus. |
| 6 | |
| 7 | *********************************************************************/ |
| 8 | |
| 9 | #include "a2thunderclock.h" |
| 10 | |
| 11 | /*************************************************************************** |
| 12 | PARAMETERS |
| 13 | ***************************************************************************/ |
| 14 | |
| 15 | //************************************************************************** |
| 16 | // GLOBAL VARIABLES |
| 17 | //************************************************************************** |
| 18 | |
| 19 | const device_type A2BUS_THUNDERCLOCK = &device_creator<a2bus_thunderclock_device>; |
| 20 | |
| 21 | #define THUNDERCLOCK_ROM_REGION "thunclk_rom" |
| 22 | #define THUNDERCLOCK_UPD1990_TAG "thunclk_upd" |
| 23 | |
| 24 | static UPD1990A_INTERFACE( thunderclock_upd1990a_intf ) |
| 25 | { |
| 26 | DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, a2bus_thunderclock_device, upd_dataout_w), |
| 27 | DEVCB_NULL // TP out not used? for Thunderclock |
| 28 | }; |
| 29 | |
| 30 | MACHINE_CONFIG_FRAGMENT( thunderclock ) |
| 31 | MCFG_UPD1990A_ADD(THUNDERCLOCK_UPD1990_TAG, 1021800, thunderclock_upd1990a_intf) |
| 32 | MACHINE_CONFIG_END |
| 33 | |
| 34 | ROM_START( thunderclock ) |
| 35 | ROM_REGION(0x800, THUNDERCLOCK_ROM_REGION, 0) |
| 36 | ROM_LOAD( "thunderclock plus rom.bin", 0x0000, 0x0800, CRC(1b99c4e3) SHA1(60f434f5325899d7ea257a6e56e6f53eae65146a) ) |
| 37 | ROM_END |
| 38 | |
| 39 | /*************************************************************************** |
| 40 | FUNCTION PROTOTYPES |
| 41 | ***************************************************************************/ |
| 42 | |
| 43 | //------------------------------------------------- |
| 44 | // machine_config_additions - device-specific |
| 45 | // machine configurations |
| 46 | //------------------------------------------------- |
| 47 | |
| 48 | machine_config_constructor a2bus_thunderclock_device::device_mconfig_additions() const |
| 49 | { |
| 50 | return MACHINE_CONFIG_NAME( thunderclock ); |
| 51 | } |
| 52 | |
| 53 | //------------------------------------------------- |
| 54 | // rom_region - device-specific ROM region |
| 55 | //------------------------------------------------- |
| 56 | |
| 57 | const rom_entry *a2bus_thunderclock_device::device_rom_region() const |
| 58 | { |
| 59 | return ROM_NAME( thunderclock ); |
| 60 | } |
| 61 | |
| 62 | //************************************************************************** |
| 63 | // LIVE DEVICE |
| 64 | //************************************************************************** |
| 65 | |
| 66 | a2bus_thunderclock_device::a2bus_thunderclock_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) : |
| 67 | device_t(mconfig, type, name, tag, owner, clock), |
| 68 | device_a2bus_card_interface(mconfig, *this), |
| 69 | m_upd1990ac(*this, THUNDERCLOCK_UPD1990_TAG) |
| 70 | { |
| 71 | m_shortname = "a2thunpl"; |
| 72 | } |
| 73 | |
| 74 | a2bus_thunderclock_device::a2bus_thunderclock_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : |
| 75 | device_t(mconfig, A2BUS_THUNDERCLOCK, "ThunderWare ThunderClock Plus", tag, owner, clock), |
| 76 | device_a2bus_card_interface(mconfig, *this), |
| 77 | m_upd1990ac(*this, THUNDERCLOCK_UPD1990_TAG) |
| 78 | { |
| 79 | m_shortname = "a2thunpl"; |
| 80 | } |
| 81 | |
| 82 | //------------------------------------------------- |
| 83 | // device_start - device-specific startup |
| 84 | //------------------------------------------------- |
| 85 | |
| 86 | void a2bus_thunderclock_device::device_start() |
| 87 | { |
| 88 | // set_a2bus_device makes m_slot valid |
| 89 | set_a2bus_device(); |
| 90 | |
| 91 | astring tempstring; |
| 92 | m_rom = device().machine().region(this->subtag(tempstring, THUNDERCLOCK_ROM_REGION))->base(); |
| 93 | } |
| 94 | |
| 95 | void a2bus_thunderclock_device::device_reset() |
| 96 | { |
| 97 | m_dataout = 0; |
| 98 | } |
| 99 | |
| 100 | |
| 101 | /*------------------------------------------------- |
| 102 | read_c0nx - called for reads from this card's c0nx space |
| 103 | -------------------------------------------------*/ |
| 104 | |
| 105 | UINT8 a2bus_thunderclock_device::read_c0nx(address_space &space, UINT8 offset) |
| 106 | { |
| 107 | if (m_dataout == 0) |
| 108 | { |
| 109 | return 0; |
| 110 | } |
| 111 | |
| 112 | return 0xff; |
| 113 | } |
| 114 | |
| 115 | |
| 116 | /*------------------------------------------------- |
| 117 | write_c0nx - called for writes to this card's c0nx space |
| 118 | -------------------------------------------------*/ |
| 119 | |
| 120 | void a2bus_thunderclock_device::write_c0nx(address_space &space, UINT8 offset, UINT8 data) |
| 121 | { |
| 122 | // uPD1990AC hookup: |
| 123 | // bit 0 = DATA IN? |
| 124 | // bit 1 = CLK |
| 125 | // bit 2 = STB |
| 126 | // bit 3 = C0 |
| 127 | // bit 4 = C1 |
| 128 | // bit 5 = C2 |
| 129 | // bit 7 = data out |
| 130 | if (offset == 0) |
| 131 | { |
| 132 | m_upd1990ac->cs_w(1); |
| 133 | m_upd1990ac->oe_w(1); |
| 134 | m_upd1990ac->data_in_w(data&0x01); |
| 135 | m_upd1990ac->c0_w((data&0x08) >> 3); |
| 136 | m_upd1990ac->c1_w((data&0x10) >> 4); |
| 137 | m_upd1990ac->c2_w((data&0x20) >> 5); |
| 138 | m_upd1990ac->stb_w((data&0x04) >> 2); |
| 139 | m_upd1990ac->clk_w((data&0x02) >> 1); |
| 140 | } |
| 141 | } |
| 142 | |
| 143 | /*------------------------------------------------- |
| 144 | read_cnxx - called for reads from this card's cnxx space |
| 145 | -------------------------------------------------*/ |
| 146 | |
| 147 | UINT8 a2bus_thunderclock_device::read_cnxx(address_space &space, UINT8 offset) |
| 148 | { |
| 149 | // ROM is primarily a c800 image, but the first page is also the CnXX ROM |
| 150 | return m_rom[offset]; |
| 151 | } |
| 152 | |
| 153 | /*------------------------------------------------- |
| 154 | read_c800 - called for reads from this card's c800 space |
| 155 | -------------------------------------------------*/ |
| 156 | |
| 157 | UINT8 a2bus_thunderclock_device::read_c800(address_space &space, UINT16 offset) |
| 158 | { |
| 159 | return m_rom[offset]; |
| 160 | } |
| 161 | |
| 162 | WRITE_LINE_MEMBER( a2bus_thunderclock_device::upd_dataout_w ) |
| 163 | { |
| 164 | if (state) |
| 165 | { |
| 166 | m_dataout = 1; |
| 167 | } |
| 168 | else |
| 169 | { |
| 170 | m_dataout = 0; |
| 171 | } |
| 172 | } |
src/mess/machine/a2thunderclock.h
| r0 | r14892 | |
| 1 | /********************************************************************* |
| 2 | |
| 3 | a2thunderclock.h |
| 4 | |
| 5 | Implemention of the Thunderware Thunderclock Plus. |
| 6 | |
| 7 | *********************************************************************/ |
| 8 | |
| 9 | #ifndef __A2BUS_THUNDERCLOCK__ |
| 10 | #define __A2BUS_THUNDERCLOCK__ |
| 11 | |
| 12 | #include "emu.h" |
| 13 | #include "machine/a2bus.h" |
| 14 | #include "machine/upd1990a.h" |
| 15 | |
| 16 | //************************************************************************** |
| 17 | // TYPE DEFINITIONS |
| 18 | //************************************************************************** |
| 19 | |
| 20 | class a2bus_thunderclock_device: |
| 21 | public device_t, |
| 22 | public device_a2bus_card_interface |
| 23 | { |
| 24 | public: |
| 25 | // construction/destruction |
| 26 | a2bus_thunderclock_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock); |
| 27 | a2bus_thunderclock_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 28 | |
| 29 | // optional information overrides |
| 30 | virtual machine_config_constructor device_mconfig_additions() const; |
| 31 | virtual const rom_entry *device_rom_region() const; |
| 32 | |
| 33 | DECLARE_WRITE_LINE_MEMBER( upd_dataout_w ); |
| 34 | |
| 35 | protected: |
| 36 | virtual void device_start(); |
| 37 | virtual void device_reset(); |
| 38 | |
| 39 | // overrides of standard a2bus slot functions |
| 40 | virtual UINT8 read_c0nx(address_space &space, UINT8 offset); |
| 41 | virtual void write_c0nx(address_space &space, UINT8 offset, UINT8 data); |
| 42 | virtual UINT8 read_cnxx(address_space &space, UINT8 offset); |
| 43 | virtual UINT8 read_c800(address_space &space, UINT16 offset); |
| 44 | |
| 45 | required_device<upd1990a_device> m_upd1990ac; |
| 46 | |
| 47 | private: |
| 48 | UINT8 *m_rom; |
| 49 | int m_dataout; |
| 50 | }; |
| 51 | |
| 52 | // device type definition |
| 53 | extern const device_type A2BUS_THUNDERCLOCK; |
| 54 | |
| 55 | #endif /* __A2BUS_THUNDERCLOCK__ */ |
| 56 | |