src/mess/machine/wangpc_emb.c
| r0 | r15426 | |
| 1 | /********************************************************************** |
| 2 | |
| 3 | Wang PC-PM031-B Extended Memory Board emulation |
| 4 | |
| 5 | Copyright MESS Team. |
| 6 | Visit http://mamedev.org for licensing and usage restrictions. |
| 7 | |
| 8 | **********************************************************************/ |
| 9 | |
| 10 | #include "wangpc_emb.h" |
| 11 | |
| 12 | |
| 13 | |
| 14 | //************************************************************************** |
| 15 | // MACROS/CONSTANTS |
| 16 | //************************************************************************** |
| 17 | |
| 18 | #define LOG 0 |
| 19 | |
| 20 | #define OPTION_ID 0x3f |
| 21 | |
| 22 | #define RAM_SIZE 0x40000 |
| 23 | |
| 24 | #define A19_A18_A17 ((offset >> 16) & 0x07) |
| 25 | #define BASE(bank) ((m_option >> (bank * 4)) & 0x07) |
| 26 | #define ENABLE(bank) BIT(m_option, (bank * 4) + 3) |
| 27 | #define RAM_BANK(bank) m_ram[(bank * 0x10000) | (offset & 0xffff)] |
| 28 | |
| 29 | |
| 30 | |
| 31 | //************************************************************************** |
| 32 | // DEVICE DEFINITIONS |
| 33 | //************************************************************************** |
| 34 | |
| 35 | const device_type WANGPC_EMB = &device_creator<wangpc_emb_device>; |
| 36 | |
| 37 | |
| 38 | |
| 39 | //************************************************************************** |
| 40 | // LIVE DEVICE |
| 41 | //************************************************************************** |
| 42 | |
| 43 | //------------------------------------------------- |
| 44 | // wangpc_emb_device - constructor |
| 45 | //------------------------------------------------- |
| 46 | |
| 47 | wangpc_emb_device::wangpc_emb_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : |
| 48 | device_t(mconfig, WANGPC_EMB, "Wang PC-PM031-B", tag, owner, clock), |
| 49 | device_wangpcbus_card_interface(mconfig, *this) |
| 50 | { |
| 51 | } |
| 52 | |
| 53 | |
| 54 | //------------------------------------------------- |
| 55 | // device_start - device-specific startup |
| 56 | //------------------------------------------------- |
| 57 | |
| 58 | void wangpc_emb_device::device_start() |
| 59 | { |
| 60 | // allocate memory |
| 61 | m_ram = auto_alloc_array(machine(), UINT16, RAM_SIZE); |
| 62 | |
| 63 | // state saving |
| 64 | save_pointer(NAME(m_ram), RAM_SIZE); |
| 65 | save_item(NAME(m_option)); |
| 66 | save_item(NAME(m_parity_error)); |
| 67 | save_item(NAME(m_parity_odd)); |
| 68 | } |
| 69 | |
| 70 | |
| 71 | //------------------------------------------------- |
| 72 | // device_reset - device-specific reset |
| 73 | //------------------------------------------------- |
| 74 | |
| 75 | void wangpc_emb_device::device_reset() |
| 76 | { |
| 77 | m_option = 0; |
| 78 | m_parity_error = 0; |
| 79 | m_parity_odd = 1; |
| 80 | } |
| 81 | |
| 82 | |
| 83 | //------------------------------------------------- |
| 84 | // wangpcbus_mrdc_r - memory read |
| 85 | //------------------------------------------------- |
| 86 | |
| 87 | UINT16 wangpc_emb_device::wangpcbus_mrdc_r(address_space &space, offs_t offset, UINT16 mem_mask) |
| 88 | { |
| 89 | UINT16 data = 0xffff; |
| 90 | |
| 91 | for (int bank = 0; bank < 4; bank++) |
| 92 | { |
| 93 | if (ENABLE(bank) && (A19_A18_A17 == BASE(bank))) |
| 94 | { |
| 95 | data &= RAM_BANK(bank); |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | return data; |
| 100 | } |
| 101 | |
| 102 | |
| 103 | //------------------------------------------------- |
| 104 | // wangpcbus_amwc_w - memory write |
| 105 | //------------------------------------------------- |
| 106 | |
| 107 | void wangpc_emb_device::wangpcbus_amwc_w(address_space &space, offs_t offset, UINT16 mem_mask, UINT16 data) |
| 108 | { |
| 109 | for (int bank = 0; bank < 4; bank++) |
| 110 | { |
| 111 | if (ENABLE(bank) && (A19_A18_A17 == BASE(bank))) |
| 112 | { |
| 113 | RAM_BANK(bank) = data; |
| 114 | } |
| 115 | } |
| 116 | } |
| 117 | |
| 118 | |
| 119 | //------------------------------------------------- |
| 120 | // wangpcbus_iorc_r - I/O read |
| 121 | //------------------------------------------------- |
| 122 | |
| 123 | UINT16 wangpc_emb_device::wangpcbus_iorc_r(address_space &space, offs_t offset, UINT16 mem_mask) |
| 124 | { |
| 125 | UINT16 data = 0xffff; |
| 126 | |
| 127 | if (sad(offset)) |
| 128 | { |
| 129 | switch (offset & 0x7f) |
| 130 | { |
| 131 | case 0xc0/2: |
| 132 | data = m_option; |
| 133 | break; |
| 134 | |
| 135 | case 0xfe/2: |
| 136 | data = 0xfc00 | (m_parity_odd << 9) | (m_parity_error << 8) | OPTION_ID; |
| 137 | break; |
| 138 | } |
| 139 | |
| 140 | logerror("emb read %06x:%02x\n", offset*2, data); |
| 141 | } |
| 142 | |
| 143 | return data; |
| 144 | } |
| 145 | |
| 146 | |
| 147 | //------------------------------------------------- |
| 148 | // wangpcbus_aiowc_w - I/O write |
| 149 | //------------------------------------------------- |
| 150 | |
| 151 | void wangpc_emb_device::wangpcbus_aiowc_w(address_space &space, offs_t offset, UINT16 mem_mask, UINT16 data) |
| 152 | { |
| 153 | if (sad(offset)) |
| 154 | { |
| 155 | logerror("emb write %06x:%02x\n", offset*2, data); |
| 156 | |
| 157 | switch (offset & 0x7f) |
| 158 | { |
| 159 | case 0xc0/2: |
| 160 | m_option = data; |
| 161 | break; |
| 162 | |
| 163 | case 0xce/2: |
| 164 | m_parity_error = 0; |
| 165 | break; |
| 166 | |
| 167 | case 0xfc/2: |
| 168 | device_reset(); |
| 169 | break; |
| 170 | |
| 171 | case 0xfe/2: |
| 172 | m_parity_odd = BIT(data, 9); |
| 173 | break; |
| 174 | } |
| 175 | } |
| 176 | } |
src/mess/machine/wangpc_emb.h
| r0 | r15426 | |
| 1 | /********************************************************************** |
| 2 | |
| 3 | Wang PC-PM031-B Extended Memory Board emulation |
| 4 | |
| 5 | Copyright MESS Team. |
| 6 | Visit http://mamedev.org for licensing and usage restrictions. |
| 7 | |
| 8 | **********************************************************************/ |
| 9 | |
| 10 | #pragma once |
| 11 | |
| 12 | #ifndef __WANGPC_EMB__ |
| 13 | #define __WANGPC_EMB__ |
| 14 | |
| 15 | |
| 16 | #include "emu.h" |
| 17 | #include "machine/wangpcbus.h" |
| 18 | |
| 19 | |
| 20 | |
| 21 | //************************************************************************** |
| 22 | // TYPE DEFINITIONS |
| 23 | //************************************************************************** |
| 24 | |
| 25 | // ======================> wangpc_emb_device |
| 26 | |
| 27 | class wangpc_emb_device : public device_t, |
| 28 | public device_wangpcbus_card_interface |
| 29 | { |
| 30 | public: |
| 31 | // construction/destruction |
| 32 | wangpc_emb_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 33 | |
| 34 | protected: |
| 35 | // device-level overrides |
| 36 | virtual void device_start(); |
| 37 | virtual void device_reset(); |
| 38 | virtual void device_config_complete() { m_shortname = "wangpc_emb"; } |
| 39 | |
| 40 | // device_wangpcbus_card_interface overrides |
| 41 | virtual UINT16 wangpcbus_mrdc_r(address_space &space, offs_t offset, UINT16 mem_mask); |
| 42 | virtual void wangpcbus_amwc_w(address_space &space, offs_t offset, UINT16 mem_mask, UINT16 data); |
| 43 | virtual UINT16 wangpcbus_iorc_r(address_space &space, offs_t offset, UINT16 mem_mask); |
| 44 | virtual void wangpcbus_aiowc_w(address_space &space, offs_t offset, UINT16 mem_mask, UINT16 data); |
| 45 | |
| 46 | private: |
| 47 | UINT16 *m_ram; |
| 48 | UINT16 m_option; |
| 49 | int m_parity_error; |
| 50 | int m_parity_odd; |
| 51 | }; |
| 52 | |
| 53 | |
| 54 | // device type definition |
| 55 | extern const device_type WANGPC_EMB; |
| 56 | |
| 57 | |
| 58 | #endif |
src/mess/machine/wangpc_mcc.c
| r0 | r15426 | |
| 1 | /********************************************************************** |
| 2 | |
| 3 | Wang PC-PM043 Multiport Communications Controller emulation |
| 4 | |
| 5 | Copyright MESS Team. |
| 6 | Visit http://mamedev.org for licensing and usage restrictions. |
| 7 | |
| 8 | **********************************************************************/ |
| 9 | |
| 10 | /* |
| 11 | |
| 12 | TODO: |
| 13 | |
| 14 | - all |
| 15 | |
| 16 | */ |
| 17 | |
| 18 | #include "wangpc_mcc.h" |
| 19 | |
| 20 | |
| 21 | |
| 22 | //************************************************************************** |
| 23 | // MACROS/CONSTANTS |
| 24 | //************************************************************************** |
| 25 | |
| 26 | #define LOG 0 |
| 27 | |
| 28 | #define OPTION_ID 0x1f |
| 29 | |
| 30 | #define Z80SIO2_TAG "z80sio2" |
| 31 | #define Z80DART_TAG "z80dart" |
| 32 | |
| 33 | #define FUNCTION_PORT1_EXT_CLK BIT(m_option, 0) |
| 34 | #define FUNCTION_PORT1_NRZI BIT(m_option, 1) |
| 35 | #define FUNCTION_PORT1_RI_IE BIT(m_option, 2) |
| 36 | #define FUNCTION_PORT2_EXT_CLK BIT(m_option, 3) |
| 37 | #define FUNCTION_PORT2_NRZI BIT(m_option, 4) |
| 38 | #define FUNCTION_PORT2_RI_IE BIT(m_option, 5) |
| 39 | #define FUNCTION_IRQ_MASK (m_option & 0xc0) |
| 40 | #define FUNCTION_IRQ2 0x00 |
| 41 | #define FUNCTION_IRQ3 0x40 |
| 42 | #define FUNCTION_IRQ4 0x80 |
| 43 | #define FUNCTION_IRQ_INVALID 0xc0 |
| 44 | |
| 45 | |
| 46 | |
| 47 | //************************************************************************** |
| 48 | // DEVICE DEFINITIONS |
| 49 | //************************************************************************** |
| 50 | |
| 51 | const device_type WANGPC_MCC = &device_creator<wangpc_mcc_device>; |
| 52 | |
| 53 | |
| 54 | //------------------------------------------------- |
| 55 | // Z80DART_INTERFACE( sio_intf ) |
| 56 | //------------------------------------------------- |
| 57 | |
| 58 | static Z80DART_INTERFACE( sio_intf ) |
| 59 | { |
| 60 | 0, 0, 0, 0, |
| 61 | |
| 62 | DEVCB_NULL, |
| 63 | DEVCB_NULL, |
| 64 | DEVCB_NULL, |
| 65 | DEVCB_NULL, |
| 66 | DEVCB_NULL, |
| 67 | DEVCB_NULL, |
| 68 | |
| 69 | DEVCB_NULL, |
| 70 | DEVCB_NULL, |
| 71 | DEVCB_NULL, |
| 72 | DEVCB_NULL, |
| 73 | DEVCB_NULL, |
| 74 | DEVCB_NULL, |
| 75 | |
| 76 | DEVCB_NULL |
| 77 | }; |
| 78 | |
| 79 | |
| 80 | //------------------------------------------------- |
| 81 | // Z80DART_INTERFACE( dart_intf ) |
| 82 | //------------------------------------------------- |
| 83 | |
| 84 | static Z80DART_INTERFACE( dart_intf ) |
| 85 | { |
| 86 | 0, 0, 0, 0, |
| 87 | |
| 88 | DEVCB_NULL, |
| 89 | DEVCB_NULL, |
| 90 | DEVCB_NULL, |
| 91 | DEVCB_NULL, |
| 92 | DEVCB_NULL, |
| 93 | DEVCB_NULL, |
| 94 | |
| 95 | DEVCB_NULL, |
| 96 | DEVCB_NULL, |
| 97 | DEVCB_NULL, |
| 98 | DEVCB_NULL, |
| 99 | DEVCB_NULL, |
| 100 | DEVCB_NULL, |
| 101 | |
| 102 | DEVCB_NULL |
| 103 | }; |
| 104 | |
| 105 | |
| 106 | //------------------------------------------------- |
| 107 | // MACHINE_CONFIG_FRAGMENT( wangpc_mcc ) |
| 108 | //------------------------------------------------- |
| 109 | |
| 110 | static MACHINE_CONFIG_FRAGMENT( wangpc_mcc ) |
| 111 | MCFG_Z80SIO2_ADD(Z80SIO2_TAG, 4000000, sio_intf) |
| 112 | MCFG_Z80DART_ADD(Z80DART_TAG, 4000000, dart_intf) |
| 113 | MACHINE_CONFIG_END |
| 114 | |
| 115 | |
| 116 | //------------------------------------------------- |
| 117 | // machine_config_additions - device-specific |
| 118 | // machine configurations |
| 119 | //------------------------------------------------- |
| 120 | |
| 121 | machine_config_constructor wangpc_mcc_device::device_mconfig_additions() const |
| 122 | { |
| 123 | return MACHINE_CONFIG_NAME( wangpc_mcc ); |
| 124 | } |
| 125 | |
| 126 | |
| 127 | |
| 128 | //************************************************************************** |
| 129 | // INLINE HELPERS |
| 130 | //************************************************************************** |
| 131 | |
| 132 | //------------------------------------------------- |
| 133 | // set_irq - |
| 134 | //------------------------------------------------- |
| 135 | |
| 136 | inline void wangpc_mcc_device::set_irq(int state) |
| 137 | { |
| 138 | m_irq = state; |
| 139 | |
| 140 | switch (FUNCTION_IRQ_MASK) |
| 141 | { |
| 142 | case FUNCTION_IRQ2: m_bus->irq2_w(m_irq); break; |
| 143 | case FUNCTION_IRQ3: m_bus->irq3_w(m_irq); break; |
| 144 | case FUNCTION_IRQ4: m_bus->irq4_w(m_irq); break; |
| 145 | } |
| 146 | } |
| 147 | |
| 148 | |
| 149 | |
| 150 | //************************************************************************** |
| 151 | // LIVE DEVICE |
| 152 | //************************************************************************** |
| 153 | |
| 154 | //------------------------------------------------- |
| 155 | // wangpc_mcc_device - constructor |
| 156 | //------------------------------------------------- |
| 157 | |
| 158 | wangpc_mcc_device::wangpc_mcc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : |
| 159 | device_t(mconfig, WANGPC_MCC, "Wang PC-PM043", tag, owner, clock), |
| 160 | device_wangpcbus_card_interface(mconfig, *this), |
| 161 | m_sio(*this, Z80SIO2_TAG), |
| 162 | m_dart(*this, Z80DART_TAG) |
| 163 | { |
| 164 | } |
| 165 | |
| 166 | |
| 167 | //------------------------------------------------- |
| 168 | // device_start - device-specific startup |
| 169 | //------------------------------------------------- |
| 170 | |
| 171 | void wangpc_mcc_device::device_start() |
| 172 | { |
| 173 | // state saving |
| 174 | save_item(NAME(m_option)); |
| 175 | } |
| 176 | |
| 177 | |
| 178 | //------------------------------------------------- |
| 179 | // device_reset - device-specific reset |
| 180 | //------------------------------------------------- |
| 181 | |
| 182 | void wangpc_mcc_device::device_reset() |
| 183 | { |
| 184 | m_option = 0; |
| 185 | |
| 186 | set_irq(CLEAR_LINE); |
| 187 | } |
| 188 | |
| 189 | |
| 190 | //------------------------------------------------- |
| 191 | // wangpcbus_iorc_r - I/O read |
| 192 | //------------------------------------------------- |
| 193 | |
| 194 | UINT16 wangpc_mcc_device::wangpcbus_iorc_r(address_space &space, offs_t offset, UINT16 mem_mask) |
| 195 | { |
| 196 | UINT16 data = 0xffff; |
| 197 | |
| 198 | if (sad(offset)) |
| 199 | { |
| 200 | switch (offset & 0x7f) |
| 201 | { |
| 202 | case 0x00/2: |
| 203 | case 0x02/2: |
| 204 | if (ACCESSING_BITS_0_7) |
| 205 | { |
| 206 | data = 0xff00 | m_sio->data_read(offset & 0x01); |
| 207 | } |
| 208 | break; |
| 209 | |
| 210 | case 0x04/2: |
| 211 | case 0x06/2: |
| 212 | if (ACCESSING_BITS_0_7) |
| 213 | { |
| 214 | data = 0xff00 | m_sio->control_read(offset & 0x01); |
| 215 | } |
| 216 | break; |
| 217 | |
| 218 | case 0x08/2: |
| 219 | case 0x0a/2: |
| 220 | if (ACCESSING_BITS_0_7) |
| 221 | { |
| 222 | data = 0xff00 | m_dart->data_read(offset & 0x01); |
| 223 | } |
| 224 | break; |
| 225 | |
| 226 | case 0x0c/2: |
| 227 | case 0x0e/2: |
| 228 | if (ACCESSING_BITS_0_7) |
| 229 | { |
| 230 | data = 0xff00 | m_dart->control_read(offset & 0x01); |
| 231 | } |
| 232 | break; |
| 233 | |
| 234 | case 0x10/2: |
| 235 | // board status |
| 236 | /* |
| 237 | |
| 238 | bit description |
| 239 | |
| 240 | 0 SIO channel A WAIT/RDY |
| 241 | 1 SIO channel B WAIT/RDY |
| 242 | 2 SIO channel A DSR |
| 243 | 3 SIO channel B DSR |
| 244 | 4 SIO channel A RI |
| 245 | 5 SIO channel B RI |
| 246 | 6 DART channel A WAIT/RDY |
| 247 | 7 DART channel A DSR |
| 248 | 8 DART channel B WAIT/RDY |
| 249 | 9 0 (1 for PC-PM042) |
| 250 | 10 0 (1 for PC-PM042) |
| 251 | 11 0 (1 for PC-PM042) |
| 252 | 12 1 |
| 253 | 13 1 |
| 254 | 14 1 |
| 255 | 15 1 |
| 256 | |
| 257 | */ |
| 258 | data = 0xf000; |
| 259 | break; |
| 260 | |
| 261 | case 0xfe/2: |
| 262 | data = 0xff00 | (m_irq << 7) | OPTION_ID; |
| 263 | break; |
| 264 | } |
| 265 | } |
| 266 | |
| 267 | return data; |
| 268 | } |
| 269 | |
| 270 | |
| 271 | //------------------------------------------------- |
| 272 | // wangpcbus_aiowc_w - I/O write |
| 273 | //------------------------------------------------- |
| 274 | |
| 275 | void wangpc_mcc_device::wangpcbus_aiowc_w(address_space &space, offs_t offset, UINT16 mem_mask, UINT16 data) |
| 276 | { |
| 277 | if (sad(offset) && ACCESSING_BITS_0_7) |
| 278 | { |
| 279 | switch (offset & 0x7f) |
| 280 | { |
| 281 | case 0x00/2: |
| 282 | case 0x02/2: |
| 283 | m_sio->data_write(offset & 0x01, data & 0xff); |
| 284 | break; |
| 285 | |
| 286 | case 0x04/2: |
| 287 | case 0x06/2: |
| 288 | m_sio->control_write(offset & 0x01, data & 0xff); |
| 289 | break; |
| 290 | |
| 291 | case 0x08/2: |
| 292 | case 0x0a/2: |
| 293 | m_dart->data_write(offset & 0x01, data & 0xff); |
| 294 | break; |
| 295 | |
| 296 | case 0x0c/2: |
| 297 | case 0x0e/2: |
| 298 | m_dart->control_write(offset & 0x01, data & 0xff); |
| 299 | break; |
| 300 | |
| 301 | case 0x12/2: |
| 302 | // port 1 baud rate |
| 303 | break; |
| 304 | |
| 305 | case 0x14/2: |
| 306 | // port 2 baud rate |
| 307 | break; |
| 308 | |
| 309 | case 0x16/2: |
| 310 | { |
| 311 | // ports 1 and 2 function |
| 312 | bool irq = (m_irq == ASSERT_LINE); |
| 313 | bool changed = (FUNCTION_IRQ_MASK != (data & 0xc0)); |
| 314 | |
| 315 | if (irq && changed) set_irq(CLEAR_LINE); |
| 316 | |
| 317 | m_option = data & 0xff; |
| 318 | |
| 319 | if (irq && changed) set_irq(ASSERT_LINE); |
| 320 | } |
| 321 | break; |
| 322 | |
| 323 | case 0x18/2: |
| 324 | // port 3 channel A baud rate |
| 325 | break; |
| 326 | |
| 327 | case 0x1a/2: |
| 328 | // port 3 channel B baud rate |
| 329 | break; |
| 330 | |
| 331 | case 0xfc/2: |
| 332 | device_reset(); |
| 333 | break; |
| 334 | } |
| 335 | } |
| 336 | } |
src/mess/machine/wangpc_mcc.h
| r0 | r15426 | |
| 1 | /********************************************************************** |
| 2 | |
| 3 | Wang PC-PM043 Multiport Communications Controller emulation |
| 4 | |
| 5 | Copyright MESS Team. |
| 6 | Visit http://mamedev.org for licensing and usage restrictions. |
| 7 | |
| 8 | **********************************************************************/ |
| 9 | |
| 10 | #pragma once |
| 11 | |
| 12 | #ifndef __WANGPC_MCC__ |
| 13 | #define __WANGPC_MCC__ |
| 14 | |
| 15 | |
| 16 | #include "emu.h" |
| 17 | #include "machine/wangpcbus.h" |
| 18 | #include "machine/z80dart.h" |
| 19 | |
| 20 | |
| 21 | |
| 22 | //************************************************************************** |
| 23 | // TYPE DEFINITIONS |
| 24 | //************************************************************************** |
| 25 | |
| 26 | // ======================> wangpc_mcc_device |
| 27 | |
| 28 | class wangpc_mcc_device : public device_t, |
| 29 | public device_wangpcbus_card_interface |
| 30 | { |
| 31 | public: |
| 32 | // construction/destruction |
| 33 | wangpc_mcc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 34 | |
| 35 | // optional information overrides |
| 36 | virtual machine_config_constructor device_mconfig_additions() const; |
| 37 | |
| 38 | protected: |
| 39 | // device-level overrides |
| 40 | virtual void device_start(); |
| 41 | virtual void device_reset(); |
| 42 | virtual void device_config_complete() { m_shortname = "wangpc_mcc"; } |
| 43 | |
| 44 | // device_wangpcbus_card_interface overrides |
| 45 | virtual UINT16 wangpcbus_iorc_r(address_space &space, offs_t offset, UINT16 mem_mask); |
| 46 | virtual void wangpcbus_aiowc_w(address_space &space, offs_t offset, UINT16 mem_mask, UINT16 data); |
| 47 | |
| 48 | private: |
| 49 | inline void set_irq(int state); |
| 50 | |
| 51 | required_device<z80dart_device> m_sio; |
| 52 | required_device<z80dart_device> m_dart; |
| 53 | |
| 54 | UINT8 m_option; |
| 55 | int m_irq; |
| 56 | }; |
| 57 | |
| 58 | |
| 59 | // device type definition |
| 60 | extern const device_type WANGPC_MCC; |
| 61 | |
| 62 | |
| 63 | #endif |
src/mess/machine/wangpc_wdc.c
| r15425 | r15426 | |
| 22 | 22 | #define MK3882_TAG "l07" |
| 23 | 23 | #define SASIBUS_TAG "sasi" |
| 24 | 24 | |
| 25 | #define OPTION_DREQ1 BIT(m_option, 1) |
| 26 | #define OPTION_DREQ2 BIT(m_option, 2) |
| 27 | #define OPTION_DREQ3 BIT(m_option, 3) |
| 25 | 28 | |
| 26 | 29 | |
| 30 | |
| 27 | 31 | //************************************************************************** |
| 28 | 32 | // DEVICE DEFINITIONS |
| 29 | 33 | //************************************************************************** |
| r15425 | r15426 | |
| 164 | 168 | { |
| 165 | 169 | m_irq = state; |
| 166 | 170 | |
| 167 | | switch (m_dreq) |
| 168 | | { |
| 169 | | case 1: m_bus->irq5_w(m_irq); break; |
| 170 | | case 2: m_bus->irq6_w(m_irq); break; |
| 171 | | case 3: m_bus->irq7_w(m_irq); break; |
| 172 | | } |
| 171 | if (OPTION_DREQ1) m_bus->irq5_w(m_irq); |
| 172 | if (OPTION_DREQ2) m_bus->irq6_w(m_irq); |
| 173 | if (OPTION_DREQ3) m_bus->irq7_w(m_irq); |
| 173 | 174 | } |
| 174 | 175 | |
| 175 | 176 | |
| r15425 | r15426 | |
| 198 | 199 | |
| 199 | 200 | void wangpc_wdc_device::device_start() |
| 200 | 201 | { |
| 202 | // state saving |
| 203 | save_item(NAME(m_status)); |
| 204 | save_item(NAME(m_option)); |
| 205 | save_item(NAME(m_irq)); |
| 201 | 206 | } |
| 202 | 207 | |
| 203 | 208 | |
| r15425 | r15426 | |
| 207 | 212 | |
| 208 | 213 | void wangpc_wdc_device::device_reset() |
| 209 | 214 | { |
| 210 | | m_dreq = 0; |
| 215 | m_status = 0; |
| 216 | m_option = 0; |
| 211 | 217 | |
| 212 | 218 | set_irq(CLEAR_LINE); |
| 213 | 219 | } |
| r15425 | r15426 | |
| 274 | 280 | |
| 275 | 281 | void wangpc_wdc_device::wangpcbus_aiowc_w(address_space &space, offs_t offset, UINT16 mem_mask, UINT16 data) |
| 276 | 282 | { |
| 277 | | if (sad(offset)) |
| 283 | if (sad(offset) && ACCESSING_BITS_0_7) |
| 278 | 284 | { |
| 279 | 285 | switch (offset & 0x7f) |
| 280 | 286 | { |
| r15425 | r15426 | |
| 287 | 293 | break; |
| 288 | 294 | |
| 289 | 295 | case 0xfe/2: |
| 290 | | if (m_irq == ASSERT_LINE) set_irq(CLEAR_LINE); |
| 296 | { |
| 297 | bool irq = (m_irq == ASSERT_LINE); |
| 298 | bool changed = ((m_option & 0x0e) != (data & 0x0e)); |
| 291 | 299 | |
| 292 | | if (BIT(data, 1)) m_dreq = 1; |
| 293 | | if (BIT(data, 2)) m_dreq = 2; |
| 294 | | if (BIT(data, 3)) m_dreq = 3; |
| 300 | if (irq && changed) set_irq(CLEAR_LINE); |
| 295 | 301 | |
| 296 | | if (m_irq == ASSERT_LINE) set_irq(ASSERT_LINE); |
| 302 | m_option = data & 0xff; |
| 303 | |
| 304 | if (irq && changed) set_irq(ASSERT_LINE); |
| 305 | } |
| 297 | 306 | break; |
| 298 | 307 | } |
| 299 | 308 | } |
| r15425 | r15426 | |
| 326 | 335 | |
| 327 | 336 | bool wangpc_wdc_device::wangpcbus_have_dack(int line) |
| 328 | 337 | { |
| 329 | | return line == m_dreq; |
| 338 | return (OPTION_DREQ1 && (line == 1)) || (OPTION_DREQ2 && (line == 2)) || (OPTION_DREQ3 && (line == 3)); |
| 330 | 339 | } |
| 331 | 340 | |
| 332 | 341 | |
src/mess/drivers/wangpc.c
| r15425 | r15426 | |
| 598 | 598 | AM_RANGE(0x1018, 0x1019) AM_MIRROR(0x0002) AM_READWRITE8(fdc_reset_r, fdc_reset_w, 0x00ff)
|
| 599 | 599 | AM_RANGE(0x101c, 0x101d) AM_MIRROR(0x0002) AM_READWRITE8(fdc_tc_r, fdc_tc_w, 0x00ff)
|
| 600 | 600 | AM_RANGE(0x1020, 0x1027) AM_DEVREADWRITE8(I8255A_TAG, i8255_device, read, write, 0x00ff)
|
| 601 | AM_RANGE(0x1028, 0x1029) //AM_WRITE(?)
|
| 601 | 602 | AM_RANGE(0x1040, 0x1047) AM_DEVREADWRITE8_LEGACY(I8253_TAG, pit8253_r, pit8253_w, 0x00ff)
|
| 602 | 603 | AM_RANGE(0x1060, 0x1063) AM_DEVREADWRITE8_LEGACY(I8259A_TAG, pic8259_r, pic8259_w, 0x00ff)
|
| 603 | 604 | AM_RANGE(0x1080, 0x1087) AM_DEVREAD8(SCN2661_TAG, mc2661_device, read, 0x00ff)
|
| r15425 | r15426 | |
| 781 | 782 | {
|
| 782 | 783 | int state = !m_dma_eop | m_uart_dr | m_uart_tbre | m_fdc_dd0 | m_fdc_dd1 | upd765_int_r(m_fdc) | m_fpu_irq | m_bus_irq2;
|
| 783 | 784 | |
| 784 | | //logerror("level 2: %u %u %u %u %u %u %u %u\n",!m_dma_eop , m_uart_dr , m_uart_tbre , m_fdc_dd0 , m_fdc_dd1 , upd765_int_r(m_fdc) , m_fpu_irq , m_bus_irq2);
|
| 785 | | |
| 786 | 785 | pic8259_ir2_w(m_pic, state);
|
| 787 | 786 | }
|
| 788 | 787 | |
| r15425 | r15426 | |
| 1143 | 1142 | };
|
| 1144 | 1143 | |
| 1145 | 1144 | static SLOT_INTERFACE_START( wangpc_cards )
|
| 1145 | SLOT_INTERFACE("emb", WANGPC_EMB) // extended memory board
|
| 1146 | 1146 | SLOT_INTERFACE("lic", WANGPC_LIC) // local interconnect option card
|
| 1147 | 1147 | SLOT_INTERFACE("lvc", WANGPC_LVC) // low-resolution video controller
|
| 1148 | SLOT_INTERFACE("mcc", WANGPC_MCC) // multiport communications controller
|
| 1148 | 1149 | SLOT_INTERFACE("mvc", WANGPC_MVC) // medium-resolution video controller
|
| 1149 | 1150 | SLOT_INTERFACE("rtc", WANGPC_RTC) // remote telecommunications controller
|
| 1150 | 1151 | SLOT_INTERFACE("tig", WANGPC_TIG) // text/image/graphics controller
|
| 1151 | 1152 | SLOT_INTERFACE("wdc", WANGPC_WDC) // Winchester disk controller
|
| 1152 | | //SLOT_INTERFACE("mcc", WANGPC_MCC) // multiport communications controller
|
| 1153 | | //SLOT_INTERFACE("emb", WANGPC_EMB) // extended memory board
|
| 1154 | 1153 | SLOT_INTERFACE_END
|
| 1155 | 1154 | |
| 1156 | 1155 | |
| r15425 | r15426 | |
| 1308 | 1307 | // GAME DRIVERS
|
| 1309 | 1308 | //**************************************************************************
|
| 1310 | 1309 | |
| 1311 | | COMP( 1985, wangpc, 0, 0, wangpc, wangpc, 0, "Wang Laboratories", "Wang Professional Computer", GAME_NOT_WORKING | GAME_SUPPORTS_SAVE )
|
| 1310 | COMP( 1985, wangpc, 0, 0, wangpc, wangpc, 0, "Wang Laboratories", "Wang Professional Computer", GAME_SUPPORTS_SAVE )
|