trunk/src/emu/bus/dmv/k210.c
| r0 | r241996 | |
| 1 | // license:BSD-3-Clause |
| 2 | // copyright-holders:Sandro Ronco |
| 3 | /*************************************************************************** |
| 4 | |
| 5 | K210 Centronics module |
| 6 | |
| 7 | ***************************************************************************/ |
| 8 | |
| 9 | #include "emu.h" |
| 10 | #include "k210.h" |
| 11 | |
| 12 | /*************************************************************************** |
| 13 | IMPLEMENTATION |
| 14 | ***************************************************************************/ |
| 15 | |
| 16 | |
| 17 | static MACHINE_CONFIG_FRAGMENT( dmv_k210 ) |
| 18 | MCFG_DEVICE_ADD("ppi8255", I8255, 0) |
| 19 | MCFG_I8255_IN_PORTA_CB(READ8(dmv_k210_device, porta_r)) |
| 20 | MCFG_I8255_IN_PORTB_CB(READ8(dmv_k210_device, portb_r)) |
| 21 | MCFG_I8255_IN_PORTC_CB(READ8(dmv_k210_device, portc_r)) |
| 22 | MCFG_I8255_OUT_PORTA_CB(WRITE8(dmv_k210_device, porta_w)) |
| 23 | MCFG_I8255_OUT_PORTB_CB(WRITE8(dmv_k210_device, portb_w)) |
| 24 | MCFG_I8255_OUT_PORTC_CB(WRITE8(dmv_k210_device, portc_w)) |
| 25 | |
| 26 | MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") |
| 27 | MCFG_CENTRONICS_DATA_INPUT_BUFFER("cent_data_in") |
| 28 | MCFG_CENTRONICS_ACK_HANDLER(WRITELINE(dmv_k210_device, cent_ack_w)) |
| 29 | MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(dmv_k210_device, cent_busy_w)) |
| 30 | MCFG_CENTRONICS_SELECT_IN_HANDLER(WRITELINE(dmv_k210_device, cent_slct_w)) |
| 31 | MCFG_CENTRONICS_PERROR_HANDLER(WRITELINE(dmv_k210_device, cent_pe_w)) |
| 32 | MCFG_CENTRONICS_FAULT_HANDLER(WRITELINE(dmv_k210_device, cent_fault_w)) |
| 33 | MCFG_CENTRONICS_AUTOFD_HANDLER(WRITELINE(dmv_k210_device, cent_autofd_w)) |
| 34 | MCFG_CENTRONICS_INIT_HANDLER(WRITELINE(dmv_k210_device, cent_init_w)) |
| 35 | |
| 36 | MCFG_DEVICE_ADD("cent_data_in", INPUT_BUFFER, 0) |
| 37 | MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") |
| 38 | MACHINE_CONFIG_END |
| 39 | |
| 40 | //************************************************************************** |
| 41 | // GLOBAL VARIABLES |
| 42 | //************************************************************************** |
| 43 | |
| 44 | const device_type DMV_K210 = &device_creator<dmv_k210_device>; |
| 45 | |
| 46 | //************************************************************************** |
| 47 | // LIVE DEVICE |
| 48 | //************************************************************************** |
| 49 | |
| 50 | //------------------------------------------------- |
| 51 | // dmv_k210_device - constructor |
| 52 | //------------------------------------------------- |
| 53 | |
| 54 | dmv_k210_device::dmv_k210_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 55 | : device_t(mconfig, DMV_K210, "K210 Centronics", tag, owner, clock, "dmv_k210", __FILE__), |
| 56 | device_dmvslot_interface( mconfig, *this ), |
| 57 | m_ppi(*this, "ppi8255"), |
| 58 | m_centronics(*this, "centronics"), |
| 59 | m_cent_data_in(*this, "cent_data_in"), |
| 60 | m_cent_data_out(*this, "cent_data_out") |
| 61 | { |
| 62 | } |
| 63 | |
| 64 | //------------------------------------------------- |
| 65 | // device_start - device-specific startup |
| 66 | //------------------------------------------------- |
| 67 | |
| 68 | void dmv_k210_device::device_start() |
| 69 | { |
| 70 | m_clk1_timer = timer_alloc(0, NULL); |
| 71 | m_bus = static_cast<dmvcart_slot_device*>(owner()); |
| 72 | } |
| 73 | |
| 74 | //------------------------------------------------- |
| 75 | // device_reset - device-specific reset |
| 76 | //------------------------------------------------- |
| 77 | |
| 78 | void dmv_k210_device::device_reset() |
| 79 | { |
| 80 | m_clk1_timer->adjust(attotime::never); |
| 81 | m_portb = 0x00; |
| 82 | m_portc = 0x00; |
| 83 | } |
| 84 | |
| 85 | //------------------------------------------------- |
| 86 | // device_timer - handler timer events |
| 87 | //------------------------------------------------- |
| 88 | |
| 89 | void dmv_k210_device::device_timer(emu_timer &timer, device_timer_id tid, int param, void *ptr) |
| 90 | { |
| 91 | m_centronics->write_strobe(CLEAR_LINE); |
| 92 | } |
| 93 | |
| 94 | //------------------------------------------------- |
| 95 | // machine_config_additions - device-specific |
| 96 | // machine configurations |
| 97 | //------------------------------------------------- |
| 98 | |
| 99 | machine_config_constructor dmv_k210_device::device_mconfig_additions() const |
| 100 | { |
| 101 | return MACHINE_CONFIG_NAME( dmv_k210 ); |
| 102 | } |
| 103 | |
| 104 | void dmv_k210_device::io_read(address_space &space, int ifsel, offs_t offset, UINT8 &data) |
| 105 | { |
| 106 | if (ifsel == 0) |
| 107 | data = m_ppi->read(space, offset & 0x03); |
| 108 | } |
| 109 | |
| 110 | void dmv_k210_device::io_write(address_space &space, int ifsel, offs_t offset, UINT8 data) |
| 111 | { |
| 112 | if (ifsel == 0) |
| 113 | m_ppi->write(space, offset & 0x03, data); |
| 114 | } |
| 115 | |
| 116 | READ8_MEMBER( dmv_k210_device::porta_r ) |
| 117 | { |
| 118 | return m_cent_data_in->read(); |
| 119 | } |
| 120 | |
| 121 | READ8_MEMBER( dmv_k210_device::portb_r ) |
| 122 | { |
| 123 | return m_portb; |
| 124 | } |
| 125 | |
| 126 | READ8_MEMBER( dmv_k210_device::portc_r ) |
| 127 | { |
| 128 | return m_portc; |
| 129 | } |
| 130 | |
| 131 | WRITE8_MEMBER( dmv_k210_device::porta_w ) |
| 132 | { |
| 133 | m_cent_data_out->write(data); |
| 134 | } |
| 135 | |
| 136 | WRITE8_MEMBER( dmv_k210_device::portb_w ) |
| 137 | { |
| 138 | m_centronics->write_ack(BIT(data, 2)); |
| 139 | m_centronics->write_select(BIT(data, 4)); |
| 140 | m_centronics->write_busy(BIT(data, 5)); |
| 141 | m_centronics->write_perror(BIT(data, 6)); |
| 142 | m_centronics->write_fault(BIT(data, 7)); |
| 143 | } |
| 144 | |
| 145 | WRITE8_MEMBER( dmv_k210_device::portc_w ) |
| 146 | { |
| 147 | if (!(data & 0x80)) |
| 148 | { |
| 149 | m_centronics->write_strobe(ASSERT_LINE); |
| 150 | m_clk1_timer->adjust(attotime::from_hz(XTAL_1MHz)); |
| 151 | } |
| 152 | |
| 153 | m_centronics->write_init(!BIT(data, 1)); |
| 154 | m_centronics->write_autofd(!BIT(data, 2)); |
| 155 | m_centronics->write_ack(BIT(data, 6)); |
| 156 | m_bus->m_out_irq_cb(BIT(data, 3)); |
| 157 | } |
| 158 | |
| 159 | WRITE_LINE_MEMBER( dmv_k210_device::cent_ack_w ) { if (state) m_portb |= 0x04; else m_portb &= ~0x04; m_ppi->pc6_w(state); } |
| 160 | WRITE_LINE_MEMBER( dmv_k210_device::cent_slct_w ) { if (state) m_portb |= 0x10; else m_portb &= ~0x10; } |
| 161 | WRITE_LINE_MEMBER( dmv_k210_device::cent_busy_w ) { if (state) m_portb |= 0x20; else m_portb &= ~0x20; } |
| 162 | WRITE_LINE_MEMBER( dmv_k210_device::cent_pe_w ) { if (state) m_portb |= 0x40; else m_portb &= ~0x40; } |
| 163 | WRITE_LINE_MEMBER( dmv_k210_device::cent_fault_w ) { if (state) m_portb |= 0x80; else m_portb &= ~0x80; } |
| 164 | |
| 165 | WRITE_LINE_MEMBER( dmv_k210_device::cent_autofd_w ) { if (state) m_portc |= 0x02; else m_portc &= ~0x02; } |
| 166 | WRITE_LINE_MEMBER( dmv_k210_device::cent_init_w ) { if (state) m_portc |= 0x04; else m_portc &= ~0x04; } |
trunk/src/emu/bus/dmv/k210.h
| r0 | r241996 | |
| 1 | // license:BSD-3-Clause |
| 2 | // copyright-holders:Sandro Ronco |
| 3 | #pragma once |
| 4 | |
| 5 | #ifndef __DMV_K210_H__ |
| 6 | #define __DMV_K210_H__ |
| 7 | |
| 8 | #include "emu.h" |
| 9 | #include "dmvbus.h" |
| 10 | #include "machine/i8255.h" |
| 11 | #include "bus/centronics/ctronics.h" |
| 12 | |
| 13 | //************************************************************************** |
| 14 | // TYPE DEFINITIONS |
| 15 | //************************************************************************** |
| 16 | |
| 17 | // ======================> dmv_k210_device |
| 18 | |
| 19 | class dmv_k210_device : |
| 20 | public device_t, |
| 21 | public device_dmvslot_interface |
| 22 | { |
| 23 | public: |
| 24 | // construction/destruction |
| 25 | dmv_k210_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 26 | |
| 27 | // optional information overrides |
| 28 | virtual machine_config_constructor device_mconfig_additions() const; |
| 29 | |
| 30 | DECLARE_READ8_MEMBER(porta_r); |
| 31 | DECLARE_READ8_MEMBER(portb_r); |
| 32 | DECLARE_READ8_MEMBER(portc_r); |
| 33 | DECLARE_WRITE8_MEMBER(porta_w); |
| 34 | DECLARE_WRITE8_MEMBER(portb_w); |
| 35 | DECLARE_WRITE8_MEMBER(portc_w); |
| 36 | |
| 37 | DECLARE_WRITE_LINE_MEMBER(cent_ack_w); |
| 38 | DECLARE_WRITE_LINE_MEMBER(cent_busy_w); |
| 39 | DECLARE_WRITE_LINE_MEMBER(cent_slct_w); |
| 40 | DECLARE_WRITE_LINE_MEMBER(cent_pe_w); |
| 41 | DECLARE_WRITE_LINE_MEMBER(cent_fault_w); |
| 42 | DECLARE_WRITE_LINE_MEMBER(cent_autofd_w); |
| 43 | DECLARE_WRITE_LINE_MEMBER(cent_init_w); |
| 44 | |
| 45 | protected: |
| 46 | // device-level overrides |
| 47 | virtual void device_start(); |
| 48 | virtual void device_reset(); |
| 49 | void device_timer(emu_timer &timer, device_timer_id tid, int param, void *ptr); |
| 50 | |
| 51 | // dmvcart_interface overrides |
| 52 | virtual void io_read(address_space &space, int ifsel, offs_t offset, UINT8 &data); |
| 53 | virtual void io_write(address_space &space, int ifsel, offs_t offset, UINT8 data); |
| 54 | |
| 55 | private: |
| 56 | required_device<i8255_device> m_ppi; |
| 57 | required_device<centronics_device> m_centronics; |
| 58 | required_device<input_buffer_device> m_cent_data_in; |
| 59 | required_device<output_latch_device> m_cent_data_out; |
| 60 | dmvcart_slot_device * m_bus; |
| 61 | |
| 62 | emu_timer * m_clk1_timer; |
| 63 | UINT8 m_portb; |
| 64 | UINT8 m_portc; |
| 65 | }; |
| 66 | |
| 67 | |
| 68 | // device type definition |
| 69 | extern const device_type DMV_K210; |
| 70 | |
| 71 | #endif /* __DMV_K210_H__ */ |
trunk/src/emu/bus/dmv/k801.c
| r0 | r241996 | |
| 1 | // license:BSD-3-Clause |
| 2 | // copyright-holders:Sandro Ronco |
| 3 | /*************************************************************************** |
| 4 | |
| 5 | K801 RS-232 Switchable Interface |
| 6 | K211 RS-232 Communications Interface |
| 7 | K212 RS-232 Printer Interface |
| 8 | K213 RS-232 Plotter Interface |
| 9 | |
| 10 | K211, K212 and K213 have same board, but different cables. |
| 11 | K801 uses a 2661 instead of the 2651 and has 4 switches for |
| 12 | select the IFSEL. |
| 13 | |
| 14 | ***************************************************************************/ |
| 15 | |
| 16 | #include "emu.h" |
| 17 | #include "k801.h" |
| 18 | |
| 19 | /*************************************************************************** |
| 20 | IMPLEMENTATION |
| 21 | ***************************************************************************/ |
| 22 | |
| 23 | |
| 24 | static MACHINE_CONFIG_FRAGMENT( dmv_k801 ) |
| 25 | MCFG_DEVICE_ADD("epci", MC2661, XTAL_5_0688MHz) |
| 26 | MCFG_MC2661_TXD_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_txd)) |
| 27 | MCFG_MC2661_RTS_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_rts)) |
| 28 | MCFG_MC2661_DTR_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_dtr)) |
| 29 | MCFG_MC2661_RXRDY_HANDLER(WRITELINE(dmv_k801_device, epci_irq_w)) |
| 30 | MCFG_MC2661_TXRDY_HANDLER(WRITELINE(dmv_k801_device, epci_irq_w)) |
| 31 | |
| 32 | MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, "printer") |
| 33 | MCFG_RS232_RXD_HANDLER(DEVWRITELINE("epci", mc2661_device, rx_w)) |
| 34 | MCFG_RS232_DCD_HANDLER(DEVWRITELINE("epci", mc2661_device, dcd_w)) |
| 35 | MCFG_RS232_DSR_HANDLER(DEVWRITELINE("epci", mc2661_device, dsr_w)) |
| 36 | MCFG_RS232_CTS_HANDLER(DEVWRITELINE("epci", mc2661_device, cts_w)) |
| 37 | MACHINE_CONFIG_END |
| 38 | |
| 39 | static MACHINE_CONFIG_FRAGMENT( dmv_k211 ) |
| 40 | MCFG_FRAGMENT_ADD( dmv_k801 ) |
| 41 | |
| 42 | MCFG_DEVICE_MODIFY("rs232") |
| 43 | MCFG_SLOT_DEFAULT_OPTION("null_modem") |
| 44 | MACHINE_CONFIG_END |
| 45 | |
| 46 | static MACHINE_CONFIG_FRAGMENT( dmv_k212 ) |
| 47 | MCFG_FRAGMENT_ADD( dmv_k801 ) |
| 48 | |
| 49 | MCFG_DEVICE_MODIFY("rs232") |
| 50 | MCFG_SLOT_DEFAULT_OPTION("printer") |
| 51 | MACHINE_CONFIG_END |
| 52 | |
| 53 | static MACHINE_CONFIG_FRAGMENT( dmv_k213 ) |
| 54 | MCFG_FRAGMENT_ADD( dmv_k801 ) |
| 55 | |
| 56 | MCFG_DEVICE_MODIFY("rs232") |
| 57 | MCFG_SLOT_DEFAULT_OPTION(NULL) |
| 58 | MACHINE_CONFIG_END |
| 59 | |
| 60 | static INPUT_PORTS_START( dmv_k801 ) |
| 61 | PORT_START("DSW") |
| 62 | PORT_DIPNAME( 0x0f, 0x00, "K801 IFSEL" ) PORT_DIPLOCATION("S:!4,S:!3,S:!2,S:!1") |
| 63 | PORT_DIPSETTING( 0x00, "0A" ) |
| 64 | PORT_DIPSETTING( 0x01, "0B" ) |
| 65 | PORT_DIPSETTING( 0x02, "1A" ) |
| 66 | PORT_DIPSETTING( 0x03, "1B" ) |
| 67 | PORT_DIPSETTING( 0x04, "2A" ) |
| 68 | PORT_DIPSETTING( 0x05, "2B" ) |
| 69 | PORT_DIPSETTING( 0x06, "3A" ) |
| 70 | PORT_DIPSETTING( 0x07, "3B" ) |
| 71 | PORT_DIPSETTING( 0x08, "4A" ) |
| 72 | PORT_DIPSETTING( 0x09, "4B" ) |
| 73 | INPUT_PORTS_END |
| 74 | |
| 75 | static INPUT_PORTS_START( dmv_k211 ) |
| 76 | PORT_START("DSW") |
| 77 | PORT_DIPNAME( 0x03, 0x02, "K211 Jumpers" ) PORT_DIPLOCATION("J:1,J:2") |
| 78 | PORT_DIPSETTING( 0x01, "IFSEL 0" ) |
| 79 | PORT_DIPSETTING( 0x02, "IFSEL 1" ) |
| 80 | INPUT_PORTS_END |
| 81 | |
| 82 | static INPUT_PORTS_START( dmv_k212 ) |
| 83 | PORT_START("DSW") |
| 84 | PORT_DIPNAME( 0x03, 0x01, "K212 Jumpers" ) PORT_DIPLOCATION("J:1,J:2") |
| 85 | PORT_DIPSETTING( 0x01, "IFSEL 0" ) |
| 86 | PORT_DIPSETTING( 0x02, "IFSEL 1" ) |
| 87 | INPUT_PORTS_END |
| 88 | |
| 89 | static INPUT_PORTS_START( dmv_k213 ) |
| 90 | PORT_START("DSW") |
| 91 | PORT_DIPNAME( 0x03, 0x01, "K213 Jumpers" ) PORT_DIPLOCATION("J:1,J:2") |
| 92 | PORT_DIPSETTING( 0x01, "IFSEL 0" ) |
| 93 | PORT_DIPSETTING( 0x02, "IFSEL 1" ) |
| 94 | INPUT_PORTS_END |
| 95 | |
| 96 | |
| 97 | //************************************************************************** |
| 98 | // GLOBAL VARIABLES |
| 99 | //************************************************************************** |
| 100 | |
| 101 | const device_type DMV_K801 = &device_creator<dmv_k801_device>; |
| 102 | const device_type DMV_K211 = &device_creator<dmv_k211_device>; |
| 103 | const device_type DMV_K212 = &device_creator<dmv_k212_device>; |
| 104 | const device_type DMV_K213 = &device_creator<dmv_k213_device>; |
| 105 | |
| 106 | //************************************************************************** |
| 107 | // LIVE DEVICE |
| 108 | //************************************************************************** |
| 109 | |
| 110 | //------------------------------------------------- |
| 111 | // dmv_k801_device - constructor |
| 112 | //------------------------------------------------- |
| 113 | |
| 114 | dmv_k801_device::dmv_k801_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 115 | : device_t(mconfig, DMV_K801, "K801 RS-232 Switchable Interface", tag, owner, clock, "dmv_k801", __FILE__), |
| 116 | device_dmvslot_interface( mconfig, *this ), |
| 117 | m_epci(*this, "epci"), |
| 118 | m_dsw(*this, "DSW") |
| 119 | { |
| 120 | } |
| 121 | |
| 122 | dmv_k801_device::dmv_k801_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_dmvslot_interface( mconfig, *this ), |
| 125 | m_epci(*this, "epci"), |
| 126 | m_dsw(*this, "DSW") |
| 127 | { |
| 128 | } |
| 129 | |
| 130 | //------------------------------------------------- |
| 131 | // dmv_k211_device - constructor |
| 132 | //------------------------------------------------- |
| 133 | |
| 134 | dmv_k211_device::dmv_k211_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 135 | : dmv_k801_device(mconfig, DMV_K211, "K211 RS-232 Communications Interface", tag, owner, clock, "dmv_k211", __FILE__) |
| 136 | { |
| 137 | } |
| 138 | |
| 139 | |
| 140 | dmv_k211_device::dmv_k211_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) |
| 141 | : dmv_k801_device(mconfig, type, name, tag, owner, clock, shortname, source) |
| 142 | { |
| 143 | } |
| 144 | |
| 145 | //------------------------------------------------- |
| 146 | // dmv_k212_device - constructor |
| 147 | //------------------------------------------------- |
| 148 | |
| 149 | dmv_k212_device::dmv_k212_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 150 | : dmv_k211_device(mconfig, DMV_K212, "K212 RS-232 Printer Interface", tag, owner, clock, "dmv_k212", __FILE__) |
| 151 | { |
| 152 | } |
| 153 | |
| 154 | //------------------------------------------------- |
| 155 | // dmv_k213_device - constructor |
| 156 | //------------------------------------------------- |
| 157 | |
| 158 | dmv_k213_device::dmv_k213_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 159 | : dmv_k211_device(mconfig, DMV_K213, "K213 RS-232 Plotter Interface", tag, owner, clock, "dmv_k213", __FILE__) |
| 160 | { |
| 161 | } |
| 162 | |
| 163 | //------------------------------------------------- |
| 164 | // device_start - device-specific startup |
| 165 | //------------------------------------------------- |
| 166 | |
| 167 | void dmv_k801_device::device_start() |
| 168 | { |
| 169 | m_bus = static_cast<dmvcart_slot_device*>(owner()); |
| 170 | } |
| 171 | |
| 172 | //------------------------------------------------- |
| 173 | // device_reset - device-specific reset |
| 174 | //------------------------------------------------- |
| 175 | |
| 176 | void dmv_k801_device::device_reset() |
| 177 | { |
| 178 | } |
| 179 | |
| 180 | //------------------------------------------------- |
| 181 | // machine_config_additions - device-specific |
| 182 | // machine configurations |
| 183 | //------------------------------------------------- |
| 184 | |
| 185 | machine_config_constructor dmv_k801_device::device_mconfig_additions() const |
| 186 | { |
| 187 | return MACHINE_CONFIG_NAME( dmv_k801 ); |
| 188 | } |
| 189 | |
| 190 | machine_config_constructor dmv_k211_device::device_mconfig_additions() const |
| 191 | { |
| 192 | return MACHINE_CONFIG_NAME( dmv_k211 ); |
| 193 | } |
| 194 | |
| 195 | machine_config_constructor dmv_k212_device::device_mconfig_additions() const |
| 196 | { |
| 197 | return MACHINE_CONFIG_NAME( dmv_k212 ); |
| 198 | } |
| 199 | |
| 200 | machine_config_constructor dmv_k213_device::device_mconfig_additions() const |
| 201 | { |
| 202 | return MACHINE_CONFIG_NAME( dmv_k213 ); |
| 203 | } |
| 204 | |
| 205 | //------------------------------------------------- |
| 206 | // input_ports - device-specific input ports |
| 207 | //------------------------------------------------- |
| 208 | |
| 209 | ioport_constructor dmv_k801_device::device_input_ports() const |
| 210 | { |
| 211 | return INPUT_PORTS_NAME( dmv_k801 ); |
| 212 | } |
| 213 | |
| 214 | ioport_constructor dmv_k211_device::device_input_ports() const |
| 215 | { |
| 216 | return INPUT_PORTS_NAME( dmv_k211 ); |
| 217 | } |
| 218 | |
| 219 | ioport_constructor dmv_k212_device::device_input_ports() const |
| 220 | { |
| 221 | return INPUT_PORTS_NAME( dmv_k212 ); |
| 222 | } |
| 223 | |
| 224 | ioport_constructor dmv_k213_device::device_input_ports() const |
| 225 | { |
| 226 | return INPUT_PORTS_NAME( dmv_k213 ); |
| 227 | } |
| 228 | |
| 229 | WRITE_LINE_MEMBER(dmv_k801_device::epci_irq_w) |
| 230 | { |
| 231 | m_bus->m_out_irq_cb(state); |
| 232 | } |
| 233 | |
| 234 | void dmv_k801_device::io_read(address_space &space, int ifsel, offs_t offset, UINT8 &data) |
| 235 | { |
| 236 | UINT8 dsw = m_dsw->read() & 0x0f; |
| 237 | if ((dsw >> 1) == ifsel && BIT(offset, 3) == BIT(dsw, 0)) |
| 238 | { |
| 239 | if (offset & 0x04) |
| 240 | m_epci->write(space, offset & 0x03, data); |
| 241 | else |
| 242 | data = m_epci->read(space, offset & 0x03); |
| 243 | } |
| 244 | } |
| 245 | |
| 246 | void dmv_k801_device::io_write(address_space &space, int ifsel, offs_t offset, UINT8 data) |
| 247 | { |
| 248 | UINT8 dsw = m_dsw->read() & 0x0f; |
| 249 | if ((dsw >> 1) == ifsel && BIT(offset, 3) == BIT(dsw, 0)) |
| 250 | { |
| 251 | if (offset & 0x04) |
| 252 | m_epci->write(space, offset & 0x03, data); |
| 253 | else |
| 254 | data = m_epci->read(space, offset & 0x03); |
| 255 | } |
| 256 | } |
| 257 | |
| 258 | void dmv_k211_device::io_read(address_space &space, int ifsel, offs_t offset, UINT8 &data) |
| 259 | { |
| 260 | UINT8 jumpers = m_dsw->read() & 0x03; |
| 261 | if ((BIT(jumpers, 0) && ifsel == 0) || (BIT(jumpers, 1) && ifsel == 1)) |
| 262 | { |
| 263 | if (offset & 0x04) |
| 264 | m_epci->write(space, offset & 0x03, data); |
| 265 | else |
| 266 | data = m_epci->read(space, offset & 0x03); |
| 267 | } |
| 268 | } |
| 269 | |
| 270 | void dmv_k211_device::io_write(address_space &space, int ifsel, offs_t offset, UINT8 data) |
| 271 | { |
| 272 | UINT8 jumpers = m_dsw->read() & 0x03; |
| 273 | if ((BIT(jumpers, 0) && ifsel == 0) || (BIT(jumpers, 1) && ifsel == 1)) |
| 274 | { |
| 275 | if (offset & 0x04) |
| 276 | m_epci->write(space, offset & 0x03, data); |
| 277 | else |
| 278 | data = m_epci->read(space, offset & 0x03); |
| 279 | } |
| 280 | } |
trunk/src/emu/bus/dmv/k801.h
| r0 | r241996 | |
| 1 | // license:BSD-3-Clause |
| 2 | // copyright-holders:Sandro Ronco |
| 3 | #pragma once |
| 4 | |
| 5 | #ifndef __DMV_K801_H__ |
| 6 | #define __DMV_K801_H__ |
| 7 | |
| 8 | #include "emu.h" |
| 9 | #include "dmvbus.h" |
| 10 | #include "machine/mc2661.h" |
| 11 | #include "bus/rs232/rs232.h" |
| 12 | |
| 13 | |
| 14 | //************************************************************************** |
| 15 | // TYPE DEFINITIONS |
| 16 | //************************************************************************** |
| 17 | |
| 18 | // ======================> dmv_k801_device |
| 19 | |
| 20 | class dmv_k801_device : |
| 21 | public device_t, |
| 22 | public device_dmvslot_interface |
| 23 | { |
| 24 | public: |
| 25 | // construction/destruction |
| 26 | dmv_k801_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 27 | dmv_k801_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 | |
| 29 | // optional information overrides |
| 30 | virtual ioport_constructor device_input_ports() const; |
| 31 | virtual machine_config_constructor device_mconfig_additions() const; |
| 32 | |
| 33 | DECLARE_WRITE_LINE_MEMBER(epci_irq_w); |
| 34 | |
| 35 | protected: |
| 36 | // device-level overrides |
| 37 | virtual void device_start(); |
| 38 | virtual void device_reset(); |
| 39 | |
| 40 | // dmvcart_interface overrides |
| 41 | virtual void io_read(address_space &space, int ifsel, offs_t offset, UINT8 &data); |
| 42 | virtual void io_write(address_space &space, int ifsel, offs_t offset, UINT8 data); |
| 43 | |
| 44 | protected: |
| 45 | required_device<mc2661_device> m_epci; |
| 46 | required_ioport m_dsw; |
| 47 | dmvcart_slot_device * m_bus; |
| 48 | }; |
| 49 | |
| 50 | |
| 51 | // ======================> dmv_k211_device |
| 52 | |
| 53 | class dmv_k211_device : |
| 54 | public dmv_k801_device |
| 55 | { |
| 56 | public: |
| 57 | // construction/destruction |
| 58 | dmv_k211_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 59 | dmv_k211_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); |
| 60 | |
| 61 | // optional information overrides |
| 62 | virtual ioport_constructor device_input_ports() const; |
| 63 | virtual machine_config_constructor device_mconfig_additions() const; |
| 64 | |
| 65 | protected: |
| 66 | // dmvcart_interface overrides |
| 67 | virtual void io_read(address_space &space, int ifsel, offs_t offset, UINT8 &data); |
| 68 | virtual void io_write(address_space &space, int ifsel, offs_t offset, UINT8 data); |
| 69 | }; |
| 70 | |
| 71 | // ======================> dmv_k212_device |
| 72 | |
| 73 | class dmv_k212_device : |
| 74 | public dmv_k211_device |
| 75 | { |
| 76 | public: |
| 77 | // construction/destruction |
| 78 | dmv_k212_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 79 | |
| 80 | // optional information overrides |
| 81 | virtual ioport_constructor device_input_ports() const; |
| 82 | virtual machine_config_constructor device_mconfig_additions() const; |
| 83 | }; |
| 84 | |
| 85 | // ======================> dmv_k213_device |
| 86 | |
| 87 | class dmv_k213_device : |
| 88 | public dmv_k211_device |
| 89 | { |
| 90 | public: |
| 91 | // construction/destruction |
| 92 | dmv_k213_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 93 | |
| 94 | // optional information overrides |
| 95 | virtual ioport_constructor device_input_ports() const; |
| 96 | virtual machine_config_constructor device_mconfig_additions() const; |
| 97 | }; |
| 98 | |
| 99 | |
| 100 | // device type definition |
| 101 | extern const device_type DMV_K801; |
| 102 | extern const device_type DMV_K211; |
| 103 | extern const device_type DMV_K212; |
| 104 | extern const device_type DMV_K213; |
| 105 | |
| 106 | #endif /* __DMV_K801_H__ */ |
trunk/src/mess/drivers/dmv.c
| r241995 | r241996 | |
| 22 | 22 | |
| 23 | 23 | // expansion slots |
| 24 | 24 | #include "bus/dmv/dmvbus.h" |
| 25 | #include "bus/dmv/k210.h" |
| 25 | 26 | #include "bus/dmv/k220.h" |
| 26 | 27 | #include "bus/dmv/k230.h" |
| 27 | 28 | #include "bus/dmv/k233.h" |
| 29 | #include "bus/dmv/k801.h" |
| 28 | 30 | #include "bus/dmv/k803.h" |
| 29 | 31 | #include "bus/dmv/k806.h" |
| 30 | 32 | #include "bus/dmv/ram.h" |
| r241995 | r241996 | |
| 126 | 128 | DECLARE_WRITE_LINE_MEMBER(busint7_w) { update_busint(6, state); } |
| 127 | 129 | DECLARE_WRITE_LINE_MEMBER(busint7a_w) { update_busint(7, state); } |
| 128 | 130 | |
| 131 | void update_irqs(int slot, int state); |
| 132 | DECLARE_WRITE_LINE_MEMBER(irq2_w) { update_irqs(0, state); } |
| 133 | DECLARE_WRITE_LINE_MEMBER(irq2a_w) { update_irqs(1, state); } |
| 134 | DECLARE_WRITE_LINE_MEMBER(irq3_w) { update_irqs(2, state); } |
| 135 | DECLARE_WRITE_LINE_MEMBER(irq4_w) { update_irqs(3, state); } |
| 136 | DECLARE_WRITE_LINE_MEMBER(irq5_w) { update_irqs(4, state); } |
| 137 | DECLARE_WRITE_LINE_MEMBER(irq6_w) { update_irqs(5, state); } |
| 138 | DECLARE_WRITE_LINE_MEMBER(irq7_w) { update_irqs(6, state); } |
| 139 | DECLARE_WRITE_LINE_MEMBER(irq7a_w) { update_irqs(7, state); } |
| 140 | |
| 129 | 141 | DECLARE_FLOPPY_FORMATS( floppy_formats ); |
| 130 | 142 | |
| 131 | 143 | UINT8 program_read(address_space &space, int cas, offs_t offset); |
| r241995 | r241996 | |
| 158 | 170 | int m_sd_poll_state; |
| 159 | 171 | int m_floppy_motor; |
| 160 | 172 | int m_busint[8]; |
| 173 | int m_irqs[8]; |
| 161 | 174 | }; |
| 162 | 175 | |
| 163 | 176 | WRITE8_MEMBER(dmv_state::tc_set_w) |
| r241995 | r241996 | |
| 256 | 269 | if (m_fdc->get_irq()) |
| 257 | 270 | data |= 0x08; |
| 258 | 271 | |
| 272 | if (m_irqs[3]) |
| 273 | data |= 0x10; // IRQ 4 |
| 274 | |
| 275 | if (m_irqs[2]) |
| 276 | data |= 0x20; // IRQ 3 |
| 277 | |
| 278 | if (m_irqs[0]) |
| 279 | data |= 0x40; // IRQ 2 |
| 280 | |
| 259 | 281 | return data; |
| 260 | 282 | } |
| 261 | 283 | |
| r241995 | r241996 | |
| 405 | 427 | m_maincpu->set_input_line(0, new_state); |
| 406 | 428 | } |
| 407 | 429 | |
| 430 | void dmv_state::update_irqs(int slot, int state) |
| 431 | { |
| 432 | m_irqs[slot] = state; |
| 433 | |
| 434 | switch(slot) |
| 435 | { |
| 436 | case 1: // slot 2a |
| 437 | m_slot7->irq5_w(state); |
| 438 | m_slot7a->irq5_w(state); |
| 439 | break; |
| 440 | case 2: // slot 3 |
| 441 | m_slot7->irq3_w(state); |
| 442 | m_slot7a->irq3_w(state); |
| 443 | break; |
| 444 | case 3: // slot 4 |
| 445 | m_slot7->irq4_w(state); |
| 446 | m_slot7a->irq4_w(state); |
| 447 | break; |
| 448 | case 4: // slot 5 |
| 449 | m_slot7->irq7_w(state); |
| 450 | m_slot7a->irq7_w(state); |
| 451 | break; |
| 452 | } |
| 453 | } |
| 454 | |
| 408 | 455 | void dmv_state::program_write(address_space &space, int cas, offs_t offset, UINT8 data) |
| 409 | 456 | { |
| 410 | 457 | bool tramd = false; |
| r241995 | r241996 | |
| 530 | 577 | m_thold7 = 0; |
| 531 | 578 | m_dma_hrq = 0; |
| 532 | 579 | memset(m_busint, 0, sizeof(m_busint)); |
| 580 | memset(m_irqs, 0, sizeof(m_irqs)); |
| 533 | 581 | |
| 534 | 582 | update_halt_line(); |
| 535 | 583 | } |
| r241995 | r241996 | |
| 630 | 678 | SLOT_INTERFACE_END |
| 631 | 679 | |
| 632 | 680 | static SLOT_INTERFACE_START(dmv_slot2_6) |
| 681 | SLOT_INTERFACE("k210", DMV_K210) // K210 Centronics |
| 682 | SLOT_INTERFACE("k211", DMV_K211) // K211 RS-232 Communications Interface |
| 683 | SLOT_INTERFACE("k212", DMV_K212) // K212 RS-232 Printer Interface |
| 684 | SLOT_INTERFACE("k213", DMV_K213) // K213 RS-232 Plotter Interface |
| 633 | 685 | SLOT_INTERFACE("k233", DMV_K233) // K233 16K Shared RAM |
| 686 | SLOT_INTERFACE("k801", DMV_K801) // K801 RS-232 Switchable Interface |
| 634 | 687 | SLOT_INTERFACE("k803", DMV_K803) // K803 RTC module |
| 635 | 688 | SLOT_INTERFACE("k806", DMV_K806) // K806 Mouse module |
| 636 | 689 | SLOT_INTERFACE_END |
| r241995 | r241996 | |
| 719 | 772 | MCFG_DEVICE_ADD("slot2", DMVCART_SLOT, 0) |
| 720 | 773 | MCFG_DEVICE_SLOT_INTERFACE(dmv_slot2_6, NULL, false) |
| 721 | 774 | MCFG_DMVCART_SLOT_OUT_INT_CB(WRITELINE(dmv_state, busint2_w)) |
| 775 | MCFG_DMVCART_SLOT_OUT_IRQ_CB(WRITELINE(dmv_state, irq2_w)) |
| 722 | 776 | MCFG_DEVICE_ADD("slot2a", DMVCART_SLOT, 0) |
| 723 | 777 | MCFG_DEVICE_SLOT_INTERFACE(dmv_slot2a, NULL, false) |
| 724 | 778 | MCFG_DMVCART_SLOT_OUT_INT_CB(WRITELINE(dmv_state, busint2a_w)) |
| 779 | MCFG_DMVCART_SLOT_OUT_IRQ_CB(WRITELINE(dmv_state, irq2a_w)) |
| 725 | 780 | MCFG_DEVICE_ADD("slot3", DMVCART_SLOT, 0) |
| 726 | 781 | MCFG_DEVICE_SLOT_INTERFACE(dmv_slot2_6, NULL, false) |
| 727 | 782 | MCFG_DMVCART_SLOT_OUT_INT_CB(WRITELINE(dmv_state, busint3_w)) |
| 783 | MCFG_DMVCART_SLOT_OUT_IRQ_CB(WRITELINE(dmv_state, irq3_w)) |
| 728 | 784 | MCFG_DEVICE_ADD("slot4", DMVCART_SLOT, 0) |
| 729 | 785 | MCFG_DEVICE_SLOT_INTERFACE(dmv_slot2_6, NULL, false) |
| 730 | 786 | MCFG_DMVCART_SLOT_OUT_INT_CB(WRITELINE(dmv_state, busint4_w)) |
| 787 | MCFG_DMVCART_SLOT_OUT_IRQ_CB(WRITELINE(dmv_state, irq4_w)) |
| 731 | 788 | MCFG_DEVICE_ADD("slot5", DMVCART_SLOT, 0) |
| 732 | 789 | MCFG_DEVICE_SLOT_INTERFACE(dmv_slot2_6, NULL, false) |
| 733 | 790 | MCFG_DMVCART_SLOT_OUT_INT_CB(WRITELINE(dmv_state, busint5_w)) |
| 791 | MCFG_DMVCART_SLOT_OUT_IRQ_CB(WRITELINE(dmv_state, irq5_w)) |
| 734 | 792 | MCFG_DEVICE_ADD("slot6", DMVCART_SLOT, 0) |
| 735 | 793 | MCFG_DEVICE_SLOT_INTERFACE(dmv_slot2_6, NULL, false) |
| 736 | 794 | MCFG_DMVCART_SLOT_OUT_INT_CB(WRITELINE(dmv_state, busint6_w)) |
| 795 | MCFG_DMVCART_SLOT_OUT_IRQ_CB(WRITELINE(dmv_state, irq6_w)) |
| 737 | 796 | |
| 738 | 797 | MCFG_DEVICE_ADD("slot7", DMVCART_SLOT, 0) |
| 739 | 798 | MCFG_DEVICE_SLOT_INTERFACE(dmv_slot7, NULL, false) |
| 740 | 799 | MCFG_DMVCART_SLOT_PROGRAM_READWRITE_CB(READ8(dmv_state, exp_program_r), WRITE8(dmv_state, exp_program_w)) |
| 741 | 800 | MCFG_DMVCART_SLOT_OUT_THOLD_CB(WRITELINE(dmv_state, thold7_w)) |
| 742 | 801 | MCFG_DMVCART_SLOT_OUT_INT_CB(WRITELINE(dmv_state, busint7_w)) |
| 802 | MCFG_DMVCART_SLOT_OUT_IRQ_CB(WRITELINE(dmv_state, irq7_w)) |
| 743 | 803 | MCFG_DEVICE_ADD("slot7a", DMVCART_SLOT, 0) |
| 744 | 804 | MCFG_DEVICE_SLOT_INTERFACE(dmv_slot7a, "k230", false) |
| 745 | 805 | MCFG_DMVCART_SLOT_PROGRAM_READWRITE_CB(READ8(dmv_state, exp_program_r), WRITE8(dmv_state, exp_program_w)) |
| 746 | 806 | MCFG_DMVCART_SLOT_OUT_THOLD_CB(WRITELINE(dmv_state, thold7_w)) |
| 747 | 807 | MCFG_DMVCART_SLOT_OUT_INT_CB(WRITELINE(dmv_state, busint7a_w)) |
| 808 | MCFG_DMVCART_SLOT_OUT_IRQ_CB(WRITELINE(dmv_state, irq7a_w)) |
| 748 | 809 | |
| 749 | 810 | MCFG_SOFTWARE_LIST_ADD("flop_list", "dmv") |
| 750 | 811 | |