trunk/src/mess/machine/smc92x4.c
| r28716 | r28717 | |
| 188 | 188 | #define LOG logerror |
| 189 | 189 | |
| 190 | 190 | smc92x4_device::smc92x4_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 191 | | : device_t(mconfig, SMC92X4, "SMC 9224/9234 Hard/Floppy Disk Controller", tag, owner, clock, "smc92x4", __FILE__) |
| 191 | : device_t(mconfig, SMC92X4, "SMC 9224/9234 Hard/Floppy Disk Controller", tag, owner, clock, "smc92x4", __FILE__), |
| 192 | m_out_intrq(*this), |
| 193 | m_out_dip(*this), |
| 194 | m_out_auxbus(*this), |
| 195 | m_in_auxbus(*this), |
| 196 | m_in_dma(*this), |
| 197 | m_out_dma(*this) |
| 192 | 198 | { |
| 193 | 199 | } |
| 194 | 200 | |
| r28716 | r28717 | |
| 272 | 278 | */ |
| 273 | 279 | void smc92x4_device::set_dma_address(int pos2316, int pos1508, int pos0700) |
| 274 | 280 | { |
| 275 | | m_out_auxbus(OUTPUT_DMA_ADDR, m_register_r[pos2316]); |
| 276 | | m_out_auxbus(OUTPUT_DMA_ADDR, m_register_r[pos1508]); |
| 277 | | m_out_auxbus(OUTPUT_DMA_ADDR, m_register_r[pos0700]); |
| 281 | m_out_auxbus((offs_t)OUTPUT_DMA_ADDR, m_register_r[pos2316]); |
| 282 | m_out_auxbus((offs_t)OUTPUT_DMA_ADDR, m_register_r[pos1508]); |
| 283 | m_out_auxbus((offs_t)OUTPUT_DMA_ADDR, m_register_r[pos0700]); |
| 278 | 284 | } |
| 279 | 285 | |
| 280 | 286 | void smc92x4_device::dma_add_offset(int offset) |
| r28716 | r28717 | |
| 314 | 320 | void smc92x4_device::sync_latches_out() |
| 315 | 321 | { |
| 316 | 322 | m_output1 = (m_output1 & 0xf0) | (m_register_w[RETRY_COUNT]&0x0f); |
| 317 | | m_out_auxbus(OUTPUT_OUTPUT1, m_output1); |
| 318 | | m_out_auxbus(OUTPUT_OUTPUT2, m_output2); |
| 323 | m_out_auxbus((offs_t)OUTPUT_OUTPUT1, m_output1); |
| 324 | m_out_auxbus((offs_t)OUTPUT_OUTPUT2, m_output2); |
| 319 | 325 | } |
| 320 | 326 | |
| 321 | 327 | /************************************************************* |
| r28716 | r28717 | |
| 792 | 798 | m_out_dip(ASSERT_LINE); |
| 793 | 799 | for (i=0; i < sector_len; i++) |
| 794 | 800 | { |
| 795 | | m_out_dma(0, buf[i]); |
| 801 | m_out_dma((offs_t)0, buf[i]); |
| 796 | 802 | } |
| 797 | 803 | m_out_dip(CLEAR_LINE); |
| 798 | 804 | } |
| r28716 | r28717 | |
| 1647 | 1653 | m_out_dip(ASSERT_LINE); |
| 1648 | 1654 | for (i=0; i < data_count; i++) |
| 1649 | 1655 | { |
| 1650 | | m_out_dma(0, buffer[i]); |
| 1656 | m_out_dma((offs_t)0, buffer[i]); |
| 1651 | 1657 | } |
| 1652 | 1658 | m_out_dip(CLEAR_LINE); |
| 1653 | 1659 | |
| r28716 | r28717 | |
| 1688 | 1694 | m_out_dip(ASSERT_LINE); |
| 1689 | 1695 | for (i=0; i < data_count; i++) |
| 1690 | 1696 | { |
| 1691 | | m_out_dma(0, buffer[i]); |
| 1697 | m_out_dma((offs_t)0, buffer[i]); |
| 1692 | 1698 | } |
| 1693 | 1699 | m_out_dip(CLEAR_LINE); |
| 1694 | 1700 | |
| r28716 | r28717 | |
| 1966 | 1972 | { |
| 1967 | 1973 | const smc92x4_interface *intf = reinterpret_cast<const smc92x4_interface *>(static_config()); |
| 1968 | 1974 | |
| 1969 | | m_out_intrq.resolve(intf->out_intrq, *this); |
| 1970 | | m_out_dip.resolve(intf->out_dip, *this); |
| 1971 | | m_out_auxbus.resolve(intf->out_auxbus, *this); |
| 1972 | | m_in_auxbus.resolve(intf->in_auxbus, *this); |
| 1973 | | m_out_dma.resolve(intf->dma_write, *this); |
| 1974 | | m_in_dma.resolve(intf->dma_read, *this); |
| 1975 | m_out_intrq.resolve_safe(); |
| 1976 | m_out_dip.resolve_safe(); |
| 1977 | m_out_auxbus.resolve_safe(); |
| 1978 | m_in_auxbus.resolve_safe(0); |
| 1979 | m_out_dma.resolve_safe(); |
| 1980 | m_in_dma.resolve_safe(0); |
| 1975 | 1981 | |
| 1976 | 1982 | m_full_track_layout = intf->full_track_layout; |
| 1977 | 1983 | |
trunk/src/mess/machine/smc92x4.h
| r28716 | r28717 | |
| 36 | 36 | #define DS_READY 0x02 /* drive ready bit */ |
| 37 | 37 | #define DS_WRFAULT 0x01 /* write fault */ |
| 38 | 38 | |
| 39 | // Interrupt line. To be connected with the controller PCB. |
| 40 | #define MCFG_SMC92X4_INTRQ_CALLBACK(_write) \ |
| 41 | devcb = &smc92x4_device::set_intrq_wr_callback(*device, DEVCB2_##_write); |
| 42 | |
| 43 | // DMA in progress line. To be connected with the controller PCB. |
| 44 | #define MCFG_SMC92X4_DIP_CALLBACK(_write) \ |
| 45 | devcb = &smc92x4_device::set_dip_wr_callback(*device, DEVCB2_##_write); |
| 46 | |
| 47 | // Auxiliary Bus. These 8 lines need to be connected to external latches |
| 48 | // and to a counter circuitry which works together with the external RAM. |
| 49 | // We use the S0/S1 lines as address lines. |
| 50 | #define MCFG_SMC92X4_AUXBUS_OUT_CALLBACK(_write) \ |
| 51 | devcb = &smc92x4_device::set_auxbus_wr_callback(*device, DEVCB2_##_write); |
| 52 | |
| 53 | // Auxiliary Bus. This is only used for S0=S1=0. |
| 54 | #define MCFG_SMC92X4_AUXBUS_IN_CALLBACK(_read) \ |
| 55 | devcb = &smc92x4_device::set_auxbus_rd_callback(*device, DEVCB2_##_read); |
| 56 | |
| 57 | // Callback to read the contents of the external RAM via the data bus. |
| 58 | // Note that the address must be set and automatically increased |
| 59 | // by external circuitry. |
| 60 | #define MCFG_SMC92X4_DMA_IN_CALLBACK(_read) \ |
| 61 | devcb = &smc92x4_device::set_dma_rd_callback(*device, DEVCB2_##_read); |
| 62 | |
| 63 | // Callback to write the contents of the external RAM via the data bus. |
| 64 | // Note that the address must be set and automatically increased |
| 65 | // by external circuitry. */ |
| 66 | #define MCFG_SMC92X4_DMA_OUT_CALLBACK(_write) \ |
| 67 | devcb = &smc92x4_device::set_dma_wr_callback(*device, DEVCB2_##_write); |
| 68 | |
| 39 | 69 | struct smc92x4_interface |
| 40 | 70 | { |
| 41 | 71 | // Disk format support. This flag allows to choose between the full |
| r28716 | r28717 | |
| 45 | 75 | // simple without too much case checking. Should be removed as soon as |
| 46 | 76 | // the respective disk formats support the full format. |
| 47 | 77 | int full_track_layout; |
| 48 | | |
| 49 | | // Interrupt line. To be connected with the controller PCB. |
| 50 | | devcb_write_line out_intrq; |
| 51 | | |
| 52 | | // DMA in progress line. To be connected with the controller PCB. |
| 53 | | devcb_write_line out_dip; |
| 54 | | |
| 55 | | // Auxiliary Bus. These 8 lines need to be connected to external latches |
| 56 | | // and to a counter circuitry which works together with the external RAM. |
| 57 | | // We use the S0/S1 lines as address lines. |
| 58 | | devcb_write8 out_auxbus; |
| 59 | | |
| 60 | | // Auxiliary Bus. This is only used for S0=S1=0. |
| 61 | | devcb_read8 in_auxbus; |
| 62 | | |
| 63 | | // Callback to read the contents of the external RAM via the data bus. |
| 64 | | // Note that the address must be set and automatically increased |
| 65 | | // by external circuitry. |
| 66 | | devcb_read8 dma_read; |
| 67 | | |
| 68 | | // Callback to write the contents of the external RAM via the data bus. |
| 69 | | // Note that the address must be set and automatically increased |
| 70 | | // by external circuitry. */ |
| 71 | | devcb_write8 dma_write; |
| 72 | | |
| 73 | 78 | }; |
| 74 | 79 | |
| 75 | 80 | |
| r28716 | r28717 | |
| 78 | 83 | public: |
| 79 | 84 | smc92x4_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 80 | 85 | |
| 86 | template<class _Object> static devcb2_base &set_intrq_wr_callback(device_t &device, _Object object) { return downcast<smc92x4_device &>(device).m_out_intrq.set_callback(object); } |
| 87 | template<class _Object> static devcb2_base &set_dip_wr_callback(device_t &device, _Object object) { return downcast<smc92x4_device &>(device).m_out_dip.set_callback(object); } |
| 88 | template<class _Object> static devcb2_base &set_auxbus_wr_callback(device_t &device, _Object object) { return downcast<smc92x4_device &>(device).m_out_auxbus.set_callback(object); } |
| 89 | template<class _Object> static devcb2_base &set_auxbus_rd_callback(device_t &device, _Object object) { return downcast<smc92x4_device &>(device).m_in_auxbus.set_callback(object); } |
| 90 | template<class _Object> static devcb2_base &set_dma_rd_callback(device_t &device, _Object object) { return downcast<smc92x4_device &>(device).m_in_dma.set_callback(object); } |
| 91 | template<class _Object> static devcb2_base &set_dma_wr_callback(device_t &device, _Object object) { return downcast<smc92x4_device &>(device).m_out_dma.set_callback(object); } |
| 92 | |
| 81 | 93 | DECLARE_READ8_MEMBER( read ); |
| 82 | 94 | DECLARE_WRITE8_MEMBER( write ); |
| 83 | 95 | |
| r28716 | r28717 | |
| 95 | 107 | virtual void device_reset(void); |
| 96 | 108 | |
| 97 | 109 | private: |
| 98 | | devcb_resolved_write_line m_out_intrq; // INT line |
| 99 | | devcb_resolved_write_line m_out_dip; // DMA in progress line |
| 100 | | devcb_resolved_write8 m_out_auxbus; // AB0-7 lines (using S0,S1 as address) |
| 101 | | devcb_resolved_read8 m_in_auxbus; // AB0-7 lines (S0=S1=0) |
| 102 | | devcb_resolved_read8 m_in_dma; // DMA read access to the cache buffer |
| 103 | | devcb_resolved_write8 m_out_dma; // DMA write access to the cache buffer |
| 110 | devcb2_write_line m_out_intrq; // INT line |
| 111 | devcb2_write_line m_out_dip; // DMA in progress line |
| 112 | devcb2_write8 m_out_auxbus; // AB0-7 lines (using S0,S1 as address) |
| 113 | devcb2_read8 m_in_auxbus; // AB0-7 lines (S0=S1=0) |
| 114 | devcb2_read8 m_in_dma; // DMA read access to the cache buffer |
| 115 | devcb2_write8 m_out_dma; // DMA write access to the cache buffer |
| 104 | 116 | |
| 105 | 117 | UINT8 m_output1; // internal register "output1" |
| 106 | 118 | UINT8 m_output2; // internal register "output2" |
trunk/src/mess/machine/ti99/hfdc.c
| r28716 | r28717 | |
| 436 | 436 | const smc92x4_interface ti99_smc92x4_interface = |
| 437 | 437 | { |
| 438 | 438 | FALSE, /* do not use the full track layout */ |
| 439 | | DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, myarc_hfdc_device, intrq_w), |
| 440 | | DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, myarc_hfdc_device, dip_w), |
| 441 | | DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, myarc_hfdc_device, auxbus_out), |
| 442 | | DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, myarc_hfdc_device, auxbus_in), |
| 443 | | DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, myarc_hfdc_device, read_buffer), |
| 444 | | DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, myarc_hfdc_device, write_buffer) |
| 445 | 439 | }; |
| 446 | 440 | |
| 447 | 441 | static const mm58274c_interface floppy_mm58274c_interface = |
| r28716 | r28717 | |
| 452 | 446 | |
| 453 | 447 | MACHINE_CONFIG_FRAGMENT( ti99_hfdc ) |
| 454 | 448 | MCFG_SMC92X4_ADD(FDC_TAG, ti99_smc92x4_interface ) |
| 449 | MCFG_SMC92X4_INTRQ_CALLBACK(WRITELINE(myarc_hfdc_device, intrq_w)) |
| 450 | MCFG_SMC92X4_DIP_CALLBACK(WRITELINE(myarc_hfdc_device, dip_w)) |
| 451 | MCFG_SMC92X4_AUXBUS_OUT_CALLBACK(WRITE8(myarc_hfdc_device, auxbus_out)) |
| 452 | MCFG_SMC92X4_AUXBUS_IN_CALLBACK(READ8(myarc_hfdc_device, auxbus_in)) |
| 453 | MCFG_SMC92X4_DMA_IN_CALLBACK(READ8(myarc_hfdc_device, read_buffer)) |
| 454 | MCFG_SMC92X4_DMA_OUT_CALLBACK(WRITE8(myarc_hfdc_device, write_buffer)) |
| 455 | 455 | MCFG_MM58274C_ADD(CLOCK_TAG, floppy_mm58274c_interface) |
| 456 | 456 | MACHINE_CONFIG_END |
| 457 | 457 | |