trunk/src/emu/bus/a2bus/timemasterho.c
| r0 | r31675 | |
| 1 | /********************************************************************* |
| 2 | |
| 3 | timemasterho.c |
| 4 | |
| 5 | Implemention of the Applied Engineering TimeMaster H.O. |
| 6 | |
| 7 | |
| 8 | PCB Layout: |
| 9 | _____________________________________________________ |
| 10 | | ___ _ _____________________ | |
| 11 | | | D | | |MSM5832 | |u3 | |
| 12 | | | I | u1| | | HD46821P | ___ | |
| 13 | | | P | |_| |_____________________|| B | | |
| 14 | | |_S_| _____ | A | | |
| 15 | | u2|_____| 74LS245| T | | |
| 16 | | |J1 74LS00 74LS08 ____________ | T | | |
| 17 | | | _ _ u4| | | E | | |
| 18 | | | u5| | u6| | | 2716 | | R | | |
| 19 | | | |_| |_| |____________| |_Y_| | |
| 20 | |____________________________ _| |
| 21 | | | |
| 22 | |______________________| |
| 23 | |
| 24 | |
| 25 | DIPS: 1:SET 2:MODE 3:NMI 4:IRQ |
| 26 | 1 & 4 are on by default. |
| 27 | |
| 28 | J1: 8 pins for X10 home control functions (top to bottom) |
| 29 | 1: ADJ 2: 5V 3: MODE 4: GND |
| 30 | 5: A 6: 5V 7: B 8: GND |
| 31 | |
| 32 | X10 functions not supported. |
| 33 | |
| 34 | *********************************************************************/ |
| 35 | |
| 36 | #include "timemasterho.h" |
| 37 | |
| 38 | /*************************************************************************** |
| 39 | PARAMETERS |
| 40 | ***************************************************************************/ |
| 41 | |
| 42 | //************************************************************************** |
| 43 | // GLOBAL VARIABLES |
| 44 | //************************************************************************** |
| 45 | |
| 46 | const device_type A2BUS_TIMEMASTERHO = &device_creator<a2bus_timemasterho_device>; |
| 47 | |
| 48 | #define TIMEMASTER_ROM_REGION "timemst_rom" |
| 49 | #define TIMEMASTER_PIA_TAG "timemst_pia" |
| 50 | #define TIMEMASTER_M5832_TAG "timemst_msm" |
| 51 | |
| 52 | MACHINE_CONFIG_FRAGMENT( timemaster ) |
| 53 | MCFG_DEVICE_ADD(TIMEMASTER_PIA_TAG, PIA6821, 1021800) |
| 54 | MCFG_PIA_WRITEPA_HANDLER(WRITE8(a2bus_timemasterho_device, pia_out_a)) |
| 55 | MCFG_PIA_WRITEPB_HANDLER(WRITE8(a2bus_timemasterho_device, pia_out_b)) |
| 56 | MCFG_PIA_IRQA_HANDLER(WRITELINE(a2bus_timemasterho_device, pia_irqa_w)) |
| 57 | MCFG_PIA_IRQB_HANDLER(WRITELINE(a2bus_timemasterho_device, pia_irqb_w)) |
| 58 | |
| 59 | MCFG_DEVICE_ADD(TIMEMASTER_M5832_TAG, MSM5832, 32768) |
| 60 | MACHINE_CONFIG_END |
| 61 | |
| 62 | ROM_START( timemaster ) |
| 63 | ROM_REGION(0x1000, TIMEMASTER_ROM_REGION, 0) |
| 64 | ROM_LOAD( "ae timemaster ii h.o. rom rev. 5.bin", 0x000000, 0x001000, CRC(ff5bd644) SHA1(ae0173da61581a06188c1bee89e95a0aa536c411) ) |
| 65 | ROM_END |
| 66 | |
| 67 | static INPUT_PORTS_START( tmho ) |
| 68 | PORT_START("DSW1") |
| 69 | PORT_DIPNAME( 0x01, 0x01, "Set") |
| 70 | PORT_DIPSETTING( 0x00, "Apple can't set clock") |
| 71 | PORT_DIPSETTING( 0x01, "Apple can set clock") |
| 72 | |
| 73 | PORT_DIPNAME( 0x02, 0x00, "Mode") |
| 74 | PORT_DIPSETTING( 0x00, "TimeMaster") |
| 75 | PORT_DIPSETTING( 0x02, "Mountain AppleClock") |
| 76 | |
| 77 | PORT_DIPNAME( 0x04, 0x00, "NMI") |
| 78 | PORT_DIPSETTING( 0x00, DEF_STR(Off)) |
| 79 | PORT_DIPSETTING( 0x04, DEF_STR(On)) |
| 80 | |
| 81 | PORT_DIPNAME( 0x08, 0x08, "IRQ") |
| 82 | PORT_DIPSETTING( 0x00, DEF_STR(Off)) |
| 83 | PORT_DIPSETTING( 0x08, DEF_STR(On)) |
| 84 | INPUT_PORTS_END |
| 85 | |
| 86 | /*************************************************************************** |
| 87 | FUNCTION PROTOTYPES |
| 88 | ***************************************************************************/ |
| 89 | |
| 90 | //------------------------------------------------- |
| 91 | // input_ports - device-specific input ports |
| 92 | //------------------------------------------------- |
| 93 | |
| 94 | ioport_constructor a2bus_timemasterho_device::device_input_ports() const |
| 95 | { |
| 96 | return INPUT_PORTS_NAME( tmho ); |
| 97 | } |
| 98 | |
| 99 | //------------------------------------------------- |
| 100 | // machine_config_additions - device-specific |
| 101 | // machine configurations |
| 102 | //------------------------------------------------- |
| 103 | |
| 104 | machine_config_constructor a2bus_timemasterho_device::device_mconfig_additions() const |
| 105 | { |
| 106 | return MACHINE_CONFIG_NAME( timemaster ); |
| 107 | } |
| 108 | |
| 109 | //------------------------------------------------- |
| 110 | // rom_region - device-specific ROM region |
| 111 | //------------------------------------------------- |
| 112 | |
| 113 | const rom_entry *a2bus_timemasterho_device::device_rom_region() const |
| 114 | { |
| 115 | return ROM_NAME( timemaster ); |
| 116 | } |
| 117 | |
| 118 | //************************************************************************** |
| 119 | // LIVE DEVICE |
| 120 | //************************************************************************** |
| 121 | |
| 122 | a2bus_timemasterho_device::a2bus_timemasterho_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) : |
| 123 | device_t(mconfig, type, name, tag, owner, clock, shortname, source), |
| 124 | device_a2bus_card_interface(mconfig, *this), |
| 125 | m_pia(*this, TIMEMASTER_PIA_TAG), |
| 126 | m_msm5832(*this, TIMEMASTER_M5832_TAG), |
| 127 | m_dsw1(*this, "DSW1") |
| 128 | { |
| 129 | m_started = false; |
| 130 | } |
| 131 | |
| 132 | a2bus_timemasterho_device::a2bus_timemasterho_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : |
| 133 | device_t(mconfig, A2BUS_TIMEMASTERHO, "Applied Engineering TimeMaster H.O.", tag, owner, clock, "a2tmstho", __FILE__), |
| 134 | device_a2bus_card_interface(mconfig, *this), |
| 135 | m_pia(*this, TIMEMASTER_PIA_TAG), |
| 136 | m_msm5832(*this, TIMEMASTER_M5832_TAG), |
| 137 | m_dsw1(*this, "DSW1") |
| 138 | { |
| 139 | m_started = false; |
| 140 | } |
| 141 | |
| 142 | //------------------------------------------------- |
| 143 | // device_start - device-specific startup |
| 144 | //------------------------------------------------- |
| 145 | |
| 146 | void a2bus_timemasterho_device::device_start() |
| 147 | { |
| 148 | // set_a2bus_device makes m_slot valid |
| 149 | set_a2bus_device(); |
| 150 | |
| 151 | astring tempstring; |
| 152 | m_rom = device().machine().root_device().memregion(this->subtag(tempstring, TIMEMASTER_ROM_REGION))->base(); |
| 153 | } |
| 154 | |
| 155 | void a2bus_timemasterho_device::device_reset() |
| 156 | { |
| 157 | m_msm5832->cs_w(ASSERT_LINE); // CS is tied to Vcc |
| 158 | m_started = true; |
| 159 | } |
| 160 | |
| 161 | |
| 162 | /*------------------------------------------------- |
| 163 | read_c0nx - called for reads from this card's c0nx space |
| 164 | -------------------------------------------------*/ |
| 165 | |
| 166 | UINT8 a2bus_timemasterho_device::read_c0nx(address_space &space, UINT8 offset) |
| 167 | { |
| 168 | if (offset <= 3) |
| 169 | { |
| 170 | return m_pia->read(space, offset); |
| 171 | } |
| 172 | |
| 173 | return 0xff; |
| 174 | } |
| 175 | |
| 176 | |
| 177 | /*------------------------------------------------- |
| 178 | write_c0nx - called for writes to this card's c0nx space |
| 179 | -------------------------------------------------*/ |
| 180 | |
| 181 | void a2bus_timemasterho_device::write_c0nx(address_space &space, UINT8 offset, UINT8 data) |
| 182 | { |
| 183 | if (offset <= 3) |
| 184 | { |
| 185 | m_pia->write(space, offset, data); |
| 186 | } |
| 187 | } |
| 188 | |
| 189 | /*------------------------------------------------- |
| 190 | read_cnxx - called for reads from this card's cnxx space |
| 191 | -------------------------------------------------*/ |
| 192 | |
| 193 | UINT8 a2bus_timemasterho_device::read_cnxx(address_space &space, UINT8 offset) |
| 194 | { |
| 195 | if (m_started) |
| 196 | { |
| 197 | if (m_dsw1->read() & 2) // TimeMaster native |
| 198 | { |
| 199 | return m_rom[offset+0xc00]; |
| 200 | } |
| 201 | } |
| 202 | |
| 203 | // Mountain Computer compatible |
| 204 | return m_rom[offset+0x800]; |
| 205 | } |
| 206 | |
| 207 | /*------------------------------------------------- |
| 208 | read_c800 - called for reads from this card's c800 space |
| 209 | -------------------------------------------------*/ |
| 210 | |
| 211 | UINT8 a2bus_timemasterho_device::read_c800(address_space &space, UINT16 offset) |
| 212 | { |
| 213 | return m_rom[offset+0xc00]; |
| 214 | } |
| 215 | |
| 216 | WRITE8_MEMBER(a2bus_timemasterho_device::pia_out_a) |
| 217 | { |
| 218 | // port A appears to be input only |
| 219 | } |
| 220 | |
| 221 | WRITE8_MEMBER(a2bus_timemasterho_device::pia_out_b) |
| 222 | { |
| 223 | m_msm5832->address_w(data & 0xf); |
| 224 | m_msm5832->hold_w((data>>4) & 1 ? ASSERT_LINE : CLEAR_LINE); |
| 225 | m_msm5832->read_w((data>>5) & 1 ? ASSERT_LINE : CLEAR_LINE); |
| 226 | |
| 227 | if (m_started) |
| 228 | { |
| 229 | if (!(m_dsw1->read() & 1)) |
| 230 | { |
| 231 | m_msm5832->write_w((data >> 6) & 1 ? ASSERT_LINE : CLEAR_LINE); |
| 232 | } |
| 233 | } |
| 234 | |
| 235 | // if it's a read, poke it into the PIA |
| 236 | if ((data>>5) & 1) |
| 237 | { |
| 238 | m_pia->porta_w(m_msm5832->data_r(space, 0)); |
| 239 | } |
| 240 | } |
| 241 | |
| 242 | void a2bus_timemasterho_device::update_irqs() |
| 243 | { |
| 244 | UINT8 dip = 0; |
| 245 | |
| 246 | if (m_started) |
| 247 | { |
| 248 | dip = m_dsw1->read(); |
| 249 | } |
| 250 | |
| 251 | if ((m_irqa | m_irqb) == ASSERT_LINE) |
| 252 | { |
| 253 | if (dip & 4) |
| 254 | { |
| 255 | raise_slot_nmi(); |
| 256 | } |
| 257 | if (dip & 8) |
| 258 | { |
| 259 | raise_slot_irq(); |
| 260 | } |
| 261 | } |
| 262 | else |
| 263 | { |
| 264 | lower_slot_irq(); |
| 265 | lower_slot_nmi(); |
| 266 | } |
| 267 | } |
| 268 | |
| 269 | WRITE_LINE_MEMBER(a2bus_timemasterho_device::pia_irqa_w) |
| 270 | { |
| 271 | m_irqa = state; |
| 272 | update_irqs(); |
| 273 | } |
| 274 | |
| 275 | WRITE_LINE_MEMBER(a2bus_timemasterho_device::pia_irqb_w) |
| 276 | { |
| 277 | m_irqb = state; |
| 278 | update_irqs(); |
| 279 | } |
| 280 | |
trunk/src/emu/bus/a2bus/timemasterho.h
| r0 | r31675 | |
| 1 | /********************************************************************* |
| 2 | |
| 3 | timemasterho.h |
| 4 | |
| 5 | Implemention of the Applied Engineering TimeMaster H.O. |
| 6 | |
| 7 | *********************************************************************/ |
| 8 | |
| 9 | #ifndef __A2BUS_TIMEMASTERHO__ |
| 10 | #define __A2BUS_TIMEMASTERHO__ |
| 11 | |
| 12 | #include "emu.h" |
| 13 | #include "a2bus.h" |
| 14 | #include "machine/6821pia.h" |
| 15 | #include "machine/msm5832.h" |
| 16 | |
| 17 | //************************************************************************** |
| 18 | // TYPE DEFINITIONS |
| 19 | //************************************************************************** |
| 20 | |
| 21 | class a2bus_timemasterho_device: |
| 22 | public device_t, |
| 23 | public device_a2bus_card_interface |
| 24 | { |
| 25 | public: |
| 26 | // construction/destruction |
| 27 | a2bus_timemasterho_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); |
| 28 | a2bus_timemasterho_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 29 | |
| 30 | // optional information overrides |
| 31 | virtual machine_config_constructor device_mconfig_additions() const; |
| 32 | virtual const rom_entry *device_rom_region() const; |
| 33 | virtual ioport_constructor device_input_ports() const; |
| 34 | |
| 35 | DECLARE_WRITE8_MEMBER(pia_out_a); |
| 36 | DECLARE_WRITE8_MEMBER(pia_out_b); |
| 37 | DECLARE_WRITE_LINE_MEMBER(pia_irqa_w); |
| 38 | DECLARE_WRITE_LINE_MEMBER(pia_irqb_w); |
| 39 | |
| 40 | protected: |
| 41 | virtual void device_start(); |
| 42 | virtual void device_reset(); |
| 43 | |
| 44 | // overrides of standard a2bus slot functions |
| 45 | virtual UINT8 read_c0nx(address_space &space, UINT8 offset); |
| 46 | virtual void write_c0nx(address_space &space, UINT8 offset, UINT8 data); |
| 47 | virtual UINT8 read_cnxx(address_space &space, UINT8 offset); |
| 48 | virtual UINT8 read_c800(address_space &space, UINT16 offset); |
| 49 | |
| 50 | required_device<pia6821_device> m_pia; |
| 51 | required_device<msm5832_device> m_msm5832; |
| 52 | required_ioport m_dsw1; |
| 53 | |
| 54 | private: |
| 55 | void update_irqs(); |
| 56 | |
| 57 | UINT8 *m_rom; |
| 58 | bool m_irqa, m_irqb; |
| 59 | bool m_started; |
| 60 | }; |
| 61 | |
| 62 | // device type definition |
| 63 | extern const device_type A2BUS_TIMEMASTERHO; |
| 64 | |
| 65 | #endif /* __A2BUS_TIMEMASTERHO__ */ |