ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/adb.cpp
(Generate patch)

Comparing BasiliskII/src/adb.cpp (file contents):
Revision 1.6 by cebix, 2001-07-03T15:59:45Z vs.
Revision 1.9 by gbeauche, 2003-05-13T12:34:09Z

# Line 1 | Line 1
1   /*
2   *  adb.cpp - ADB emulation (mouse/keyboard)
3   *
4 < *  Basilisk II (C) 1997-2001 Christian Bauer
4 > *  Basilisk II (C) 1997-2002 Christian Bauer
5   *
6   *  This program is free software; you can redistribute it and/or modify
7   *  it under the terms of the GNU General Public License as published by
# Line 57 | Line 57 | static uint8 mouse_reg_3[2] = {0x63, 0x0
57   static uint8 key_reg_2[2] = {0xff, 0xff};       // Keyboard ADB register 2
58   static uint8 key_reg_3[2] = {0x62, 0x05};       // Keyboard ADB register 3
59  
60 < // ADB mouse input state lock (for platforms that use separate input thread)
60 > // ADB mouse motion lock (for platforms that use separate input thread)
61   static B2_mutex *mouse_lock;
62  
63  
# Line 231 | Line 231 | void ADBMouseMoved(int x, int y)
231                  mouse_x = x; mouse_y = y;
232          }
233          B2_unlock_mutex(mouse_lock);
234 +        SetInterruptFlag(INTFLAG_ADB);
235 +        TriggerInterrupt();
236   }
237  
238  
# Line 240 | Line 242 | void ADBMouseMoved(int x, int y)
242  
243   void ADBMouseDown(int button)
244   {
243        B2_lock_mutex(mouse_lock);
245          mouse_button[button] = true;
246 <        B2_unlock_mutex(mouse_lock);
246 >        SetInterruptFlag(INTFLAG_ADB);
247 >        TriggerInterrupt();
248   }
249  
250  
251   /*
252 < *  First mouse button released
252 > *  Mouse button released
253   */
254  
255   void ADBMouseUp(int button)
256   {
255        B2_lock_mutex(mouse_lock);
257          mouse_button[button] = false;
258 <        B2_unlock_mutex(mouse_lock);
258 >        SetInterruptFlag(INTFLAG_ADB);
259 >        TriggerInterrupt();
260   }
261  
262  
# Line 264 | Line 266 | void ADBMouseUp(int button)
266  
267   void ADBSetRelMouseMode(bool relative)
268   {
269 <        relative_mouse = relative;
269 >        if (relative_mouse != relative) {
270 >                relative_mouse = relative;
271 >                mouse_x = mouse_y = 0;
272 >        }
273   }
274  
275  
# Line 280 | Line 285 | void ADBKeyDown(int code)
285  
286          // Set key in matrix
287          key_states[code >> 3] |= (1 << (~code & 7));
288 +
289 +        // Trigger interrupt
290 +        SetInterruptFlag(INTFLAG_ADB);
291 +        TriggerInterrupt();
292   }
293  
294  
# Line 295 | Line 304 | void ADBKeyUp(int code)
304  
305          // Clear key in matrix
306          key_states[code >> 3] &= ~(1 << (~code & 7));
307 +
308 +        // Trigger interrupt
309 +        SetInterruptFlag(INTFLAG_ADB);
310 +        TriggerInterrupt();
311   }
312  
313  
# Line 359 | Line 372 | void ADBInterrupt(void)
372                  // Update mouse position (absolute)
373                  if (mx != old_mouse_x || my != old_mouse_y) {
374   #ifdef POWERPC_ROM
375 <                        static const uint16 proc[] = {
376 <                                0x2f08,         // move.l a0,-(sp)
377 <                                0x2f00,         // move.l d0,-(sp)
378 <                                0x2f01,         // move.l d1,-(sp)
379 <                                0x7001,         // moveq #1,d0 (MoveTo)
380 <                                0xaadb,         // CursorDeviceDispatch
381 <                                M68K_RTS
375 >                        static const uint8 proc[] = {
376 >                                0x2f, 0x08,             // move.l a0,-(sp)
377 >                                0x2f, 0x00,             // move.l d0,-(sp)
378 >                                0x2f, 0x01,             // move.l d1,-(sp)
379 >                                0x70, 0x01,             // moveq #1,d0 (MoveTo)
380 >                                0xaa, 0xdb,             // CursorDeviceDispatch
381 >                                M68K_RTS >> 8, M68K_RTS & 0xff
382                          };
383                          r.a[0] = ReadMacInt32(mouse_base + 4);
384                          r.d[0] = mx;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines