Previous 15994 Revisions Next

r6330 Sunday 8th November, 2009 at 03:33:18 UTC by R. Belmont
[MAC] Further improvements to SE/Classic/II style ADB. Device detection and SRQs work properly now, and the driver in System 7.5 works correctly.
[src/mess/machine]mac.c

src/mess/machine/mac.c
r6329r6330
14381438static const char *const adb_statenames[4] = { "NEW", "EVEN", "ODD", "IDLE" };
14391439#endif
14401440
1441static void mac_adb_pollmouse(running_machine *machine)
1441static int mac_adb_pollmouse(running_machine *machine)
14421442{
14431443   int NewX, NewY, NewButton;
14441444
14451445   if (!adb_mouse_initialized)
14461446   {
1447      return;
1447      return 0;
14481448   }
14491449
14501450   NewButton = input_port_read(machine, "MOUSE0") & 0x01;
r6329r6330
14531453
14541454   if ((NewX != adb_lastmousex) || (NewY != adb_lastmousey) || (NewButton != adb_lastbutton))
14551455   {
1456      adb_mouse_wanted_srq = 1;
1456      return 1;
14571457   }
1458
1459   return 0;
14581460}
14591461
14601462static void mac_adb_accummouse( running_machine *machine, UINT8 *MouseX, UINT8 *MouseY )
r6329r6330
16461648      #if LOG_ADB
16471649      printf("Got LISTEN data %x for device %x reg %x\n", adb_command, adb_listenaddr, adb_listenreg);
16481650      #endif
1649#if 0
1651
16501652      if (adb_listenaddr == adb_mouseaddr)
16511653      {
16521654         if ((adb_listenreg == 3) && (adb_command > 0) && (adb_command < 16))
r6329r6330
16671669            adb_keybaddr = adb_command&0x0f;
16681670         }
16691671      }
1670#endif
16711672   }
16721673}
16731674
r6329r6330
17751776
17761777         case ADB_STATE_IDLE:
17771778            adb_irq_pending = 0;
1778            timer_adjust_oneshot(mac_adb_timer, attotime_make(0, ATTOSECONDS_IN_USEC(100)), 0);
17791779            break;
17801780      }
17811781   }
r6329r6330
18121812   }
18131813   else
18141814   {
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)))
18191816      {
18201817         // if the mouse was the last TALK, we can just send the new data
18211818         // otherwise we need to pull SRQ
r6329r6330
18291826            timer_adjust_oneshot(mac_adb_timer, attotime_make(0, ATTOSECONDS_IN_USEC(100)), 0);
18301827            adb_mouse_wanted_srq = 0;
18311828         }
1832         #if 0
18331829         else
18341830         {
1835            printf("IDLE, mouse moved, mouse not last TALK, pulling SRQ\n");
1831//            printf("IDLE, mouse moved, mouse not last TALK, pulling SRQ\n");
18361832            adb_irq_pending = 1;
1837
18381833            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
18401835            timer_adjust_oneshot(mac_adb_timer, attotime_make(0, ATTOSECONDS_IN_USEC(100)), 0);
18411836         }
1842         #endif
18431837      }
18441838   }
18451839}

Previous 15994 Revisions Next


© 1998-2018 The MESS Team