1 |
|
/* |
2 |
|
* adb.cpp - ADB emulation (mouse/keyboard) |
3 |
|
* |
4 |
< |
* Basilisk II (C) 1997-2000 Christian Bauer |
4 |
> |
* Basilisk II (C) 1997-2001 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 |
29 |
|
#include "sysdeps.h" |
30 |
|
#include "cpu_emulation.h" |
31 |
|
#include "main.h" |
32 |
+ |
#include "emul_op.h" |
33 |
|
#include "video.h" |
34 |
|
#include "adb.h" |
35 |
|
|
193 |
|
|
194 |
|
|
195 |
|
/* |
196 |
< |
* Mouse was moved (x/y are absolute or relative, depending on ADBSetMouseMode()) |
196 |
> |
* Mouse was moved (x/y are absolute or relative, depending on ADBSetRelMouseMode()) |
197 |
|
*/ |
198 |
|
|
199 |
|
void ADBMouseMoved(int x, int y) |
284 |
|
int mx = mouse_x; |
285 |
|
int my = mouse_y; |
286 |
|
|
287 |
+ |
uint32 key_base = adb_base + 4; |
288 |
+ |
uint32 mouse_base = adb_base + 16; |
289 |
+ |
|
290 |
|
if (relative_mouse) { |
291 |
|
|
292 |
|
// Mouse movement (relative) and buttons |
293 |
|
if (mx != 0 || my != 0 || mouse_button[0] != old_mouse_button[0] || mouse_button[1] != old_mouse_button[1] || mouse_button[2] != old_mouse_button[2]) { |
290 |
– |
uint32 mouse_base = adb_base + 16; |
294 |
|
|
295 |
|
// Call mouse ADB handler |
296 |
|
if (mouse_reg_3[1] == 4) { |
322 |
|
|
323 |
|
// Update mouse position (absolute) |
324 |
|
if (mx != old_mouse_x || my != old_mouse_y) { |
325 |
+ |
#ifdef POWERPC_ROM |
326 |
+ |
static const uint16 proc[] = { |
327 |
+ |
0x2f08, // move.l a0,-(sp) |
328 |
+ |
0x2f00, // move.l d0,-(sp) |
329 |
+ |
0x2f01, // move.l d1,-(sp) |
330 |
+ |
0x7001, // moveq #1,d0 (MoveTo) |
331 |
+ |
0xaadb, // CursorDeviceDispatch |
332 |
+ |
M68K_RTS |
333 |
+ |
}; |
334 |
+ |
r.a[0] = ReadMacInt32(mouse_base + 4); |
335 |
+ |
r.d[0] = mx; |
336 |
+ |
r.d[1] = my; |
337 |
+ |
Execute68k((uint32)proc, &r); |
338 |
+ |
#else |
339 |
|
WriteMacInt16(0x82a, mx); |
340 |
|
WriteMacInt16(0x828, my); |
341 |
|
WriteMacInt16(0x82e, mx); |
342 |
|
WriteMacInt16(0x82c, my); |
343 |
|
WriteMacInt8(0x8ce, ReadMacInt8(0x8cf)); // CrsrCouple -> CrsrNew |
344 |
+ |
#endif |
345 |
|
old_mouse_x = mx; |
346 |
|
old_mouse_y = my; |
347 |
|
} |
377 |
|
} |
378 |
|
|
379 |
|
// Process accumulated keyboard events |
362 |
– |
uint32 key_base = adb_base + 4; |
380 |
|
while (key_read_ptr != key_write_ptr) { |
381 |
|
|
382 |
|
// Read keyboard event |