src/mess/machine/a2ssc.c
| r0 | r15002 | |
| 1 | /********************************************************************* |
| 2 | |
| 3 | a2ssc.c |
| 4 | |
| 5 | Apple II Super Serial Card |
| 6 | |
| 7 | *********************************************************************/ |
| 8 | |
| 9 | #include "emu.h" |
| 10 | #include "includes/apple2.h" |
| 11 | #include "machine/a2ssc.h" |
| 12 | |
| 13 | |
| 14 | /*************************************************************************** |
| 15 | PARAMETERS |
| 16 | ***************************************************************************/ |
| 17 | |
| 18 | //************************************************************************** |
| 19 | // GLOBAL VARIABLES |
| 20 | //************************************************************************** |
| 21 | |
| 22 | const device_type A2BUS_SSC = &device_creator<a2bus_ssc_device>; |
| 23 | |
| 24 | #define SSC_ROM_REGION "ssc_rom" |
| 25 | #define SSC_ACIA_TAG "ssc_acia" |
| 26 | |
| 27 | |
| 28 | MACHINE_CONFIG_FRAGMENT( ssc ) |
| 29 | MCFG_ACIA6551_ADD(SSC_ACIA_TAG) |
| 30 | MACHINE_CONFIG_END |
| 31 | |
| 32 | ROM_START( ssc ) |
| 33 | ROM_REGION(0x000800, SSC_ROM_REGION, 0) |
| 34 | ROM_LOAD( "341-0065-a.bin", 0x000000, 0x000800, CRC(b7539d4c) SHA1(6dab633470c6bc4cb3e81d09fda46597caf8ee57) ) |
| 35 | ROM_END |
| 36 | |
| 37 | static INPUT_PORTS_START( ssc ) |
| 38 | PORT_START("DSW1") |
| 39 | PORT_DIPNAME( 0xf0, 0xf0, "Baud rate" ) |
| 40 | PORT_DIPSETTING( 0x00, "Undefined/115200" ) |
| 41 | PORT_DIPSETTING( 0x10, "50" ) |
| 42 | PORT_DIPSETTING( 0x20, "75" ) |
| 43 | PORT_DIPSETTING( 0x30, "110" ) |
| 44 | PORT_DIPSETTING( 0x40, "135" ) |
| 45 | PORT_DIPSETTING( 0x50, "150" ) |
| 46 | PORT_DIPSETTING( 0x60, "300" ) |
| 47 | PORT_DIPSETTING( 0x70, "600" ) |
| 48 | PORT_DIPSETTING( 0x80, "1200" ) |
| 49 | PORT_DIPSETTING( 0x90, "1800" ) |
| 50 | PORT_DIPSETTING( 0xa0, "2400" ) |
| 51 | PORT_DIPSETTING( 0xb0, "3600" ) |
| 52 | PORT_DIPSETTING( 0xc0, "4800" ) |
| 53 | PORT_DIPSETTING( 0xd0, "7200" ) |
| 54 | PORT_DIPSETTING( 0xe0, "9600" ) |
| 55 | PORT_DIPSETTING( 0xf0, "19200" ) |
| 56 | |
| 57 | PORT_DIPNAME( 0x0c, 0x00, "Mode" ) |
| 58 | PORT_DIPSETTING( 0x00, "Communications Mode" ) |
| 59 | PORT_DIPSETTING( 0x04, "SIC P8 Emulation Mode" ) |
| 60 | PORT_DIPSETTING( 0x08, "Printer Mode" ) |
| 61 | PORT_DIPSETTING( 0x0c, "SIC P8A Emulation Mode" ) |
| 62 | |
| 63 | PORT_DIPNAME( 0x01, 0x00, "Clear To Send" ) |
| 64 | PORT_DIPSETTING( 0x00, "Normal Clear To Send" ) |
| 65 | PORT_DIPSETTING( 0x01, "Secondary Clear To Send" ) |
| 66 | |
| 67 | PORT_START("DSW2") |
| 68 | PORT_DIPNAME( 0xc0, 0x00, "Format" ) |
| 69 | PORT_DIPSETTING( 0x00, "8 data, 1 stop") |
| 70 | PORT_DIPSETTING( 0x40, "7 data, 1 stop") |
| 71 | PORT_DIPSETTING( 0x80, "8 data, 2 stop") |
| 72 | PORT_DIPSETTING( 0xc0, "7 data, 2 stop") |
| 73 | |
| 74 | PORT_DIPNAME( 0x30, 0x00, "Parity" ) |
| 75 | PORT_DIPSETTING( 0x00, "None") |
| 76 | PORT_DIPSETTING( 0x10, "Odd") |
| 77 | PORT_DIPSETTING( 0x30, "Even") |
| 78 | |
| 79 | PORT_DIPNAME( 0x08, 0x08, "End of Line" ) |
| 80 | PORT_DIPSETTING( 0x00, "Add LF after CR") |
| 81 | PORT_DIPSETTING( 0x08, "Don't add LF after CR") |
| 82 | |
| 83 | PORT_DIPNAME( 0x04, 0x04, "Interrupts" ) |
| 84 | PORT_DIPSETTING( 0x00, "On") |
| 85 | PORT_DIPSETTING( 0x04, "Off") |
| 86 | INPUT_PORTS_END |
| 87 | |
| 88 | //------------------------------------------------- |
| 89 | // input_ports - device-specific input ports |
| 90 | //------------------------------------------------- |
| 91 | |
| 92 | ioport_constructor a2bus_ssc_device::device_input_ports() const |
| 93 | { |
| 94 | return INPUT_PORTS_NAME( ssc ); |
| 95 | } |
| 96 | |
| 97 | //------------------------------------------------- |
| 98 | // machine_config_additions - device-specific |
| 99 | // machine configurations |
| 100 | //------------------------------------------------- |
| 101 | |
| 102 | machine_config_constructor a2bus_ssc_device::device_mconfig_additions() const |
| 103 | { |
| 104 | return MACHINE_CONFIG_NAME( ssc ); |
| 105 | } |
| 106 | |
| 107 | //------------------------------------------------- |
| 108 | // rom_region - device-specific ROM region |
| 109 | //------------------------------------------------- |
| 110 | |
| 111 | const rom_entry *a2bus_ssc_device::device_rom_region() const |
| 112 | { |
| 113 | return ROM_NAME( ssc ); |
| 114 | } |
| 115 | |
| 116 | //************************************************************************** |
| 117 | // LIVE DEVICE |
| 118 | //************************************************************************** |
| 119 | |
| 120 | a2bus_ssc_device::a2bus_ssc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : |
| 121 | device_t(mconfig, A2BUS_SSC, "Apple Super Serial Card", tag, owner, clock), |
| 122 | device_a2bus_card_interface(mconfig, *this), |
| 123 | m_acia(*this, SSC_ACIA_TAG) |
| 124 | { |
| 125 | m_shortname = "a2ssc"; |
| 126 | } |
| 127 | |
| 128 | a2bus_ssc_device::a2bus_ssc_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) : |
| 129 | device_t(mconfig, type, name, tag, owner, clock), |
| 130 | device_a2bus_card_interface(mconfig, *this), |
| 131 | m_acia(*this, SSC_ACIA_TAG) |
| 132 | { |
| 133 | m_shortname = "a2ssc"; |
| 134 | } |
| 135 | |
| 136 | //------------------------------------------------- |
| 137 | // device_start - device-specific startup |
| 138 | //------------------------------------------------- |
| 139 | |
| 140 | void a2bus_ssc_device::device_start() |
| 141 | { |
| 142 | // set_a2bus_device makes m_slot valid |
| 143 | set_a2bus_device(); |
| 144 | |
| 145 | astring tempstring; |
| 146 | m_rom = device().machine().root_device().memregion(this->subtag(tempstring, SSC_ROM_REGION))->base(); |
| 147 | } |
| 148 | |
| 149 | void a2bus_ssc_device::device_reset() |
| 150 | { |
| 151 | } |
| 152 | |
| 153 | /*------------------------------------------------- |
| 154 | read_cnxx - called for reads from this card's cnxx space |
| 155 | -------------------------------------------------*/ |
| 156 | |
| 157 | UINT8 a2bus_ssc_device::read_cnxx(address_space &space, UINT8 offset) |
| 158 | { |
| 159 | return m_rom[offset+0x700]; |
| 160 | } |
| 161 | |
| 162 | /*------------------------------------------------- |
| 163 | read_c800 - called for reads from this card's c800 space |
| 164 | -------------------------------------------------*/ |
| 165 | |
| 166 | UINT8 a2bus_ssc_device::read_c800(address_space &space, UINT16 offset) |
| 167 | { |
| 168 | return m_rom[offset]; |
| 169 | } |
| 170 | |
| 171 | /*------------------------------------------------- |
| 172 | read_c0nx - called for reads from this card's c0nx space |
| 173 | -------------------------------------------------*/ |
| 174 | |
| 175 | UINT8 a2bus_ssc_device::read_c0nx(address_space &space, UINT8 offset) |
| 176 | { |
| 177 | // dips at C0n1/C0n2, ACIA at C0n8/9/A/B |
| 178 | |
| 179 | switch (offset) |
| 180 | { |
| 181 | case 1: |
| 182 | return input_port_read(device(), "DSW1"); |
| 183 | case 2: |
| 184 | return input_port_read(device(), "DSW2"); |
| 185 | |
| 186 | case 8: |
| 187 | case 9: |
| 188 | case 0xa: |
| 189 | case 0xb: |
| 190 | return m_acia->read(space, offset-8); |
| 191 | |
| 192 | } |
| 193 | |
| 194 | return 0; |
| 195 | } |
| 196 | |
| 197 | /*------------------------------------------------- |
| 198 | write_c0nx - called for writes to this card's c0nx space |
| 199 | -------------------------------------------------*/ |
| 200 | |
| 201 | void a2bus_ssc_device::write_c0nx(address_space &space, UINT8 offset, UINT8 data) |
| 202 | { |
| 203 | switch (offset) |
| 204 | { |
| 205 | case 8: |
| 206 | case 9: |
| 207 | case 0xa: |
| 208 | case 0xb: |
| 209 | m_acia->write(space, offset-8, data); |
| 210 | break; |
| 211 | |
| 212 | } |
| 213 | } |
| 214 | |
src/mess/machine/a2ssc.h
| r0 | r15002 | |
| 1 | /********************************************************************* |
| 2 | |
| 3 | a2ssc.h |
| 4 | |
| 5 | Apple II Super Serial Card |
| 6 | |
| 7 | *********************************************************************/ |
| 8 | |
| 9 | #ifndef __A2BUS_SSC__ |
| 10 | #define __A2BUS_SSC__ |
| 11 | |
| 12 | #include "emu.h" |
| 13 | #include "machine/a2bus.h" |
| 14 | #include "machine/6551acia.h" |
| 15 | |
| 16 | //************************************************************************** |
| 17 | // TYPE DEFINITIONS |
| 18 | //************************************************************************** |
| 19 | |
| 20 | class a2bus_ssc_device: |
| 21 | public device_t, |
| 22 | public device_a2bus_card_interface |
| 23 | { |
| 24 | public: |
| 25 | // construction/destruction |
| 26 | a2bus_ssc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 27 | a2bus_ssc_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock); |
| 28 | |
| 29 | // optional information overrides |
| 30 | virtual machine_config_constructor device_mconfig_additions() const; |
| 31 | virtual const rom_entry *device_rom_region() const; |
| 32 | virtual ioport_constructor device_input_ports() const; |
| 33 | |
| 34 | protected: |
| 35 | virtual void device_start(); |
| 36 | virtual void device_reset(); |
| 37 | |
| 38 | virtual UINT8 read_c0nx(address_space &space, UINT8 offset); |
| 39 | virtual void write_c0nx(address_space &space, UINT8 offset, UINT8 data); |
| 40 | virtual UINT8 read_cnxx(address_space &space, UINT8 offset); |
| 41 | virtual UINT8 read_c800(address_space &space, UINT16 offset); |
| 42 | |
| 43 | required_device<acia6551_device> m_acia; |
| 44 | |
| 45 | private: |
| 46 | UINT8 *m_rom; |
| 47 | }; |
| 48 | |
| 49 | // device type definition |
| 50 | extern const device_type A2BUS_SSC; |
| 51 | |
| 52 | #endif /* __A2BUS_SSC__ */ |
| 53 | |