trunk/src/mess/machine/c2040.c
| r24569 | r24570 | |
| 101 | 101 | |
| 102 | 102 | |
| 103 | 103 | //------------------------------------------------- |
| 104 | // rom_region - device-specific ROM region |
| 105 | //------------------------------------------------- |
| 106 | |
| 107 | const rom_entry *c2040_device::device_rom_region() const |
| 108 | { |
| 109 | return ROM_NAME( c2040 ); |
| 110 | } |
| 111 | |
| 112 | |
| 113 | //------------------------------------------------- |
| 104 | 114 | // ROM( c4040 ) |
| 105 | 115 | //------------------------------------------------- |
| 106 | 116 | |
| r24569 | r24570 | |
| 126 | 136 | |
| 127 | 137 | |
| 128 | 138 | //------------------------------------------------- |
| 139 | // rom_region - device-specific ROM region |
| 140 | //------------------------------------------------- |
| 141 | |
| 142 | const rom_entry *c4040_device::device_rom_region() const |
| 143 | { |
| 144 | return ROM_NAME( c4040 ); |
| 145 | } |
| 146 | |
| 147 | |
| 148 | //------------------------------------------------- |
| 129 | 149 | // ROM( c8050 ) |
| 130 | 150 | //------------------------------------------------- |
| 131 | 151 | |
| r24569 | r24570 | |
| 175 | 195 | |
| 176 | 196 | |
| 177 | 197 | //------------------------------------------------- |
| 198 | // rom_region - device-specific ROM region |
| 199 | //------------------------------------------------- |
| 200 | |
| 201 | const rom_entry *c8050_device::device_rom_region() const |
| 202 | { |
| 203 | return ROM_NAME( c8050 ); |
| 204 | } |
| 205 | |
| 206 | |
| 207 | //------------------------------------------------- |
| 178 | 208 | // ROM( c8250lp ) |
| 179 | 209 | //------------------------------------------------- |
| 180 | 210 | |
| r24569 | r24570 | |
| 202 | 232 | |
| 203 | 233 | |
| 204 | 234 | //------------------------------------------------- |
| 235 | // rom_region - device-specific ROM region |
| 236 | //------------------------------------------------- |
| 237 | |
| 238 | const rom_entry *c8250lp_device::device_rom_region() const |
| 239 | { |
| 240 | return ROM_NAME( c8250lp ); |
| 241 | } |
| 242 | |
| 243 | |
| 244 | //------------------------------------------------- |
| 205 | 245 | // ROM( sfd1001 ) |
| 206 | 246 | //------------------------------------------------- |
| 207 | 247 | |
| r24569 | r24570 | |
| 223 | 263 | // rom_region - device-specific ROM region |
| 224 | 264 | //------------------------------------------------- |
| 225 | 265 | |
| 226 | | const rom_entry *c2040_device::device_rom_region() const |
| 266 | const rom_entry *sfd1001_device::device_rom_region() const |
| 227 | 267 | { |
| 228 | | switch (m_variant) |
| 229 | | { |
| 230 | | default: |
| 231 | | case TYPE_2040: |
| 232 | | case TYPE_3040: |
| 233 | | return ROM_NAME( c2040 ); |
| 234 | | |
| 235 | | case TYPE_4040: |
| 236 | | return ROM_NAME( c4040 ); |
| 237 | | |
| 238 | | case TYPE_8050: |
| 239 | | case TYPE_8250: |
| 240 | | return ROM_NAME( c8050 ); |
| 241 | | |
| 242 | | case TYPE_8250LP: |
| 243 | | return ROM_NAME( c8250lp ); |
| 244 | | |
| 245 | | case TYPE_SFD1001: |
| 246 | | return ROM_NAME( sfd1001 ); |
| 247 | | } |
| 268 | return ROM_NAME( sfd1001 ); |
| 248 | 269 | } |
| 249 | 270 | |
| 250 | 271 | |
| r24569 | r24570 | |
| 884 | 905 | data |= 0x10; |
| 885 | 906 | |
| 886 | 907 | // single/dual sided |
| 887 | | if (m_variant == c2040_device::TYPE_8050) |
| 908 | if (!m_double_sided) |
| 888 | 909 | { |
| 889 | 910 | data |= 0x40; |
| 890 | 911 | } |
| r24569 | r24570 | |
| 910 | 931 | */ |
| 911 | 932 | |
| 912 | 933 | // drive select |
| 913 | | if ((m_variant == c2040_device::TYPE_8050) || |
| 914 | | (m_variant == c2040_device::TYPE_8250)) |
| 934 | if (m_image1) |
| 915 | 935 | { |
| 916 | 936 | m_drive = BIT(data, 0); |
| 917 | 937 | } |
| r24569 | r24570 | |
| 926 | 946 | } |
| 927 | 947 | |
| 928 | 948 | // side select |
| 929 | | if ((m_variant == c2040_device::TYPE_8250) || |
| 930 | | (m_variant == c2040_device::TYPE_SFD1001)) |
| 949 | if (m_double_sided) |
| 931 | 950 | { |
| 932 | 951 | m_side = !BIT(data, 4); |
| 933 | 952 | } |
| r24569 | r24570 | |
| 1084 | 1103 | |
| 1085 | 1104 | |
| 1086 | 1105 | //------------------------------------------------- |
| 1106 | // machine_config_additions - device-specific |
| 1107 | // machine configurations |
| 1108 | //------------------------------------------------- |
| 1109 | |
| 1110 | machine_config_constructor c2040_device::device_mconfig_additions() const |
| 1111 | { |
| 1112 | return MACHINE_CONFIG_NAME( c2040 ); |
| 1113 | } |
| 1114 | |
| 1115 | |
| 1116 | //------------------------------------------------- |
| 1087 | 1117 | // MACHINE_CONFIG_FRAGMENT( c4040 ) |
| 1088 | 1118 | //------------------------------------------------- |
| 1089 | 1119 | |
| r24569 | r24570 | |
| 1107 | 1137 | |
| 1108 | 1138 | |
| 1109 | 1139 | //------------------------------------------------- |
| 1140 | // machine_config_additions - device-specific |
| 1141 | // machine configurations |
| 1142 | //------------------------------------------------- |
| 1143 | |
| 1144 | machine_config_constructor c4040_device::device_mconfig_additions() const |
| 1145 | { |
| 1146 | return MACHINE_CONFIG_NAME( c4040 ); |
| 1147 | } |
| 1148 | |
| 1149 | |
| 1150 | //------------------------------------------------- |
| 1110 | 1151 | // MACHINE_CONFIG_FRAGMENT( c8050 ) |
| 1111 | 1152 | //------------------------------------------------- |
| 1112 | 1153 | |
| r24569 | r24570 | |
| 1130 | 1171 | |
| 1131 | 1172 | |
| 1132 | 1173 | //------------------------------------------------- |
| 1174 | // machine_config_additions - device-specific |
| 1175 | // machine configurations |
| 1176 | //------------------------------------------------- |
| 1177 | |
| 1178 | machine_config_constructor c8050_device::device_mconfig_additions() const |
| 1179 | { |
| 1180 | return MACHINE_CONFIG_NAME( c8050 ); |
| 1181 | } |
| 1182 | |
| 1183 | |
| 1184 | //------------------------------------------------- |
| 1133 | 1185 | // MACHINE_CONFIG_FRAGMENT( c8250 ) |
| 1134 | 1186 | //------------------------------------------------- |
| 1135 | 1187 | |
| r24569 | r24570 | |
| 1153 | 1205 | |
| 1154 | 1206 | |
| 1155 | 1207 | //------------------------------------------------- |
| 1208 | // machine_config_additions - device-specific |
| 1209 | // machine configurations |
| 1210 | //------------------------------------------------- |
| 1211 | |
| 1212 | machine_config_constructor c8250_device::device_mconfig_additions() const |
| 1213 | { |
| 1214 | return MACHINE_CONFIG_NAME( c8250 ); |
| 1215 | } |
| 1216 | |
| 1217 | |
| 1218 | //------------------------------------------------- |
| 1156 | 1219 | // MACHINE_CONFIG_FRAGMENT( c8250lp ) |
| 1157 | 1220 | //------------------------------------------------- |
| 1158 | 1221 | |
| r24569 | r24570 | |
| 1176 | 1239 | |
| 1177 | 1240 | |
| 1178 | 1241 | //------------------------------------------------- |
| 1242 | // machine_config_additions - device-specific |
| 1243 | // machine configurations |
| 1244 | //------------------------------------------------- |
| 1245 | |
| 1246 | machine_config_constructor c8250lp_device::device_mconfig_additions() const |
| 1247 | { |
| 1248 | return MACHINE_CONFIG_NAME( c8250lp ); |
| 1249 | } |
| 1250 | |
| 1251 | |
| 1252 | //------------------------------------------------- |
| 1179 | 1253 | // MACHINE_CONFIG_FRAGMENT( sfd1001 ) |
| 1180 | 1254 | //------------------------------------------------- |
| 1181 | 1255 | |
| r24569 | r24570 | |
| 1203 | 1277 | // machine configurations |
| 1204 | 1278 | //------------------------------------------------- |
| 1205 | 1279 | |
| 1206 | | machine_config_constructor c2040_device::device_mconfig_additions() const |
| 1280 | machine_config_constructor sfd1001_device::device_mconfig_additions() const |
| 1207 | 1281 | { |
| 1208 | | switch (m_variant) |
| 1209 | | { |
| 1210 | | default: |
| 1211 | | case TYPE_2040: |
| 1212 | | case TYPE_3040: |
| 1213 | | return MACHINE_CONFIG_NAME( c2040 ); |
| 1214 | | |
| 1215 | | case TYPE_4040: |
| 1216 | | return MACHINE_CONFIG_NAME( c4040 ); |
| 1217 | | |
| 1218 | | case TYPE_8050: |
| 1219 | | return MACHINE_CONFIG_NAME( c8050 ); |
| 1220 | | |
| 1221 | | case TYPE_8250: |
| 1222 | | return MACHINE_CONFIG_NAME( c8250 ); |
| 1223 | | |
| 1224 | | case TYPE_8250LP: |
| 1225 | | return MACHINE_CONFIG_NAME( c8250lp ); |
| 1226 | | |
| 1227 | | case TYPE_SFD1001: |
| 1228 | | return MACHINE_CONFIG_NAME( sfd1001 ); |
| 1229 | | } |
| 1282 | return MACHINE_CONFIG_NAME( sfd1001 ); |
| 1230 | 1283 | } |
| 1231 | 1284 | |
| 1232 | 1285 | |
| r24569 | r24570 | |
| 1418 | 1471 | // c2040_device - constructor |
| 1419 | 1472 | //------------------------------------------------- |
| 1420 | 1473 | |
| 1421 | | c2040_device::c2040_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT32 variant, const char *shortname, const char *source) |
| 1474 | c2040_device::c2040_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) |
| 1422 | 1475 | : device_t(mconfig, type, name, tag, owner, clock, shortname, source), |
| 1423 | 1476 | device_ieee488_interface(mconfig, *this), |
| 1424 | 1477 | m_maincpu(*this, M6502_TAG), |
| r24569 | r24570 | |
| 1442 | 1495 | m_ready(0), |
| 1443 | 1496 | m_mode(0), |
| 1444 | 1497 | m_rw(0), |
| 1445 | | m_miot_irq(CLEAR_LINE), |
| 1446 | | m_variant(variant) |
| 1498 | m_miot_irq(CLEAR_LINE) |
| 1447 | 1499 | { |
| 1448 | 1500 | for (int i = 0; i < 2; i++) |
| 1449 | 1501 | { |
| r24569 | r24570 | |
| 1480 | 1532 | m_ready(0), |
| 1481 | 1533 | m_mode(0), |
| 1482 | 1534 | m_rw(0), |
| 1483 | | m_miot_irq(CLEAR_LINE), |
| 1484 | | m_variant(TYPE_2040) |
| 1535 | m_miot_irq(CLEAR_LINE) |
| 1485 | 1536 | { |
| 1486 | 1537 | for (int i = 0; i < 2; i++) |
| 1487 | 1538 | { |
| r24569 | r24570 | |
| 1499 | 1550 | //------------------------------------------------- |
| 1500 | 1551 | |
| 1501 | 1552 | c3040_device::c3040_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 1502 | | : c2040_device(mconfig, C3040, "C3040", tag, owner, clock, TYPE_3040, "c3040", __FILE__) { } |
| 1553 | : c2040_device(mconfig, C3040, "C3040", tag, owner, clock, "c3040", __FILE__) { } |
| 1503 | 1554 | |
| 1504 | 1555 | |
| 1505 | 1556 | //------------------------------------------------- |
| r24569 | r24570 | |
| 1507 | 1558 | //------------------------------------------------- |
| 1508 | 1559 | |
| 1509 | 1560 | c4040_device::c4040_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 1510 | | : c2040_device(mconfig, C4040, "C4040", tag, owner, clock, TYPE_4040, "c4040", __FILE__) { } |
| 1561 | : c2040_device(mconfig, C4040, "C4040", tag, owner, clock, "c4040", __FILE__) { } |
| 1511 | 1562 | |
| 1512 | 1563 | |
| 1513 | 1564 | //------------------------------------------------- |
| 1514 | 1565 | // c8050_device - constructor |
| 1515 | 1566 | //------------------------------------------------- |
| 1516 | 1567 | |
| 1517 | | c8050_device::c8050_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT32 variant, const char *shortname, const char *source) |
| 1518 | | : c2040_device(mconfig, type, name, tag, owner, clock, variant, shortname, source) { } |
| 1568 | c8050_device::c8050_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, bool double_sided, const char *shortname, const char *source) |
| 1569 | : c2040_device(mconfig, type, name, tag, owner, clock, shortname, source), |
| 1570 | m_double_sided(double_sided) |
| 1571 | { |
| 1572 | } |
| 1519 | 1573 | |
| 1520 | 1574 | c8050_device::c8050_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 1521 | | : c2040_device(mconfig, C8050, "C8050", tag, owner, clock, TYPE_8050, "c8050", __FILE__) { } |
| 1575 | : c2040_device(mconfig, C8050, "C8050", tag, owner, clock, "c8050", __FILE__), |
| 1576 | m_double_sided(false) |
| 1577 | { |
| 1578 | } |
| 1522 | 1579 | |
| 1523 | 1580 | |
| 1524 | 1581 | //------------------------------------------------- |
| r24569 | r24570 | |
| 1526 | 1583 | //------------------------------------------------- |
| 1527 | 1584 | |
| 1528 | 1585 | c8250_device::c8250_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 1529 | | : c8050_device(mconfig, C8250, "C8250", tag, owner, clock, TYPE_8250, "c8250", __FILE__) { } |
| 1586 | : c8050_device(mconfig, C8250, "C8250", tag, owner, clock, true, "c8250", __FILE__) { } |
| 1530 | 1587 | |
| 1531 | 1588 | |
| 1532 | 1589 | //------------------------------------------------- |
| r24569 | r24570 | |
| 1534 | 1591 | //------------------------------------------------- |
| 1535 | 1592 | |
| 1536 | 1593 | c8250lp_device::c8250lp_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 1537 | | : c8050_device(mconfig, C8250LP, "C8250LP", tag, owner, clock, TYPE_8250LP, "c8250lp", __FILE__) { } |
| 1594 | : c8050_device(mconfig, C8250LP, "C8250LP", tag, owner, clock, true, "c8250lp", __FILE__) { } |
| 1538 | 1595 | |
| 1539 | 1596 | |
| 1540 | 1597 | //------------------------------------------------- |
| r24569 | r24570 | |
| 1542 | 1599 | //------------------------------------------------- |
| 1543 | 1600 | |
| 1544 | 1601 | sfd1001_device::sfd1001_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 1545 | | : c8050_device(mconfig, SFD1001, "SFD1001", tag, owner, clock, TYPE_SFD1001, "sfd1001", __FILE__) { } |
| 1602 | : c8050_device(mconfig, SFD1001, "SFD1001", tag, owner, clock, true, "sfd1001", __FILE__) { } |
| 1546 | 1603 | |
| 1547 | 1604 | |
| 1548 | 1605 | //------------------------------------------------- |
| r24569 | r24570 | |
| 1674 | 1731 | m_via->write_ca1(ready); |
| 1675 | 1732 | m_via->write_cb1(ERROR); |
| 1676 | 1733 | |
| 1677 | | if ((m_variant == c2040_device::TYPE_8050) || |
| 1678 | | (m_variant == c2040_device::TYPE_8250) || |
| 1679 | | (m_variant == c2040_device::TYPE_SFD1001)) |
| 1680 | | { |
| 1681 | | m_fdccpu->set_input_line(M6502_SET_OVERFLOW, ready ? CLEAR_LINE : ASSERT_LINE); |
| 1682 | | } |
| 1734 | this->byte_ready(ready); |
| 1683 | 1735 | } |
| 1684 | 1736 | } |
| 1685 | 1737 | |
| 1738 | void c8050_device::byte_ready(int state) |
| 1739 | { |
| 1740 | m_fdccpu->set_input_line(M6502_SET_OVERFLOW, state ? CLEAR_LINE : ASSERT_LINE); |
| 1741 | } |
| 1686 | 1742 | |
| 1743 | |
| 1744 | |
| 1687 | 1745 | //------------------------------------------------- |
| 1688 | 1746 | // ieee488_atn - |
| 1689 | 1747 | //------------------------------------------------- |
trunk/src/mess/machine/c2040.h
| r24569 | r24570 | |
| 36 | 36 | public device_ieee488_interface |
| 37 | 37 | { |
| 38 | 38 | public: |
| 39 | | enum |
| 40 | | { |
| 41 | | TYPE_2040, |
| 42 | | TYPE_3040, |
| 43 | | TYPE_4040, |
| 44 | | TYPE_8050, |
| 45 | | TYPE_8250, |
| 46 | | TYPE_8250LP, |
| 47 | | TYPE_SFD1001 |
| 48 | | }; |
| 49 | | |
| 50 | 39 | // construction/destruction |
| 51 | | c2040_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT32 variant, const char *shortname, const char *source); |
| 40 | c2040_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); |
| 52 | 41 | c2040_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 53 | 42 | |
| 43 | // optional information overrides |
| 44 | virtual const rom_entry *device_rom_region() const; |
| 45 | virtual machine_config_constructor device_mconfig_additions() const; |
| 46 | |
| 54 | 47 | // not really public |
| 55 | 48 | static void on_disk0_change(device_image_interface &image); |
| 56 | 49 | static void on_disk1_change(device_image_interface &image); |
| r24569 | r24570 | |
| 72 | 65 | DECLARE_READ8_MEMBER( miot_pb_r ); |
| 73 | 66 | DECLARE_WRITE8_MEMBER( miot_pb_w ); |
| 74 | 67 | |
| 75 | | // optional information overrides |
| 76 | | virtual const rom_entry *device_rom_region() const; |
| 77 | | virtual machine_config_constructor device_mconfig_additions() const; |
| 78 | | |
| 79 | 68 | protected: |
| 80 | 69 | // device-level overrides |
| 81 | 70 | virtual void device_start(); |
| r24569 | r24570 | |
| 86 | 75 | virtual void ieee488_atn(int state); |
| 87 | 76 | virtual void ieee488_ifc(int state); |
| 88 | 77 | |
| 78 | virtual void byte_ready(int state) { } |
| 89 | 79 | inline void update_ieee_signals(); |
| 90 | 80 | inline void update_gcr_data(); |
| 91 | 81 | inline void read_current_track(int unit); |
| r24569 | r24570 | |
| 143 | 133 | |
| 144 | 134 | // timers |
| 145 | 135 | emu_timer *m_bit_timer; |
| 146 | | |
| 147 | | int m_variant; |
| 148 | 136 | }; |
| 149 | 137 | |
| 150 | 138 | |
| r24569 | r24570 | |
| 165 | 153 | public: |
| 166 | 154 | // construction/destruction |
| 167 | 155 | c4040_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 156 | |
| 157 | // optional information overrides |
| 158 | virtual const rom_entry *device_rom_region() const; |
| 159 | virtual machine_config_constructor device_mconfig_additions() const; |
| 168 | 160 | }; |
| 169 | 161 | |
| 170 | 162 | |
| r24569 | r24570 | |
| 175 | 167 | public: |
| 176 | 168 | // construction/destruction |
| 177 | 169 | c8050_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 178 | | c8050_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT32 variant, const char *shortname, const char *source); |
| 170 | c8050_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, bool double_sided, const char *shortname, const char *source); |
| 179 | 171 | |
| 172 | // optional information overrides |
| 173 | virtual const rom_entry *device_rom_region() const; |
| 174 | virtual machine_config_constructor device_mconfig_additions() const; |
| 175 | |
| 180 | 176 | DECLARE_READ8_MEMBER( via_pb_r ); |
| 181 | 177 | DECLARE_WRITE8_MEMBER( via_pb_w ); |
| 182 | 178 | DECLARE_READ8_MEMBER( miot_pb_r ); |
| 183 | 179 | DECLARE_WRITE8_MEMBER( miot_pb_w ); |
| 180 | |
| 181 | protected: |
| 182 | virtual void byte_ready(int state); |
| 183 | |
| 184 | bool m_double_sided; |
| 184 | 185 | }; |
| 185 | 186 | |
| 186 | 187 | |
| r24569 | r24570 | |
| 191 | 192 | public: |
| 192 | 193 | // construction/destruction |
| 193 | 194 | c8250_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 195 | |
| 196 | // optional information overrides |
| 197 | virtual machine_config_constructor device_mconfig_additions() const; |
| 194 | 198 | }; |
| 195 | 199 | |
| 196 | 200 | |
| r24569 | r24570 | |
| 201 | 205 | public: |
| 202 | 206 | // construction/destruction |
| 203 | 207 | c8250lp_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 208 | |
| 209 | // optional information overrides |
| 210 | virtual const rom_entry *device_rom_region() const; |
| 211 | virtual machine_config_constructor device_mconfig_additions() const; |
| 204 | 212 | }; |
| 205 | 213 | |
| 206 | 214 | |
| r24569 | r24570 | |
| 211 | 219 | public: |
| 212 | 220 | // construction/destruction |
| 213 | 221 | sfd1001_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 222 | |
| 223 | // optional information overrides |
| 224 | virtual const rom_entry *device_rom_region() const; |
| 225 | virtual machine_config_constructor device_mconfig_additions() const; |
| 214 | 226 | }; |
| 215 | 227 | |
| 216 | 228 | |