src/mess/machine/mac.c
| r6329 | r6330 | |
| 1438 | 1438 | static const char *const adb_statenames[4] = { "NEW", "EVEN", "ODD", "IDLE" }; |
| 1439 | 1439 | #endif |
| 1440 | 1440 | |
| 1441 | | static void mac_adb_pollmouse(running_machine *machine) |
| 1441 | static int mac_adb_pollmouse(running_machine *machine) |
| 1442 | 1442 | { |
| 1443 | 1443 | int NewX, NewY, NewButton; |
| 1444 | 1444 | |
| 1445 | 1445 | if (!adb_mouse_initialized) |
| 1446 | 1446 | { |
| 1447 | | return; |
| 1447 | return 0; |
| 1448 | 1448 | } |
| 1449 | 1449 | |
| 1450 | 1450 | NewButton = input_port_read(machine, "MOUSE0") & 0x01; |
| r6329 | r6330 | |
| 1453 | 1453 | |
| 1454 | 1454 | if ((NewX != adb_lastmousex) || (NewY != adb_lastmousey) || (NewButton != adb_lastbutton)) |
| 1455 | 1455 | { |
| 1456 | | adb_mouse_wanted_srq = 1; |
| 1456 | return 1; |
| 1457 | 1457 | } |
| 1458 | |
| 1459 | return 0; |
| 1458 | 1460 | } |
| 1459 | 1461 | |
| 1460 | 1462 | static void mac_adb_accummouse( running_machine *machine, UINT8 *MouseX, UINT8 *MouseY ) |
| r6329 | r6330 | |
| 1646 | 1648 | #if LOG_ADB |
| 1647 | 1649 | printf("Got LISTEN data %x for device %x reg %x\n", adb_command, adb_listenaddr, adb_listenreg); |
| 1648 | 1650 | #endif |
| 1649 | | #if 0 |
| 1651 | |
| 1650 | 1652 | if (adb_listenaddr == adb_mouseaddr) |
| 1651 | 1653 | { |
| 1652 | 1654 | if ((adb_listenreg == 3) && (adb_command > 0) && (adb_command < 16)) |
| r6329 | r6330 | |
| 1667 | 1669 | adb_keybaddr = adb_command&0x0f; |
| 1668 | 1670 | } |
| 1669 | 1671 | } |
| 1670 | | #endif |
| 1671 | 1672 | } |
| 1672 | 1673 | } |
| 1673 | 1674 | |
| r6329 | r6330 | |
| 1775 | 1776 | |
| 1776 | 1777 | case ADB_STATE_IDLE: |
| 1777 | 1778 | adb_irq_pending = 0; |
| 1778 | | timer_adjust_oneshot(mac_adb_timer, attotime_make(0, ATTOSECONDS_IN_USEC(100)), 0); |
| 1779 | 1779 | break; |
| 1780 | 1780 | } |
| 1781 | 1781 | } |
| r6329 | r6330 | |
| 1812 | 1812 | } |
| 1813 | 1813 | else |
| 1814 | 1814 | { |
| 1815 | | adb_irq_pending = 0; |
| 1816 | | mac_adb_pollmouse(machine); |
| 1817 | | |
| 1818 | | if ((adb_state == ADB_STATE_IDLE) && (adb_mouse_wanted_srq)) |
| 1815 | if ((adb_state == ADB_STATE_IDLE) && (mac_adb_pollmouse(machine))) |
| 1819 | 1816 | { |
| 1820 | 1817 | // if the mouse was the last TALK, we can just send the new data |
| 1821 | 1818 | // otherwise we need to pull SRQ |
| r6329 | r6330 | |
| 1829 | 1826 | timer_adjust_oneshot(mac_adb_timer, attotime_make(0, ATTOSECONDS_IN_USEC(100)), 0); |
| 1830 | 1827 | adb_mouse_wanted_srq = 0; |
| 1831 | 1828 | } |
| 1832 | | #if 0 |
| 1833 | 1829 | else |
| 1834 | 1830 | { |
| 1835 | | printf("IDLE, mouse moved, mouse not last TALK, pulling SRQ\n"); |
| 1831 | // printf("IDLE, mouse moved, mouse not last TALK, pulling SRQ\n"); |
| 1836 | 1832 | adb_irq_pending = 1; |
| 1837 | | |
| 1838 | 1833 | adb_command = adb_send = 0; |
| 1839 | | adb_timer_ticks = 8; |
| 1834 | adb_timer_ticks = 1; // one tick should be sufficient to make it see the IRQ |
| 1840 | 1835 | timer_adjust_oneshot(mac_adb_timer, attotime_make(0, ATTOSECONDS_IN_USEC(100)), 0); |
| 1841 | 1836 | } |
| 1842 | | #endif |
| 1843 | 1837 | } |
| 1844 | 1838 | } |
| 1845 | 1839 | } |