commit 574c425
neauoire
·
2022-04-05 16:35:49 +0000 UTC
parent 8ca86ea
Removed system as Device
3 files changed,
+10,
-10
+4,
-4
1@@ -52,12 +52,12 @@ uxn_halt(Uxn *u, Uint8 error, Uint16 addr)
2 /* IO */
3
4 void
5-system_deo(Device *d, Uint8 port)
6+system_deo(Uxn *u, Uint8 *d, Uint8 port)
7 {
8 switch(port) {
9- case 0x2: d->u->wst = (Stack *)(d->u->ram + (d->dat[port] ? (d->dat[port] * 0x100) : 0x10000)); break;
10- case 0x3: d->u->rst = (Stack *)(d->u->ram + (d->dat[port] ? (d->dat[port] * 0x100) : 0x10100)); break;
11- case 0xe: system_inspect(d->u); break;
12+ case 0x2: u->wst = (Stack *)(u->ram + (d[port] ? (d[port] * 0x100) : 0x10000)); break;
13+ case 0x3: u->rst = (Stack *)(u->ram + (d[port] ? (d[port] * 0x100) : 0x10100)); break;
14+ case 0xe: system_inspect(u); break;
15 default: system_deo_special(d, port);
16 }
17 }
+2,
-2
1@@ -15,5 +15,5 @@ typedef struct SystemDevice {
2 } SystemDevice;
3
4 void system_inspect(Uxn *u);
5-void system_deo(Device *d, Uint8 port);
6-void system_deo_special(Device *d, Uint8 port);
7+void system_deo(Uxn *u, Uint8 *d, Uint8 port);
8+void system_deo_special(Uint8 *d, Uint8 port);
+4,
-4
1@@ -33,10 +33,10 @@ error(char *msg, const char *err)
2 }
3
4 void
5-system_deo_special(Device *d, Uint8 port)
6+system_deo_special(Uint8 *d, Uint8 port)
7 {
8 if(port > 0x7 && port < 0xe)
9- screen_palette(&uxn_screen, &d->dat[0x8]);
10+ screen_palette(&uxn_screen, &d[0x8]);
11 }
12
13 static int
14@@ -79,7 +79,7 @@ uxn11_deo(Uxn *u, Uint8 addr, Uint8 v)
15 Device *d = &u->dev[addr >> 4];
16 d->dat[p] = v;
17 switch(addr & 0xf0) {
18- case 0x00: system_deo(d, p); break;
19+ case 0x00: system_deo(u, d->dat, p); break;
20 case 0x10: console_deo(d->dat, p); break;
21 case 0x20: screen_deo(u->ram, d->dat, p); break;
22 case 0xa0: file_deo(d, p); break;
23@@ -192,7 +192,7 @@ start(Uxn *u, char *rom)
24 u->dei = uxn11_dei;
25 u->deo = uxn11_deo;
26
27- /* system */ uxn_port(u, 0x0, nil_dei, system_deo);
28+ /* system */ uxn_port(u, 0x0, nil_dei, nil_deo);
29 /* console */ uxn_port(u, 0x1, nil_dei, nil_deo);
30 /* screen */ devscreen = uxn_port(u, 0x2, nil_dei, nil_deo);
31 /* empty */ uxn_port(u, 0x3, nil_dei, nil_deo);