commit dba7b1f

neauoire  ·  2022-04-05 18:01:23 +0000 UTC
parent 121f61e
Began moving some devices to a ram page
1 files changed,  +10, -6
+10, -6
 1@@ -63,6 +63,8 @@ uxn11_dei(struct Uxn *u, Uint8 addr)
 2 	Device *d = &u->dev[addr >> 4];
 3 	switch(addr & 0xf0) {
 4 	case 0x20: return screen_dei(d->dat, p); break;
 5+	case 0x80: return u->dpg[0x80 + p]; break;
 6+	case 0x90: return u->dpg[0x90 + p]; break;
 7 	case 0xa0: return file_dei(0, d->dat, p); break;
 8 	case 0xb0: return file_dei(1, d->dat, p); break;
 9 	case 0xc0: return datetime_dei(d->dat, p); break;
10@@ -80,6 +82,8 @@ uxn11_deo(Uxn *u, Uint8 addr, Uint8 v)
11 	case 0x00: system_deo(u, d->dat, p); break;
12 	case 0x10: console_deo(d->dat, p); break;
13 	case 0x20: screen_deo(u->ram, d->dat, p); break;
14+	case 0x80: u->dpg[0x80 + p] = v; break;
15+	case 0x90: u->dpg[0x90 + p] = v; break;
16 	case 0xa0: file_deo(0, u->ram, d, p); break;
17 	case 0xb0: file_deo(1, u->ram, d, p); break;
18 	}
19@@ -142,26 +146,26 @@ processEvent(Uxn *u)
20 		KeySym sym;
21 		char buf[7];
22 		XLookupString((XKeyPressedEvent *)&ev, buf, 7, &sym, 0);
23-		controller_down(u, u->dev[0x8].dat, get_button(sym));
24-		controller_key(u, u->dev[0x8].dat, sym < 0x80 ? sym : buf[0]);
25+		controller_down(u, &u->dpg[0x80], get_button(sym));
26+		controller_key(u, &u->dpg[0x80], sym < 0x80 ? sym : buf[0]);
27 	} break;
28 	case KeyRelease: {
29 		KeySym sym;
30 		char buf[7];
31 		XLookupString((XKeyPressedEvent *)&ev, buf, 7, &sym, 0);
32-		controller_up(u, u->dev[0x8].dat, get_button(sym));
33+		controller_up(u, &u->dpg[0x80], get_button(sym));
34 	} break;
35 	case ButtonPress: {
36 		XButtonPressedEvent *e = (XButtonPressedEvent *)&ev;
37-		mouse_down(u, u->dev[0x9].dat, 0x1 << (e->button - 1));
38+		mouse_down(u, &u->dpg[0x90], 0x1 << (e->button - 1));
39 	} break;
40 	case ButtonRelease: {
41 		XButtonPressedEvent *e = (XButtonPressedEvent *)&ev;
42-		mouse_up(u, u->dev[0x9].dat, 0x1 << (e->button - 1));
43+		mouse_up(u, &u->dpg[0x90], 0x1 << (e->button - 1));
44 	} break;
45 	case MotionNotify: {
46 		XMotionEvent *e = (XMotionEvent *)&ev;
47-		mouse_pos(u, u->dev[0x9].dat, e->x, e->y);
48+		mouse_pos(u, &u->dpg[0x90], e->x, e->y);
49 	} break;
50 	}
51 }