trunk/src/emu/machine/upd765.c
| r29382 | r29383 | |
| 101 | 101 | upd765_family_device::upd765_family_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) : |
| 102 | 102 | pc_fdc_interface(mconfig, type, name, tag, owner, clock, shortname, source), |
| 103 | 103 | intrq_cb(*this), |
| 104 | | drq_cb(*this) |
| 104 | drq_cb(*this), |
| 105 | hdl_cb(*this) |
| 105 | 106 | { |
| 106 | 107 | ready_polled = true; |
| 107 | 108 | ready_connected = true; |
| r29382 | r29383 | |
| 129 | 130 | |
| 130 | 131 | void upd765_family_device::device_start() |
| 131 | 132 | { |
| 132 | | intrq_cb.resolve(); |
| 133 | | drq_cb.resolve(); |
| 133 | intrq_cb.resolve_safe(); |
| 134 | drq_cb.resolve_safe(); |
| 135 | hdl_cb.resolve_safe(); |
| 134 | 136 | |
| 135 | 137 | for(int i=0; i != 4; i++) { |
| 136 | 138 | char name[2]; |
| r29382 | r29383 | |
| 442 | 444 | { |
| 443 | 445 | if(state != drq) { |
| 444 | 446 | drq = state; |
| 445 | | if(!drq_cb.isnull()) |
| 446 | | drq_cb(drq); |
| 447 | drq_cb(drq); |
| 447 | 448 | } |
| 448 | 449 | } |
| 449 | 450 | |
| r29382 | r29383 | |
| 1442 | 1443 | |
| 1443 | 1444 | if(fi.dev) |
| 1444 | 1445 | fi.dev->ss_w(command[1] & 4 ? 1 : 0); |
| 1446 | hdl_cb(1); |
| 1445 | 1447 | read_data_continue(fi); |
| 1446 | 1448 | } |
| 1447 | 1449 | |
| r29382 | r29383 | |
| 1619 | 1621 | st1 = ST1_MA; |
| 1620 | 1622 | st2 = 0x00; |
| 1621 | 1623 | |
| 1624 | hdl_cb(1); |
| 1622 | 1625 | write_data_continue(fi); |
| 1623 | 1626 | } |
| 1624 | 1627 | |
| r29382 | r29383 | |
| 1727 | 1730 | |
| 1728 | 1731 | if(fi.dev) |
| 1729 | 1732 | fi.dev->ss_w(command[1] & 4 ? 1 : 0); |
| 1733 | hdl_cb(1); |
| 1730 | 1734 | read_track_continue(fi); |
| 1731 | 1735 | } |
| 1732 | 1736 | |
| r29382 | r29383 | |
| 1841 | 1845 | fi.dev->ss_w(command[1] & 4 ? 1 : 0); |
| 1842 | 1846 | sector_size = calc_sector_size(command[2]); |
| 1843 | 1847 | |
| 1848 | hdl_cb(1); |
| 1844 | 1849 | format_track_continue(fi); |
| 1845 | 1850 | } |
| 1846 | 1851 | |
| r29382 | r29383 | |
| 1903 | 1908 | for(int i=0; i<4; i++) |
| 1904 | 1909 | cur_live.idbuf[i] = 0x00; |
| 1905 | 1910 | |
| 1911 | hdl_cb(1); |
| 1906 | 1912 | read_id_continue(fi); |
| 1907 | 1913 | } |
| 1908 | 1914 | |
| r29382 | r29383 | |
| 1955 | 1961 | bool old_irq = cur_irq; |
| 1956 | 1962 | cur_irq = data_irq || other_irq || internal_drq; |
| 1957 | 1963 | cur_irq = cur_irq && (dor & 4) && (mode != MODE_AT || (dor & 8)); |
| 1958 | | if(cur_irq != old_irq && !intrq_cb.isnull()) { |
| 1964 | if(cur_irq != old_irq) { |
| 1959 | 1965 | logerror("%s: irq = %d\n", tag(), cur_irq); |
| 1960 | 1966 | intrq_cb(cur_irq); |
| 1961 | 1967 | } |
trunk/src/emu/machine/upd765.h
| r29382 | r29383 | |
| 61 | 61 | #define MCFG_UPD765_DRQ_CALLBACK(_write) \ |
| 62 | 62 | devcb = &upd765_family_device::set_drq_wr_callback(*device, DEVCB2_##_write); |
| 63 | 63 | |
| 64 | #define MCFG_UPD765_HDL_CALLBACK(_write) \ |
| 65 | devcb = &upd765_family_device::set_hdl_wr_callback(*device, DEVCB2_##_write); |
| 66 | |
| 64 | 67 | /* Interface required for PC ISA wrapping */ |
| 65 | 68 | class pc_fdc_interface : public device_t { |
| 66 | 69 | public: |
| r29382 | r29383 | |
| 91 | 94 | |
| 92 | 95 | template<class _Object> static devcb2_base &set_intrq_wr_callback(device_t &device, _Object object) { return downcast<upd765_family_device &>(device).intrq_cb.set_callback(object); } |
| 93 | 96 | template<class _Object> static devcb2_base &set_drq_wr_callback(device_t &device, _Object object) { return downcast<upd765_family_device &>(device).drq_cb.set_callback(object); } |
| 97 | template<class _Object> static devcb2_base &set_hdl_wr_callback(device_t &device, _Object object) { return downcast<upd765_family_device &>(device).hdl_cb.set_callback(object); } |
| 94 | 98 | |
| 95 | 99 | virtual DECLARE_ADDRESS_MAP(map, 8) = 0; |
| 96 | 100 | |
| r29382 | r29383 | |
| 304 | 308 | int main_phase; |
| 305 | 309 | |
| 306 | 310 | live_info cur_live, checkpoint_live; |
| 307 | | devcb2_write_line intrq_cb, drq_cb; |
| 311 | devcb2_write_line intrq_cb, drq_cb, hdl_cb; |
| 308 | 312 | bool cur_irq, other_irq, data_irq, drq, internal_drq, tc, tc_done, locked, mfm; |
| 309 | 313 | floppy_info flopi[4]; |
| 310 | 314 | |
trunk/src/lib/formats/tandy2k_dsk.c
| r0 | r29383 | |
| 1 | // license:BSD-3-Clause |
| 2 | // copyright-holders:Curt Coder |
| 3 | /********************************************************************* |
| 4 | |
| 5 | formats/tandy2k_dsk.c |
| 6 | |
| 7 | Tandy 2000 disk format |
| 8 | |
| 9 | *********************************************************************/ |
| 10 | |
| 11 | #include "emu.h" |
| 12 | #include "formats/tandy2k_dsk.h" |
| 13 | |
| 14 | tandy2k_format::tandy2k_format() : upd765_format(formats) |
| 15 | { |
| 16 | } |
| 17 | |
| 18 | const char *tandy2k_format::name() const |
| 19 | { |
| 20 | return "tandy2k"; |
| 21 | } |
| 22 | |
| 23 | const char *tandy2k_format::description() const |
| 24 | { |
| 25 | return "Tandy 2000 disk image"; |
| 26 | } |
| 27 | |
| 28 | const char *tandy2k_format::extensions() const |
| 29 | { |
| 30 | return "dsk"; |
| 31 | } |
| 32 | |
| 33 | const tandy2k_format::format tandy2k_format::formats[] = { |
| 34 | { // 720K 5.25 inch quad density - gaps unverified |
| 35 | floppy_image::FF_525, floppy_image::DSQD, floppy_image::MFM, |
| 36 | 2000, 9, 80, 2, 512, {}, 1, {}, 80, 50, 22, 80 |
| 37 | }, |
| 38 | {} |
| 39 | }; |
| 40 | |
| 41 | const floppy_format_type FLOPPY_TANDY_2000_FORMAT = &floppy_image_format_creator<tandy2k_format>; |
trunk/src/mess/includes/tandy2k.h
| r29382 | r29383 | |
| 8 | 8 | #include "bus/rs232/rs232.h" |
| 9 | 9 | #include "cpu/i86/i186.h" |
| 10 | 10 | #include "cpu/mcs48/mcs48.h" |
| 11 | #include "formats/tandy2k_dsk.h" |
| 11 | 12 | #include "imagedev/harddriv.h" |
| 12 | 13 | #include "machine/i8255.h" |
| 13 | 14 | #include "machine/i8251.h" |
| r29382 | r29383 | |
| 161 | 162 | DECLARE_WRITE_LINE_MEMBER( kbdclk_w ); |
| 162 | 163 | DECLARE_WRITE_LINE_MEMBER( kbddat_w ); |
| 163 | 164 | DECLARE_READ8_MEMBER( irq_callback ); |
| 164 | | DECLARE_WRITE_LINE_MEMBER( fdc_drq ); |
| 165 | DECLARE_WRITE_LINE_MEMBER( fdc_drq_w ); |
| 166 | DECLARE_WRITE_LINE_MEMBER( fdc_hdl_w ); |
| 165 | 167 | DECLARE_WRITE_LINE_MEMBER(write_centronics_ack); |
| 166 | 168 | DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); |
| 167 | 169 | DECLARE_WRITE_LINE_MEMBER(write_centronics_perror); |
| r29382 | r29383 | |
| 169 | 171 | DECLARE_WRITE_LINE_MEMBER(write_centronics_fault); |
| 170 | 172 | CRT9021_DRAW_CHARACTER_MEMBER( vac_draw_character ); |
| 171 | 173 | TIMER_DEVICE_CALLBACK_MEMBER( vidldsh_tick ); |
| 174 | DECLARE_FLOPPY_FORMATS( floppy_formats ); |
| 172 | 175 | |
| 173 | 176 | enum |
| 174 | 177 | { |
trunk/src/mess/drivers/tandy2k.c
| r29382 | r29383 | |
| 4 | 4 | |
| 5 | 5 | Tandy 2000 |
| 6 | 6 | |
| 7 | | Skeleton driver. |
| 8 | | |
| 9 | 7 | ****************************************************************************/ |
| 10 | 8 | |
| 11 | 9 | /* |
| 12 | 10 | |
| 13 | 11 | TODO: |
| 14 | 12 | |
| 13 | - floppy |
| 14 | - HDL is also connected to WP/TS input where TS is used to detect motor status |
| 15 | - 3 second motor off delay timer |
| 16 | - DMA |
| 15 | 17 | - video (video RAM is at memory top - 0x1400, i.e. 0x1ec00) |
| 16 | | - DMA |
| 17 | | - floppy |
| 18 | 18 | - keyboard ROM |
| 19 | 19 | - hires graphics board |
| 20 | 20 | - WD1010 |
| r29382 | r29383 | |
| 146 | 146 | m_pit->write_gate2(BIT(data, 4)); |
| 147 | 147 | |
| 148 | 148 | // FDC reset |
| 149 | | if(BIT(data, 5)) |
| 149 | if(!BIT(data, 5)) |
| 150 | 150 | m_fdc->reset(); |
| 151 | 151 | |
| 152 | 152 | // timer 0 enable |
| r29382 | r29383 | |
| 665 | 665 | |
| 666 | 666 | // Intel 8272 Interface |
| 667 | 667 | |
| 668 | | WRITE_LINE_MEMBER( tandy2k_state::fdc_drq ) |
| 668 | WRITE_LINE_MEMBER( tandy2k_state::fdc_drq_w ) |
| 669 | 669 | { |
| 670 | 670 | dma_request(0, state); |
| 671 | 671 | } |
| 672 | 672 | |
| 673 | WRITE_LINE_MEMBER( tandy2k_state::fdc_hdl_w ) |
| 674 | { |
| 675 | m_floppy0->mon_w(!state); |
| 676 | m_floppy1->mon_w(!state); |
| 677 | } |
| 678 | |
| 679 | FLOPPY_FORMATS_MEMBER( tandy2k_state::floppy_formats ) |
| 680 | FLOPPY_TANDY_2000_FORMAT |
| 681 | FLOPPY_FORMATS_END |
| 682 | |
| 673 | 683 | static SLOT_INTERFACE_START( tandy2k_floppies ) |
| 674 | 684 | SLOT_INTERFACE( "525qd", FLOPPY_525_QD ) |
| 675 | 685 | SLOT_INTERFACE_END |
| r29382 | r29383 | |
| 715 | 725 | |
| 716 | 726 | m_char_ram.allocate(0x1000); |
| 717 | 727 | |
| 718 | | // HACK these should be connected to FDC HLD output |
| 719 | | m_floppy0->mon_w(0); |
| 720 | | m_floppy1->mon_w(0); |
| 721 | | |
| 722 | 728 | // register for state saving |
| 723 | 729 | save_item(NAME(m_dma_mux)); |
| 724 | 730 | save_item(NAME(m_kbdclk)); |
| r29382 | r29383 | |
| 810 | 816 | MCFG_PIT8253_OUT2_HANDLER(WRITELINE(tandy2k_state, rfrqpulse_w)) |
| 811 | 817 | |
| 812 | 818 | MCFG_PIC8259_ADD(I8259A_0_TAG, DEVWRITELINE(I80186_TAG, i80186_cpu_device, int0_w), VCC, NULL) |
| 819 | |
| 813 | 820 | MCFG_PIC8259_ADD(I8259A_1_TAG, DEVWRITELINE(I80186_TAG, i80186_cpu_device, int1_w), VCC, NULL) |
| 821 | |
| 814 | 822 | MCFG_I8272A_ADD(I8272A_TAG, true) |
| 815 | 823 | downcast<i8272a_device *>(device)->set_select_lines_connected(true); |
| 816 | 824 | MCFG_UPD765_INTRQ_CALLBACK(DEVWRITELINE(I8259A_0_TAG, pic8259_device, ir4_w)) |
| 817 | | MCFG_UPD765_DRQ_CALLBACK(WRITELINE(tandy2k_state, fdc_drq)) |
| 818 | | MCFG_FLOPPY_DRIVE_ADD(I8272A_TAG ":0", tandy2k_floppies, "525qd", floppy_image_device::default_floppy_formats) |
| 819 | | MCFG_FLOPPY_DRIVE_ADD(I8272A_TAG ":1", tandy2k_floppies, "525qd", floppy_image_device::default_floppy_formats) |
| 825 | MCFG_UPD765_DRQ_CALLBACK(WRITELINE(tandy2k_state, fdc_drq_w)) |
| 826 | MCFG_UPD765_HDL_CALLBACK(WRITELINE(tandy2k_state, fdc_hdl_w)) |
| 827 | MCFG_FLOPPY_DRIVE_ADD(I8272A_TAG ":0", tandy2k_floppies, "525qd", tandy2k_state::floppy_formats) |
| 828 | MCFG_FLOPPY_DRIVE_ADD(I8272A_TAG ":1", tandy2k_floppies, "525qd", tandy2k_state::floppy_formats) |
| 820 | 829 | |
| 821 | 830 | MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_printers, "image") |
| 822 | 831 | MCFG_CENTRONICS_ACK_HANDLER(WRITELINE(tandy2k_state, write_centronics_ack)) |