commit 3652117
Devine Lu Linvega
·
2026-02-18 18:59:07 +0000 UTC
parent 0a0d2ae
Use poke2 macro in mouse device
1 files changed,
+12,
-11
+12,
-11
1@@ -28,11 +28,6 @@ typedef unsigned short Uint16;
2 typedef void (*deo_handler)(void);
3 typedef Uint8 (*dei_handler)(void);
4
5-static Display *emu_dpy;
6-static Window emu_win;
7-static XImage *emu_img;
8-static int emu_x11;
9-static int emu_timer;
10 static unsigned int uxn_eval(Uint16 pc);
11 static Uint8 *ram, dev[0x100], stk[2][0x100], ptr[2];
12 static int console_vector, screen_vector, controller_vector, mouse_vector;
13@@ -629,19 +624,19 @@ mouse_up(Uint8 mask)
14 static void
15 mouse_pos(Uint16 x, Uint16 y)
16 {
17- dev[0x92] = x >> 8, dev[0x93] = x;
18- dev[0x94] = y >> 8, dev[0x95] = y;
19+ poke2(&dev[0x92], x);
20+ poke2(&dev[0x94], y);
21 if(mouse_vector) uxn_eval(mouse_vector);
22 }
23
24 static void
25 mouse_scroll(Uint16 x, Uint16 y)
26 {
27- dev[0x9a] = x >> 8, dev[0x9b] = x;
28- dev[0x9c] = -y >> 8, dev[0x9d] = -y;
29+ poke2(&dev[0x9a], x);
30+ poke2(&dev[0x9c], -y);
31 if(mouse_vector) uxn_eval(mouse_vector);
32- dev[0x9a] = 0, dev[0x9b] = 0;
33- dev[0x9c] = 0, dev[0x9d] = 0;
34+ poke2(&dev[0x9a], 0);
35+ poke2(&dev[0x9c], 0);
36 }
37
38 void
39@@ -1092,6 +1087,12 @@ uxn_eval(Uint16 pc)
40
41 /* clang-format on */
42
43+static Display *emu_dpy;
44+static Window emu_win;
45+static XImage *emu_img;
46+static int emu_x11;
47+static int emu_timer;
48+
49 #define CONINBUFSIZE 256
50
51 void