src/mess/machine/comx_fd.c
| r0 | r12085 | |
| 1 | /* |
| 2 | |
| 3 | COMX-35 Disk Controller Card |
| 4 | (c) 1984 Comx World Operations |
| 5 | |
| 6 | PCB Layout |
| 7 | ---------- |
| 8 | |
| 9 | F-001-FD-REV0 |
| 10 | |
| 11 | |---------------| |
| 12 | | CN1 | |
| 13 | |---| |---------------------------| |
| 14 | | | |
| 15 | | 40174 4068 4072 -| |
| 16 | | ROM || |
| 17 | | LS04 4072 4050 7438 C| |
| 18 | |8MHz N| |
| 19 | | 4049 4075 LS08 2| |
| 20 | |LD1 WD1770 || |
| 21 | | 40174 4503 4075 7438 -| |
| 22 | |LD2 | |
| 23 | |-----------------------------------------------| |
| 24 | |
| 25 | Notes: |
| 26 | All IC's shown. |
| 27 | |
| 28 | ROM - "D.O.S. V1.2" |
| 29 | WD1770 - Western Digital WD1770-xx Floppy Disc Controller @ 8MHz |
| 30 | CN1 - COMX-35 bus PCB edge connector |
| 31 | CN2 - 34 pin floppy connector |
| 32 | LD1 - card selected LED |
| 33 | LD2 - floppy motor on LED |
| 34 | |
| 35 | */ |
| 36 | |
| 37 | #include "comx_fd.h" |
| 38 | |
| 39 | |
| 40 | |
| 41 | //************************************************************************** |
| 42 | // MACROS/CONSTANTS |
| 43 | //************************************************************************** |
| 44 | |
| 45 | #define WD1770_TAG "wd1770" |
| 46 | |
| 47 | |
| 48 | |
| 49 | //************************************************************************** |
| 50 | // DEVICE DEFINITIONS |
| 51 | //************************************************************************** |
| 52 | |
| 53 | const device_type COMX_FD = &device_creator<comx_fd_device>; |
| 54 | |
| 55 | |
| 56 | //------------------------------------------------- |
| 57 | // ROM( comx_fd ) |
| 58 | //------------------------------------------------- |
| 59 | |
| 60 | ROM_START( comx_fd ) |
| 61 | ROM_REGION( 0x2000, "c000", 0 ) |
| 62 | ROM_LOAD( "d.o.s. v1.2.f4", 0x0000, 0x2000, CRC(cf4ecd2e) SHA1(290e19bdc89e3c8059e63d5ae3cca4daa194e1fe) ) |
| 63 | ROM_END |
| 64 | |
| 65 | |
| 66 | //------------------------------------------------- |
| 67 | // rom_region - device-specific ROM region |
| 68 | //------------------------------------------------- |
| 69 | |
| 70 | const rom_entry *comx_fd_device::device_rom_region() const |
| 71 | { |
| 72 | return ROM_NAME( comx_fd ); |
| 73 | } |
| 74 | |
| 75 | |
| 76 | //------------------------------------------------- |
| 77 | // wd17xx_interface fdc_intf |
| 78 | //------------------------------------------------- |
| 79 | |
| 80 | static const floppy_interface floppy_intf = |
| 81 | { |
| 82 | DEVCB_NULL, |
| 83 | DEVCB_NULL, |
| 84 | DEVCB_NULL, |
| 85 | DEVCB_NULL, |
| 86 | DEVCB_NULL, |
| 87 | FLOPPY_STANDARD_5_25_DSDD, |
| 88 | FLOPPY_OPTIONS_NAME(comx35), |
| 89 | "floppy_5_25", |
| 90 | NULL |
| 91 | }; |
| 92 | |
| 93 | WRITE_LINE_MEMBER( comx_fd_device::intrq_w ) |
| 94 | { |
| 95 | m_intrq = state; |
| 96 | } |
| 97 | |
| 98 | WRITE_LINE_MEMBER( comx_fd_device::drq_w ) |
| 99 | { |
| 100 | m_drq = state; |
| 101 | update_ef4(); |
| 102 | } |
| 103 | |
| 104 | static const wd17xx_interface fdc_intf = |
| 105 | { |
| 106 | DEVCB_NULL, |
| 107 | DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, comx_fd_device, intrq_w), |
| 108 | DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, comx_fd_device, drq_w), |
| 109 | { FLOPPY_0, FLOPPY_1, NULL, NULL } |
| 110 | }; |
| 111 | |
| 112 | |
| 113 | //------------------------------------------------- |
| 114 | // MACHINE_CONFIG_FRAGMENT( comx_fd ) |
| 115 | //------------------------------------------------- |
| 116 | |
| 117 | static MACHINE_CONFIG_FRAGMENT( comx_fd ) |
| 118 | MCFG_WD1770_ADD(WD1770_TAG, fdc_intf) |
| 119 | MCFG_FLOPPY_2_DRIVES_ADD(floppy_intf) |
| 120 | MACHINE_CONFIG_END |
| 121 | |
| 122 | |
| 123 | //------------------------------------------------- |
| 124 | // machine_config_additions - device-specific |
| 125 | // machine configurations |
| 126 | //------------------------------------------------- |
| 127 | |
| 128 | machine_config_constructor comx_fd_device::device_mconfig_additions() const |
| 129 | { |
| 130 | return MACHINE_CONFIG_NAME( comx_fd ); |
| 131 | } |
| 132 | |
| 133 | |
| 134 | |
| 135 | //************************************************************************** |
| 136 | // INLINE HELPERS |
| 137 | //************************************************************************** |
| 138 | |
| 139 | //------------------------------------------------- |
| 140 | // comx_fd_device - constructor |
| 141 | //------------------------------------------------- |
| 142 | |
| 143 | inline void comx_fd_device::update_ef4() |
| 144 | { |
| 145 | if (m_ef4_enable) |
| 146 | { |
| 147 | m_bus->ef4_w(m_drq); |
| 148 | } |
| 149 | else |
| 150 | { |
| 151 | m_bus->ef4_w(CLEAR_LINE); |
| 152 | } |
| 153 | } |
| 154 | |
| 155 | |
| 156 | |
| 157 | //************************************************************************** |
| 158 | // LIVE DEVICE |
| 159 | //************************************************************************** |
| 160 | |
| 161 | //------------------------------------------------- |
| 162 | // comx_fd_device - constructor |
| 163 | //------------------------------------------------- |
| 164 | |
| 165 | comx_fd_device::comx_fd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : |
| 166 | device_t(mconfig, COMX_FD, "COMX FD", tag, owner, clock), |
| 167 | device_comx_expansion_card_interface(mconfig, *this), |
| 168 | device_slot_card_interface(mconfig, *this), |
| 169 | m_fdc(*this, WD1770_TAG), |
| 170 | m_floppy0(*this, FLOPPY_0), |
| 171 | m_floppy1(*this, FLOPPY_1), |
| 172 | m_q(0), |
| 173 | m_intrq(0), |
| 174 | m_drq(0), |
| 175 | m_ef4_enable(0) |
| 176 | { |
| 177 | } |
| 178 | |
| 179 | |
| 180 | //------------------------------------------------- |
| 181 | // device_start - device-specific startup |
| 182 | //------------------------------------------------- |
| 183 | |
| 184 | void comx_fd_device::device_start() |
| 185 | { |
| 186 | m_bus = machine().device<comx_expansion_bus_device>(COMX_EXPANSION_TAG); |
| 187 | |
| 188 | m_rom = subregion("c000")->base(); |
| 189 | |
| 190 | // state saving |
| 191 | save_item(NAME(m_q)); |
| 192 | save_item(NAME(m_addr)); |
| 193 | save_item(NAME(m_intrq)); |
| 194 | save_item(NAME(m_drq)); |
| 195 | save_item(NAME(m_ef4_enable)); |
| 196 | } |
| 197 | |
| 198 | |
| 199 | //------------------------------------------------- |
| 200 | // device_reset - device-specific reset |
| 201 | //------------------------------------------------- |
| 202 | |
| 203 | void comx_fd_device::device_reset() |
| 204 | { |
| 205 | } |
| 206 | |
| 207 | |
| 208 | //------------------------------------------------- |
| 209 | // comx_q_w - Q write |
| 210 | //------------------------------------------------- |
| 211 | |
| 212 | void comx_fd_device::comx_q_w(int state) |
| 213 | { |
| 214 | m_q = state; |
| 215 | } |
| 216 | |
| 217 | |
| 218 | //------------------------------------------------- |
| 219 | // comx_io_r - I/O read |
| 220 | //------------------------------------------------- |
| 221 | |
| 222 | UINT8 comx_fd_device::comx_io_r(offs_t offset) |
| 223 | { |
| 224 | UINT8 data; |
| 225 | |
| 226 | if (m_q) |
| 227 | { |
| 228 | data = m_intrq; |
| 229 | } |
| 230 | else |
| 231 | { |
| 232 | data = wd17xx_r(m_fdc, m_addr); |
| 233 | } |
| 234 | |
| 235 | return data; |
| 236 | } |
| 237 | |
| 238 | |
| 239 | //------------------------------------------------- |
| 240 | // comx_io_w - I/O write |
| 241 | //------------------------------------------------- |
| 242 | |
| 243 | void comx_fd_device::comx_io_w(offs_t offset, UINT8 data) |
| 244 | { |
| 245 | /* |
| 246 | |
| 247 | bit description |
| 248 | |
| 249 | 0 A0 |
| 250 | 1 A1 |
| 251 | 2 DRIVE0 |
| 252 | 3 DRIVE1 |
| 253 | 4 F9 DISB |
| 254 | 5 SIDE SELECT |
| 255 | |
| 256 | */ |
| 257 | |
| 258 | if (m_q) |
| 259 | { |
| 260 | // latch data to F3 |
| 261 | m_addr = data & 0x03; |
| 262 | |
| 263 | if (BIT(data, 2)) |
| 264 | { |
| 265 | wd17xx_set_drive(m_fdc, 0); |
| 266 | } |
| 267 | else if (BIT(data, 3)) |
| 268 | { |
| 269 | wd17xx_set_drive(m_fdc, 1); |
| 270 | } |
| 271 | |
| 272 | m_ef4_enable = BIT(data, 4); |
| 273 | update_ef4(); |
| 274 | |
| 275 | wd17xx_set_side(m_fdc, BIT(data, 5)); |
| 276 | } |
| 277 | else |
| 278 | { |
| 279 | // write data to WD1770 |
| 280 | wd17xx_w(m_fdc, m_addr, data); |
| 281 | } |
| 282 | } |
src/mess/machine/comx_fd.h
| r0 | r12085 | |
| 1 | /********************************************************************** |
| 2 | |
| 3 | COMX-35 Disk Controller Card 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 __COMX_FD__ |
| 13 | #define __COMX_FD__ |
| 14 | |
| 15 | #define ADDRESS_MAP_MODERN |
| 16 | |
| 17 | #include "emu.h" |
| 18 | #include "formats/basicdsk.h" |
| 19 | #include "formats/comx35_dsk.h" |
| 20 | #include "imagedev/flopdrv.h" |
| 21 | #include "machine/comxexp.h" |
| 22 | #include "machine/wd17xx.h" |
| 23 | |
| 24 | |
| 25 | |
| 26 | //************************************************************************** |
| 27 | // TYPE DEFINITIONS |
| 28 | //************************************************************************** |
| 29 | |
| 30 | // ======================> comx_fd_device |
| 31 | |
| 32 | class comx_fd_device : public device_t, |
| 33 | public device_comx_expansion_card_interface, |
| 34 | public device_slot_card_interface |
| 35 | { |
| 36 | public: |
| 37 | // construction/destruction |
| 38 | comx_fd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 39 | |
| 40 | // optional information overrides |
| 41 | virtual const rom_entry *device_rom_region() const; |
| 42 | virtual machine_config_constructor device_mconfig_additions() const; |
| 43 | virtual ioport_constructor device_input_ports() const; |
| 44 | |
| 45 | // not really public |
| 46 | DECLARE_WRITE_LINE_MEMBER( intrq_w ); |
| 47 | DECLARE_WRITE_LINE_MEMBER( drq_w ); |
| 48 | |
| 49 | protected: |
| 50 | // device-level overrides |
| 51 | virtual void device_start(); |
| 52 | virtual void device_reset(); |
| 53 | virtual void device_config_complete() { m_shortname = "comx_fd"; } |
| 54 | |
| 55 | // device_comx_expansion_card_interface overrides |
| 56 | virtual void comx_q_w(int state); |
| 57 | virtual UINT8 comx_mrd_r(offs_t offset); |
| 58 | virtual UINT8 comx_io_r(offs_t offset); |
| 59 | virtual void comx_io_w(offs_t offset, UINT8 data); |
| 60 | |
| 61 | private: |
| 62 | inline void update_ef4(); |
| 63 | |
| 64 | // internal state |
| 65 | required_device<device_t> m_fdc; |
| 66 | required_device<device_t> m_floppy0; |
| 67 | required_device<device_t> m_floppy1; |
| 68 | |
| 69 | // floppy state |
| 70 | UINT8 *m_rom; |
| 71 | int m_q; // FDC register select |
| 72 | int m_addr; // FDC address |
| 73 | int m_intrq; // interrupt request |
| 74 | int m_drq; // data request |
| 75 | int m_ef4_enable; // EF4 enable |
| 76 | }; |
| 77 | |
| 78 | |
| 79 | // device type definition |
| 80 | extern const device_type COMX_FD; |
| 81 | |
| 82 | |
| 83 | #endif |
src/mess/machine/comxexp.c
| r0 | r12085 | |
| 1 | /********************************************************************** |
| 2 | |
| 3 | COMX-35 expansion bus emulation |
| 4 | |
| 5 | Copyright MESS Team. |
| 6 | Visit http://mamedev.org for licensing and usage restrictions. |
| 7 | |
| 8 | **********************************************************************/ |
| 9 | |
| 10 | #include "emu.h" |
| 11 | #include "emuopts.h" |
| 12 | #include "machine/comxexp.h" |
| 13 | |
| 14 | |
| 15 | //************************************************************************** |
| 16 | // GLOBAL VARIABLES |
| 17 | //************************************************************************** |
| 18 | |
| 19 | const device_type COMX_EXPANSION_SLOT = &device_creator<comx_expansion_slot_device>; |
| 20 | |
| 21 | |
| 22 | |
| 23 | //************************************************************************** |
| 24 | // LIVE DEVICE |
| 25 | //************************************************************************** |
| 26 | |
| 27 | //------------------------------------------------- |
| 28 | // comx_expansion_slot_device - constructor |
| 29 | //------------------------------------------------- |
| 30 | comx_expansion_slot_device::comx_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : |
| 31 | device_t(mconfig, COMX_EXPANSION_SLOT, "COMX-35 expansion slot", tag, owner, clock), |
| 32 | device_slot_interface(mconfig, *this) |
| 33 | { |
| 34 | } |
| 35 | |
| 36 | void comx_expansion_slot_device::static_set_slot(device_t &device, const char *tag, int num) |
| 37 | { |
| 38 | comx_expansion_slot_device &comx_expansion_card = dynamic_cast<comx_expansion_slot_device &>(device); |
| 39 | comx_expansion_card.m_bus_tag = tag; |
| 40 | comx_expansion_card.m_bus_num = num; |
| 41 | } |
| 42 | |
| 43 | //------------------------------------------------- |
| 44 | // device_start - device-specific startup |
| 45 | //------------------------------------------------- |
| 46 | |
| 47 | void comx_expansion_slot_device::device_start() |
| 48 | { |
| 49 | m_bus = machine().device<comx_expansion_bus_device>(m_bus_tag); |
| 50 | device_comx_expansion_card_interface *dev = dynamic_cast<device_comx_expansion_card_interface *>(get_card_device()); |
| 51 | if (dev) m_bus->add_card(dev, m_bus_num); |
| 52 | } |
| 53 | |
| 54 | |
| 55 | |
| 56 | //************************************************************************** |
| 57 | // GLOBAL VARIABLES |
| 58 | //************************************************************************** |
| 59 | |
| 60 | const device_type COMX_EXPANSION_BUS = &device_creator<comx_expansion_bus_device>; |
| 61 | |
| 62 | |
| 63 | void comx_expansion_bus_device::static_set_cputag(device_t &device, const char *tag) |
| 64 | { |
| 65 | comx_expansion_bus_device &comx_expansion = downcast<comx_expansion_bus_device &>(device); |
| 66 | comx_expansion.m_cputag = tag; |
| 67 | } |
| 68 | |
| 69 | |
| 70 | //------------------------------------------------- |
| 71 | // device_config_complete - perform any |
| 72 | // operations now that the configuration is |
| 73 | // complete |
| 74 | //------------------------------------------------- |
| 75 | |
| 76 | void comx_expansion_bus_device::device_config_complete() |
| 77 | { |
| 78 | // inherit a copy of the static data |
| 79 | const comx_expansion_bus_interface *intf = reinterpret_cast<const comx_expansion_bus_interface *>(static_config()); |
| 80 | if (intf != NULL) |
| 81 | { |
| 82 | *static_cast<comx_expansion_bus_interface *>(this) = *intf; |
| 83 | } |
| 84 | |
| 85 | // or initialize to defaults if none provided |
| 86 | else |
| 87 | { |
| 88 | memset(&m_out_int_cb, 0, sizeof(m_out_int_cb)); |
| 89 | memset(&m_out_ef4_cb, 0, sizeof(m_out_ef4_cb)); |
| 90 | memset(&m_out_wait_cb, 0, sizeof(m_out_wait_cb)); |
| 91 | memset(&m_out_clear_cb, 0, sizeof(m_out_clear_cb)); |
| 92 | memset(&m_out_extrom_cb, 0, sizeof(m_out_extrom_cb)); |
| 93 | } |
| 94 | } |
| 95 | |
| 96 | |
| 97 | |
| 98 | //************************************************************************** |
| 99 | // LIVE DEVICE |
| 100 | //************************************************************************** |
| 101 | |
| 102 | //------------------------------------------------- |
| 103 | // comx_expansion_bus_device - constructor |
| 104 | //------------------------------------------------- |
| 105 | |
| 106 | comx_expansion_bus_device::comx_expansion_bus_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : |
| 107 | device_t(mconfig, COMX_EXPANSION_BUS, "COMX_EXPANSION", tag, owner, clock) |
| 108 | { |
| 109 | for (int i = 0; i < MAX_COMX_EXPANSION_SLOTS; i++) |
| 110 | m_comx_expansion_bus_device[i] = NULL; |
| 111 | } |
| 112 | |
| 113 | |
| 114 | //------------------------------------------------- |
| 115 | // device_start - device-specific startup |
| 116 | //------------------------------------------------- |
| 117 | |
| 118 | void comx_expansion_bus_device::device_start() |
| 119 | { |
| 120 | m_maincpu = machine().device(m_cputag); |
| 121 | |
| 122 | // resolve callbacks |
| 123 | m_out_int_func.resolve(m_out_int_cb, *this); |
| 124 | m_out_ef4_func.resolve(m_out_ef4_cb, *this); |
| 125 | m_out_wait_func.resolve(m_out_wait_cb, *this); |
| 126 | m_out_clear_func.resolve(m_out_clear_cb, *this); |
| 127 | m_out_extrom_func.resolve(m_out_extrom_cb, *this); |
| 128 | } |
| 129 | |
| 130 | |
| 131 | //------------------------------------------------- |
| 132 | // device_reset - device-specific reset |
| 133 | //------------------------------------------------- |
| 134 | |
| 135 | void comx_expansion_bus_device::device_reset() |
| 136 | { |
| 137 | } |
| 138 | |
| 139 | |
| 140 | //------------------------------------------------- |
| 141 | // add_card - add COMX_EXPANSION card |
| 142 | //------------------------------------------------- |
| 143 | |
| 144 | void comx_expansion_bus_device::add_card(device_comx_expansion_card_interface *card, int pos) |
| 145 | { |
| 146 | m_comx_expansion_bus_device[pos] = card; |
| 147 | } |
| 148 | |
| 149 | |
| 150 | //------------------------------------------------- |
| 151 | // mrd_r - memory read |
| 152 | //------------------------------------------------- |
| 153 | |
| 154 | READ8_MEMBER( comx_expansion_bus_device::mrd_r ) |
| 155 | { |
| 156 | UINT8 data = 0; |
| 157 | |
| 158 | for (int i = 0; i < MAX_COMX_EXPANSION_SLOTS; i++) |
| 159 | { |
| 160 | if (m_comx_expansion_bus_device[i] != NULL) |
| 161 | { |
| 162 | data |= m_comx_expansion_bus_device[i]->comx_mrd_r(offset); |
| 163 | } |
| 164 | } |
| 165 | |
| 166 | return data; |
| 167 | } |
| 168 | |
| 169 | |
| 170 | //------------------------------------------------- |
| 171 | // mwr_w - memory write |
| 172 | //------------------------------------------------- |
| 173 | |
| 174 | WRITE8_MEMBER( comx_expansion_bus_device::mwr_w ) |
| 175 | { |
| 176 | for (int i = 0; i < MAX_COMX_EXPANSION_SLOTS; i++) |
| 177 | { |
| 178 | if (m_comx_expansion_bus_device[i] != NULL) |
| 179 | { |
| 180 | m_comx_expansion_bus_device[i]->comx_mwr_w(offset, data); |
| 181 | } |
| 182 | } |
| 183 | } |
| 184 | |
| 185 | |
| 186 | //------------------------------------------------- |
| 187 | // io_r - I/O read |
| 188 | //------------------------------------------------- |
| 189 | |
| 190 | READ8_MEMBER( comx_expansion_bus_device::io_r ) |
| 191 | { |
| 192 | UINT8 data = 0; |
| 193 | |
| 194 | for (int i = 0; i < MAX_COMX_EXPANSION_SLOTS; i++) |
| 195 | { |
| 196 | if (m_comx_expansion_bus_device[i] != NULL) |
| 197 | { |
| 198 | data |= m_comx_expansion_bus_device[i]->comx_io_r(offset); |
| 199 | } |
| 200 | } |
| 201 | |
| 202 | return data; |
| 203 | } |
| 204 | |
| 205 | |
| 206 | //------------------------------------------------- |
| 207 | // sout_w - I/O write |
| 208 | //------------------------------------------------- |
| 209 | |
| 210 | WRITE8_MEMBER( comx_expansion_bus_device::io_w ) |
| 211 | { |
| 212 | for (int i = 0; i < MAX_COMX_EXPANSION_SLOTS; i++) |
| 213 | { |
| 214 | if (m_comx_expansion_bus_device[i] != NULL) |
| 215 | { |
| 216 | m_comx_expansion_bus_device[i]->comx_io_w(offset, data); |
| 217 | } |
| 218 | } |
| 219 | } |
| 220 | |
| 221 | |
| 222 | //------------------------------------------------- |
| 223 | // q_w - Q write |
| 224 | //------------------------------------------------- |
| 225 | |
| 226 | WRITE_LINE_MEMBER( comx_expansion_bus_device::q_w ) |
| 227 | { |
| 228 | for (int i = 0; i < MAX_COMX_EXPANSION_SLOTS; i++) |
| 229 | { |
| 230 | if (m_comx_expansion_bus_device[i] != NULL) |
| 231 | { |
| 232 | m_comx_expansion_bus_device[i]->comx_q_w(state); |
| 233 | } |
| 234 | } |
| 235 | } |
| 236 | |
| 237 | |
| 238 | WRITE_LINE_MEMBER( comx_expansion_bus_device::int_w ) { m_out_int_func(state); } |
| 239 | WRITE_LINE_MEMBER( comx_expansion_bus_device::ef4_w ) { m_out_ef4_func(state); } |
| 240 | WRITE_LINE_MEMBER( comx_expansion_bus_device::wait_w ) { m_out_wait_func(state); } |
| 241 | WRITE_LINE_MEMBER( comx_expansion_bus_device::clear_w ) { m_out_clear_func(state); } |
| 242 | WRITE_LINE_MEMBER( comx_expansion_bus_device::extrom_w ) { m_out_extrom_func(state); } |
| 243 | |
| 244 | |
| 245 | |
| 246 | //************************************************************************** |
| 247 | // DEVICE COMX_EXPANSION CARD INTERFACE |
| 248 | //************************************************************************** |
| 249 | |
| 250 | //------------------------------------------------- |
| 251 | // device_comx_expansion_card_interface - constructor |
| 252 | //------------------------------------------------- |
| 253 | |
| 254 | device_comx_expansion_card_interface::device_comx_expansion_card_interface(const machine_config &mconfig, device_t &device) |
| 255 | : device_interface(device) |
| 256 | { |
| 257 | } |
| 258 | |
| 259 | |
| 260 | //------------------------------------------------- |
| 261 | // ~device_comx_expansion_card_interface - destructor |
| 262 | //------------------------------------------------- |
| 263 | |
| 264 | device_comx_expansion_card_interface::~device_comx_expansion_card_interface() |
| 265 | { |
| 266 | } |
src/mess/machine/comxexp.h
| r0 | r12085 | |
| 1 | /********************************************************************** |
| 2 | |
| 3 | COMX-35 expansion bus emulation |
| 4 | |
| 5 | Copyright MESS Team. |
| 6 | Visit http://mamedev.org for licensing and usage restrictions. |
| 7 | |
| 8 | ********************************************************************** |
| 9 | |
| 10 | GND 1 A GND |
| 11 | NC 2 B NC (DS) |
| 12 | +5V 3 C V+ |
| 13 | D0 4 D D1 |
| 14 | D2 5 E D3 |
| 15 | D4 6 F D5 |
| 16 | D6 7 H D7 |
| 17 | NC (DP) 8 J Q |
| 18 | _CLEAR 9 K _MRD |
| 19 | TPA 10 L N0 |
| 20 | N1 11 M N2 |
| 21 | _RAS 12 N _INT |
| 22 | _WAIT 13 P CLOCK |
| 23 | SC1 14 R SC0 |
| 24 | _EF4 15 S _CASE |
| 25 | TPB 16 T _A15 |
| 26 | _MWR 17 U A14 |
| 27 | MA7 18 V _A14 |
| 28 | MA5 19 W MA6 |
| 29 | MA4 20 X MA3 |
| 30 | MA2 21 Y _EXTROM |
| 31 | MA1 22 Z MA0 |
| 32 | |
| 33 | **********************************************************************/ |
| 34 | |
| 35 | #pragma once |
| 36 | |
| 37 | #ifndef __COMX35_EXPANSION_BUS__ |
| 38 | #define __COMX35_EXPANSION_BUS__ |
| 39 | |
| 40 | #include "emu.h" |
| 41 | |
| 42 | |
| 43 | |
| 44 | //************************************************************************** |
| 45 | // CONSTANTS |
| 46 | //************************************************************************** |
| 47 | |
| 48 | #define COMX_EXPANSION_TAG "comxexp" |
| 49 | |
| 50 | |
| 51 | #define MAX_COMX_EXPANSION_SLOTS 1 |
| 52 | |
| 53 | |
| 54 | |
| 55 | //************************************************************************** |
| 56 | // INTERFACE CONFIGURATION MACROS |
| 57 | //************************************************************************** |
| 58 | |
| 59 | #define MCFG_COMX_EXPANSION_BUS_ADD(_cpu_tag, _clock, _config) \ |
| 60 | MCFG_DEVICE_ADD(COMX_EXPANSION_TAG, COMX_EXPANSION_BUS, _clock) \ |
| 61 | MCFG_DEVICE_CONFIG(_config) \ |
| 62 | comx_expansion_bus_device::static_set_cputag(*device, _cpu_tag); |
| 63 | |
| 64 | |
| 65 | #define COMX_EXPANSION_INTERFACE(_name) \ |
| 66 | const comx_expansion_bus_interface (_name) = |
| 67 | |
| 68 | |
| 69 | #define MCFG_COMX_EXPANSION_SLOT_ADD(_num, _tag, _slot_intf, _def_slot) \ |
| 70 | MCFG_DEVICE_ADD(_tag, COMX_EXPANSION_SLOT, 0) \ |
| 71 | MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot) \ |
| 72 | comx_expansion_slot_device::static_set_slot(*device, COMX_EXPANSION_TAG, _num); |
| 73 | |
| 74 | |
| 75 | |
| 76 | //************************************************************************** |
| 77 | // TYPE DEFINITIONS |
| 78 | //************************************************************************** |
| 79 | |
| 80 | // ======================> comx_expansion_slot_device |
| 81 | |
| 82 | class comx_expansion_bus_device; |
| 83 | |
| 84 | class comx_expansion_slot_device : public device_t, |
| 85 | public device_slot_interface |
| 86 | { |
| 87 | public: |
| 88 | // construction/destruction |
| 89 | comx_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 90 | |
| 91 | // device-level overrides |
| 92 | virtual void device_start(); |
| 93 | |
| 94 | // inline configuration |
| 95 | static void static_set_slot(device_t &device, const char *tag, int num); |
| 96 | |
| 97 | private: |
| 98 | // configuration |
| 99 | const char *m_bus_tag; |
| 100 | int m_bus_num; |
| 101 | comx_expansion_bus_device *m_bus; |
| 102 | }; |
| 103 | |
| 104 | |
| 105 | // device type definition |
| 106 | extern const device_type COMX_EXPANSION_SLOT; |
| 107 | |
| 108 | |
| 109 | // ======================> comx_expansion_bus_interface |
| 110 | |
| 111 | struct comx_expansion_bus_interface |
| 112 | { |
| 113 | devcb_write_line m_out_int_cb; |
| 114 | devcb_write_line m_out_ef4_cb; |
| 115 | devcb_write_line m_out_wait_cb; |
| 116 | devcb_write_line m_out_clear_cb; |
| 117 | devcb_write_line m_out_extrom_cb; |
| 118 | }; |
| 119 | |
| 120 | class device_comx_expansion_card_interface; |
| 121 | |
| 122 | |
| 123 | // ======================> comx_expansion_bus_device |
| 124 | |
| 125 | class comx_expansion_bus_device : public device_t, |
| 126 | public comx_expansion_bus_interface |
| 127 | { |
| 128 | public: |
| 129 | // construction/destruction |
| 130 | comx_expansion_bus_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 131 | // inline configuration |
| 132 | static void static_set_cputag(device_t &device, const char *tag); |
| 133 | |
| 134 | void add_card(device_comx_expansion_card_interface *card, int pos); |
| 135 | |
| 136 | DECLARE_READ8_MEMBER( mrd_r ); |
| 137 | DECLARE_WRITE8_MEMBER( mwr_w ); |
| 138 | |
| 139 | DECLARE_READ8_MEMBER( io_r ); |
| 140 | DECLARE_WRITE8_MEMBER( io_w ); |
| 141 | |
| 142 | DECLARE_WRITE_LINE_MEMBER( q_w ); |
| 143 | |
| 144 | DECLARE_WRITE_LINE_MEMBER( int_w ); |
| 145 | DECLARE_WRITE_LINE_MEMBER( ef4_w ); |
| 146 | DECLARE_WRITE_LINE_MEMBER( wait_w ); |
| 147 | DECLARE_WRITE_LINE_MEMBER( clear_w ); |
| 148 | DECLARE_WRITE_LINE_MEMBER( extrom_w ); |
| 149 | |
| 150 | protected: |
| 151 | // device-level overrides |
| 152 | virtual void device_start(); |
| 153 | virtual void device_reset(); |
| 154 | virtual void device_config_complete(); |
| 155 | |
| 156 | private: |
| 157 | // internal state |
| 158 | device_t *m_maincpu; |
| 159 | |
| 160 | devcb_resolved_write_line m_out_int_func; |
| 161 | devcb_resolved_write_line m_out_ef4_func; |
| 162 | devcb_resolved_write_line m_out_wait_func; |
| 163 | devcb_resolved_write_line m_out_clear_func; |
| 164 | devcb_resolved_write_line m_out_extrom_func; |
| 165 | |
| 166 | device_comx_expansion_card_interface *m_comx_expansion_bus_device[MAX_COMX_EXPANSION_SLOTS]; |
| 167 | const char *m_cputag; |
| 168 | }; |
| 169 | |
| 170 | |
| 171 | // device type definition |
| 172 | extern const device_type COMX_EXPANSION_BUS; |
| 173 | |
| 174 | |
| 175 | // ======================> device_comx_expansion_card_interface |
| 176 | |
| 177 | // class representing interface-specific live comx_expansion card |
| 178 | class device_comx_expansion_card_interface : public device_interface |
| 179 | { |
| 180 | friend class comx_expansion_bus_device; |
| 181 | |
| 182 | public: |
| 183 | // construction/destruction |
| 184 | device_comx_expansion_card_interface(const machine_config &mconfig, device_t &device); |
| 185 | virtual ~device_comx_expansion_card_interface(); |
| 186 | |
| 187 | // interrupts |
| 188 | virtual void comx_q_w(int state) { }; |
| 189 | |
| 190 | // memory access |
| 191 | virtual UINT8 comx_mrd_r(offs_t offset) { return 0; }; |
| 192 | virtual void comx_mwr_w(offs_t offset, UINT8 data) { }; |
| 193 | |
| 194 | // I/O access |
| 195 | virtual UINT8 comx_io_r(offs_t offset) { return 0; }; |
| 196 | virtual void comx_io_w(offs_t offset, UINT8 data) { }; |
| 197 | |
| 198 | public: |
| 199 | comx_expansion_bus_device *m_bus; |
| 200 | }; |
| 201 | |
| 202 | #endif |
src/mess/includes/comx35.h
| r12084 | r12085 | |
| 10 | 10 | #include "sound/cdp1869.h" |
| 11 | 11 | #include "sound/wave.h" |
| 12 | 12 | #include "imagedev/flopdrv.h" |
| 13 | #include "formats/comx35_comx.h" |
| 13 | 14 | #include "formats/comx35_dsk.h" |
| 14 | | #include "formats/comx35_comx.h" |
| 15 | 15 | #include "imagedev/cassette.h" |
| 16 | 16 | #include "imagedev/printer.h" |
| 17 | 17 | #include "imagedev/snapquik.h" |
| 18 | 18 | #include "machine/cdp1871.h" |
| 19 | #include "machine/comxexp.h" |
| 19 | 20 | #include "machine/comxpl80.h" |
| 20 | | #include "machine/wd17xx.h" |
| 21 | 21 | #include "machine/ram.h" |
| 22 | 22 | #include "machine/rescap.h" |
| 23 | #include "machine/wd17xx.h" |
| 23 | 24 | #include "video/mc6845.h" |
| 24 | 25 | |
| 25 | 26 | #define SCREEN_TAG "screen" |
| r12084 | r12085 | |
| 62 | 63 | m_fdc(*this, WD1770_TAG), |
| 63 | 64 | m_kbe(*this, CDP1871_TAG), |
| 64 | 65 | m_cassette(*this, CASSETTE_TAG), |
| 65 | | m_ram(*this, RAM_TAG) |
| 66 | m_ram(*this, RAM_TAG), |
| 67 | m_expansion(*this, COMX_EXPANSION_TAG) |
| 66 | 68 | { } |
| 67 | 69 | |
| 68 | 70 | required_device<cosmac_device> m_maincpu; |
| r12084 | r12085 | |
| 72 | 74 | required_device<cdp1871_device> m_kbe; |
| 73 | 75 | required_device<cassette_image_device> m_cassette; |
| 74 | 76 | required_device<device_t> m_ram; |
| 77 | required_device<comx_expansion_bus_device> m_expansion; |
| 75 | 78 | |
| 76 | 79 | virtual void machine_start(); |
| 77 | 80 | virtual void machine_reset(); |
| r12084 | r12085 | |
| 92 | 95 | DECLARE_READ_LINE_MEMBER( control_r ); |
| 93 | 96 | DECLARE_WRITE_LINE_MEMBER( fdc_intrq_w ); |
| 94 | 97 | DECLARE_WRITE_LINE_MEMBER( fdc_drq_w ); |
| 98 | DECLARE_WRITE_LINE_MEMBER( ef4_w ); |
| 95 | 99 | |
| 96 | 100 | UINT8 read_expansion(); |
| 97 | 101 | bool is_expansion_box_installed(); |
src/mess/drivers/comx35.c
| r12084 | r12085 | |
| 226 | 226 | |
| 227 | 227 | if (!state->m_iden) |
| 228 | 228 | { |
| 229 | | device_set_input_line(device, COSMAC_INPUT_LINE_DMAOUT, ASSERT_LINE); |
| 229 | state->m_maincpu->set_input_line(COSMAC_INPUT_LINE_DMAOUT, ASSERT_LINE); |
| 230 | 230 | } |
| 231 | 231 | } |
| 232 | 232 | else |
| r12084 | r12085 | |
| 237 | 237 | |
| 238 | 238 | case COSMAC_STATE_CODE_S2_DMA: |
| 239 | 239 | // DMA acknowledge clears the DMAOUT request |
| 240 | | device_set_input_line(device, COSMAC_INPUT_LINE_DMAOUT, CLEAR_LINE); |
| 240 | state->m_maincpu->set_input_line(COSMAC_INPUT_LINE_DMAOUT, CLEAR_LINE); |
| 241 | 241 | break; |
| 242 | 242 | |
| 243 | 243 | case COSMAC_STATE_CODE_S3_INTERRUPT: |
| 244 | 244 | // interrupt acknowledge clears the INT request |
| 245 | | device_set_input_line(device, COSMAC_INPUT_LINE_INT, CLEAR_LINE); |
| 245 | state->m_maincpu->set_input_line(COSMAC_INPUT_LINE_INT, CLEAR_LINE); |
| 246 | 246 | break; |
| 247 | 247 | } |
| 248 | 248 | } |
| r12084 | r12085 | |
| 259 | 259 | |
| 260 | 260 | // cassette output |
| 261 | 261 | m_cassette->output(state ? +1.0 : -1.0); |
| 262 | |
| 263 | // expansion bus |
| 264 | m_expansion->q_w(state); |
| 262 | 265 | } |
| 263 | 266 | |
| 264 | 267 | static COSMAC_INTERFACE( cosmac_intf ) |
| r12084 | r12085 | |
| 289 | 292 | return BIT(input_port_read(machine(), "MODIFIERS"), 1); |
| 290 | 293 | } |
| 291 | 294 | |
| 292 | | static CDP1871_INTERFACE( comx35_cdp1871_intf ) |
| 295 | static CDP1871_INTERFACE( kbc_intf ) |
| 293 | 296 | { |
| 294 | 297 | DEVCB_INPUT_PORT("D1"), |
| 295 | 298 | DEVCB_INPUT_PORT("D2"), |
| r12084 | r12085 | |
| 311 | 314 | |
| 312 | 315 | /* Machine Drivers */ |
| 313 | 316 | |
| 314 | | static const cassette_interface comx35_cassette_interface = |
| 317 | static const cassette_interface cassette_intf = |
| 315 | 318 | { |
| 316 | 319 | cassette_default_formats, |
| 317 | 320 | NULL, |
| r12084 | r12085 | |
| 320 | 323 | NULL |
| 321 | 324 | }; |
| 322 | 325 | |
| 323 | | static const floppy_interface comx35_floppy_interface = |
| 326 | static const floppy_interface floppy_intf = |
| 324 | 327 | { |
| 325 | 328 | DEVCB_NULL, |
| 326 | 329 | DEVCB_NULL, |
| 327 | 330 | DEVCB_NULL, |
| 328 | 331 | DEVCB_NULL, |
| 329 | 332 | DEVCB_NULL, |
| 330 | | FLOPPY_STANDARD_5_25_DSHD, |
| 333 | FLOPPY_STANDARD_5_25_DSDD, |
| 331 | 334 | FLOPPY_OPTIONS_NAME(comx35), |
| 332 | | NULL, |
| 335 | "floppy_5_25", |
| 333 | 336 | NULL |
| 334 | 337 | }; |
| 335 | 338 | |
| 339 | WRITE_LINE_MEMBER( comx35_state::ef4_w ) |
| 340 | { |
| 341 | m_cdp1802_ef4 = state; |
| 342 | } |
| 343 | |
| 344 | static COMX_EXPANSION_INTERFACE( expansion_intf ) |
| 345 | { |
| 346 | DEVCB_CPU_INPUT_LINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT), |
| 347 | DEVCB_DRIVER_LINE_MEMBER(comx35_state, ef4_w), |
| 348 | DEVCB_NULL, |
| 349 | DEVCB_NULL, |
| 350 | DEVCB_NULL |
| 351 | }; |
| 352 | |
| 353 | static SLOT_INTERFACE_START( mpz80_s100_cards ) |
| 354 | /* SLOT_INTERFACE("eb", COMX_EB) |
| 355 | SLOT_INTERFACE("ebfm31", COMX_EB_FM_31) |
| 356 | SLOT_INTERFACE("ebfm32", COMX_EB_FM_32) |
| 357 | SLOT_INTERFACE("fd", COMX_FD) |
| 358 | SLOT_INTERFACE("clm", COMX_CLM) |
| 359 | SLOT_INTERFACE("ramcard", COMX_RAMCARD) |
| 360 | SLOT_INTERFACE("joycard", COMX_JOYCARD) |
| 361 | SLOT_INTERFACE("parallel", COMX_PARALLEL) |
| 362 | SLOT_INTERFACE("parallel_fm", COMX_PARALLEL_FM) |
| 363 | SLOT_INTERFACE("serial", COMX_SERIAL) |
| 364 | SLOT_INTERFACE("thermal", COMX_THERMAL)*/ |
| 365 | SLOT_INTERFACE_END |
| 366 | |
| 336 | 367 | static MACHINE_CONFIG_START( pal, comx35_state ) |
| 337 | 368 | /* basic system hardware */ |
| 338 | 369 | MCFG_CPU_ADD(CDP1802_TAG, COSMAC, CDP1869_CPU_CLK_PAL) |
| r12084 | r12085 | |
| 344 | 375 | MCFG_FRAGMENT_ADD(comx35_pal_video) |
| 345 | 376 | |
| 346 | 377 | /* peripheral hardware */ |
| 347 | | MCFG_CDP1871_ADD(CDP1871_TAG, comx35_cdp1871_intf, CDP1869_CPU_CLK_PAL / 8) |
| 348 | | MCFG_WD1770_ADD(WD1770_TAG, comx35_wd17xx_interface ) |
| 378 | MCFG_CDP1871_ADD(CDP1871_TAG, kbc_intf, CDP1869_CPU_CLK_PAL / 8) |
| 379 | MCFG_WD1770_ADD(WD1770_TAG, comx35_wd17xx_interface) |
| 349 | 380 | MCFG_QUICKLOAD_ADD("quickload", comx35_comx, "comx", 0) |
| 350 | | MCFG_CASSETTE_ADD(CASSETTE_TAG, comx35_cassette_interface) |
| 381 | MCFG_CASSETTE_ADD(CASSETTE_TAG, cassette_intf) |
| 351 | 382 | MCFG_PRINTER_ADD("printer") |
| 352 | 383 | |
| 353 | | MCFG_FLOPPY_2_DRIVES_ADD(comx35_floppy_interface) |
| 384 | MCFG_FLOPPY_2_DRIVES_ADD(floppy_intf) |
| 354 | 385 | MCFG_COMXPL80_ADD() |
| 386 | |
| 387 | // expansion bus |
| 388 | MCFG_COMX_EXPANSION_BUS_ADD(CDP1802_TAG, CDP1869_CPU_CLK_PAL, expansion_intf) |
| 355 | 389 | |
| 356 | 390 | /* internal ram */ |
| 357 | 391 | MCFG_RAM_ADD(RAM_TAG) |
| r12084 | r12085 | |
| 369 | 403 | MCFG_FRAGMENT_ADD(comx35_ntsc_video) |
| 370 | 404 | |
| 371 | 405 | /* peripheral hardware */ |
| 372 | | MCFG_CDP1871_ADD(CDP1871_TAG, comx35_cdp1871_intf, CDP1869_CPU_CLK_NTSC / 8) |
| 373 | | MCFG_WD1770_ADD(WD1770_TAG, comx35_wd17xx_interface ) |
| 406 | MCFG_CDP1871_ADD(CDP1871_TAG, kbc_intf, CDP1869_CPU_CLK_NTSC / 8) |
| 407 | MCFG_WD1770_ADD(WD1770_TAG, comx35_wd17xx_interface) |
| 374 | 408 | MCFG_QUICKLOAD_ADD("quickload", comx35_comx, "comx", 0) |
| 375 | | MCFG_CASSETTE_ADD(CASSETTE_TAG, comx35_cassette_interface) |
| 409 | MCFG_CASSETTE_ADD(CASSETTE_TAG, cassette_intf) |
| 376 | 410 | MCFG_PRINTER_ADD("printer") |
| 377 | 411 | |
| 378 | | MCFG_FLOPPY_2_DRIVES_ADD(comx35_floppy_interface) |
| 412 | MCFG_FLOPPY_2_DRIVES_ADD(floppy_intf) |
| 379 | 413 | MCFG_COMXPL80_ADD() |
| 414 | |
| 415 | // expansion bus |
| 416 | MCFG_COMX_EXPANSION_BUS_ADD(CDP1802_TAG, CDP1869_CPU_CLK_NTSC, expansion_intf) |
| 380 | 417 | |
| 381 | 418 | /* internal ram */ |
| 382 | 419 | MCFG_RAM_ADD(RAM_TAG) |