trunk/src/mess/machine/wd1772.c
| r18991 | r18992 | |
| 39 | 39 | const device_type WD1772x = &device_creator<wd1772_t>; |
| 40 | 40 | const device_type WD1773x = &device_creator<wd1773_t>; |
| 41 | 41 | const device_type WD2793x = &device_creator<wd2793_t>; |
| 42 | const device_type WD2797x = &device_creator<wd2797_t>; |
| 42 | 43 | |
| 43 | 44 | wd177x_t::wd177x_t(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) : |
| 44 | 45 | device_t(mconfig, type, name, tag, owner, clock) |
| r18991 | r18992 | |
| 307 | 308 | main_state = READ_SECTOR; |
| 308 | 309 | status = (status & ~(S_CRC|S_LOST|S_RNF|S_WP|S_DDM)) | S_BUSY; |
| 309 | 310 | drop_drq(); |
| 311 | if (has_side_select() && floppy) |
| 312 | floppy->ss_w(BIT(command, 1)); |
| 310 | 313 | sub_state = has_motor() ? SPINUP : SPINUP_DONE; |
| 311 | 314 | status_type_1 = false; |
| 312 | 315 | read_sector_continue(); |
| r18991 | r18992 | |
| 391 | 394 | main_state = READ_TRACK; |
| 392 | 395 | status = (status & ~(S_LOST|S_RNF)) | S_BUSY; |
| 393 | 396 | drop_drq(); |
| 397 | if (has_side_select() && floppy) |
| 398 | floppy->ss_w(BIT(command, 1)); |
| 394 | 399 | sub_state = has_motor() ? SPINUP : SPINUP_DONE; |
| 395 | 400 | status_type_1 = false; |
| 396 | 401 | read_track_continue(); |
| r18991 | r18992 | |
| 453 | 458 | main_state = READ_ID; |
| 454 | 459 | status = (status & ~(S_WP|S_DDM|S_LOST|S_RNF)) | S_BUSY; |
| 455 | 460 | drop_drq(); |
| 461 | if (has_side_select() && floppy) |
| 462 | floppy->ss_w(BIT(command, 1)); |
| 456 | 463 | sub_state = has_motor() ? SPINUP : SPINUP_DONE; |
| 457 | 464 | status_type_1 = false; |
| 458 | 465 | read_id_continue(); |
| r18991 | r18992 | |
| 513 | 520 | main_state = WRITE_TRACK; |
| 514 | 521 | status = (status & ~(S_WP|S_DDM|S_LOST|S_RNF)) | S_BUSY; |
| 515 | 522 | drop_drq(); |
| 523 | if (has_side_select() && floppy) |
| 524 | floppy->ss_w(BIT(command, 1)); |
| 516 | 525 | sub_state = has_motor() ? SPINUP : SPINUP_DONE; |
| 517 | 526 | status_type_1 = false; |
| 518 | 527 | write_track_continue(); |
| r18991 | r18992 | |
| 590 | 599 | main_state = WRITE_SECTOR; |
| 591 | 600 | status = (status & ~(S_CRC|S_LOST|S_RNF|S_WP|S_DDM)) | S_BUSY; |
| 592 | 601 | drop_drq(); |
| 602 | if (has_side_select() && floppy) |
| 603 | floppy->ss_w(BIT(command, 1)); |
| 593 | 604 | sub_state = has_motor() ? SPINUP : SPINUP_DONE; |
| 594 | 605 | status_type_1 = false; |
| 595 | 606 | write_sector_continue(); |
| r18991 | r18992 | |
| 675 | 686 | drop_drq(); |
| 676 | 687 | motor_timeout = 0; |
| 677 | 688 | } |
| 678 | | if(command & 0x0f) { |
| 689 | if(command & 0x08) { |
| 690 | intrq = true; |
| 691 | if(!intrq_cb.isnull()) |
| 692 | intrq_cb(intrq); |
| 693 | } |
| 694 | if(command & 0x07) { |
| 679 | 695 | logerror("%s: unhandled interrupt generation (%02x)\n", ttsn().cstr(), command); |
| 680 | 696 | } |
| 681 | 697 | } |
| r18991 | r18992 | |
| 1736 | 1752 | return false; |
| 1737 | 1753 | } |
| 1738 | 1754 | |
| 1755 | bool wd177x_t::has_side_select() const |
| 1756 | { |
| 1757 | return false; |
| 1758 | } |
| 1759 | |
| 1739 | 1760 | wd1770_t::wd1770_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : wd177x_t(mconfig, WD1770x, "WD1770", tag, owner, clock) |
| 1740 | 1761 | { |
| 1741 | 1762 | } |
| r18991 | r18992 | |
| 1790 | 1811 | |
| 1791 | 1812 | bool wd2793_t::has_side_check() const |
| 1792 | 1813 | { |
| 1814 | return true; |
| 1815 | } |
| 1816 | |
| 1817 | wd2797_t::wd2797_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : wd177x_t(mconfig, WD2797x, "WD2797", tag, owner, clock) |
| 1818 | { |
| 1819 | } |
| 1820 | |
| 1821 | bool wd2797_t::has_motor() const |
| 1822 | { |
| 1793 | 1823 | return false; |
| 1794 | 1824 | } |
| 1825 | |
| 1826 | bool wd2797_t::has_side_check() const |
| 1827 | { |
| 1828 | return false; |
| 1829 | } |
| 1830 | |
| 1831 | bool wd2797_t::has_side_select() const |
| 1832 | { |
| 1833 | return true; |
| 1834 | } |
trunk/src/mess/machine/wd1772.h
| r18991 | r18992 | |
| 16 | 16 | #define MCFG_WD2793x_ADD(_tag, _clock) \ |
| 17 | 17 | MCFG_DEVICE_ADD(_tag, WD2793x, _clock) |
| 18 | 18 | |
| 19 | #define MCFG_WD2797x_ADD(_tag, _clock) \ |
| 20 | MCFG_DEVICE_ADD(_tag, WD2797x, _clock) |
| 21 | |
| 19 | 22 | class wd177x_t : public device_t { |
| 20 | 23 | public: |
| 21 | 24 | typedef delegate<void (bool state)> line_cb; |
| r18991 | r18992 | |
| 63 | 66 | |
| 64 | 67 | virtual bool has_motor() const = 0; |
| 65 | 68 | virtual bool has_side_check() const; |
| 69 | virtual bool has_side_select() const; |
| 66 | 70 | virtual int step_time(int mode) const; |
| 67 | 71 | virtual int settle_time() const; |
| 68 | 72 | |
| r18991 | r18992 | |
| 334 | 338 | virtual bool has_side_check() const; |
| 335 | 339 | }; |
| 336 | 340 | |
| 341 | class wd2797_t : public wd177x_t { |
| 342 | public: |
| 343 | wd2797_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 344 | |
| 345 | protected: |
| 346 | virtual bool has_motor() const; |
| 347 | virtual bool has_side_check() const; |
| 348 | virtual bool has_side_select() const; |
| 349 | }; |
| 350 | |
| 337 | 351 | extern const device_type WD1770x; |
| 338 | 352 | extern const device_type WD1772x; |
| 339 | 353 | extern const device_type WD1773x; |
| 340 | 354 | extern const device_type WD2793x; |
| 355 | extern const device_type WD2797x; |
| 341 | 356 | |
| 342 | 357 | #endif |