trunk/src/emu/diexec.c
| r23706 | r23707 | |
| 638 | 638 | |
| 639 | 639 | void device_execute_interface::interface_clock_changed() |
| 640 | 640 | { |
| 641 | // a clock of zero disables the device |
| 642 | if (device().clock() == 0) |
| 643 | { |
| 644 | suspend(SUSPEND_REASON_CLOCK, true); |
| 645 | return; |
| 646 | } |
| 647 | |
| 648 | // if we were suspended because we had no clock, enable us now |
| 649 | if (suspended(SUSPEND_REASON_CLOCK)) |
| 650 | resume(SUSPEND_REASON_CLOCK); |
| 651 | |
| 641 | 652 | // recompute cps and spc |
| 642 | 653 | m_cycles_per_second = clocks_to_cycles(device().clock()); |
| 643 | 654 | m_attoseconds_per_cycle = HZ_TO_ATTOSECONDS(m_cycles_per_second); |
| r23706 | r23707 | |
| 693 | 704 | |
| 694 | 705 | attoseconds_t device_execute_interface::minimum_quantum() const |
| 695 | 706 | { |
| 696 | | // if we don't have that information, compute it |
| 707 | // if we don't have a clock, return a huge factor |
| 708 | if (device().clock() == 0) |
| 709 | return ATTOSECONDS_PER_SECOND - 1; |
| 710 | |
| 711 | // if we don't have the quantum time, compute it |
| 697 | 712 | attoseconds_t basetick = m_attoseconds_per_cycle; |
| 698 | 713 | if (basetick == 0) |
| 699 | 714 | basetick = HZ_TO_ATTOSECONDS(clocks_to_cycles(device().clock())); |
| r23706 | r23707 | |
| 727 | 742 | return; |
| 728 | 743 | |
| 729 | 744 | // generate the interrupt callback |
| 730 | | if (!suspended(SUSPEND_REASON_HALT | SUSPEND_REASON_RESET | SUSPEND_REASON_DISABLE)) |
| 745 | if (!suspended(SUSPEND_REASON_HALT | SUSPEND_REASON_RESET | SUSPEND_REASON_DISABLE | SUSPEND_REASON_CLOCK)) |
| 731 | 746 | { |
| 732 | 747 | if (m_vblank_interrupt_legacy != NULL) |
| 733 | 748 | (*m_vblank_interrupt_legacy)(&device()); |
| r23706 | r23707 | |
| 750 | 765 | void device_execute_interface::trigger_periodic_interrupt() |
| 751 | 766 | { |
| 752 | 767 | // bail if there is no routine |
| 753 | | if (!suspended(SUSPEND_REASON_HALT | SUSPEND_REASON_RESET | SUSPEND_REASON_DISABLE)) |
| 768 | if (!suspended(SUSPEND_REASON_HALT | SUSPEND_REASON_RESET | SUSPEND_REASON_DISABLE | SUSPEND_REASON_CLOCK)) |
| 754 | 769 | { |
| 755 | 770 | if (m_timed_interrupt_legacy != NULL) |
| 756 | 771 | (*m_timed_interrupt_legacy)(&device()); |