commit 5d80ab0

neauoire  ·  2022-04-05 17:43:26 +0000 UTC
parent 038eaf0
Removed individual dei/deo
3 files changed,  +18, -35
+1, -3
 1@@ -115,11 +115,9 @@ uxn_boot(Uxn *u, Uint8 *ram)
 2 }
 3 
 4 Device *
 5-uxn_port(Uxn *u, Uint8 id, Uint8 (*deifn)(Device *d, Uint8 port), void (*deofn)(Device *d, Uint8 port))
 6+uxn_port(Uxn *u, Uint8 id)
 7 {
 8 	Device *d = &u->dev[id];
 9 	d->u = u;
10-	d->dei = deifn;
11-	d->deo = deofn;
12 	return d;
13 }
+1, -3
 1@@ -36,8 +36,6 @@ typedef struct {
 2 typedef struct Device {
 3 	struct Uxn *u;
 4 	Uint8 dat[16];
 5-	Uint8 (*dei)(struct Device *d, Uint8);
 6-	void (*deo)(struct Device *d, Uint8);
 7 } Device;
 8 
 9 typedef struct Uxn {
10@@ -51,4 +49,4 @@ typedef struct Uxn {
11 int uxn_boot(Uxn *u, Uint8 *ram);
12 int uxn_eval(Uxn *u, Uint16 pc);
13 int uxn_halt(Uxn *u, Uint8 error, Uint16 addr);
14-Device *uxn_port(Uxn *u, Uint8 id, Uint8 (*deifn)(Device *, Uint8), void (*deofn)(Device *, Uint8));
15+Device *uxn_port(Uxn *u, Uint8 id);
+16, -29
 1@@ -166,19 +166,6 @@ processEvent(Uxn *u)
 2 	}
 3 }
 4 
 5-static Uint8
 6-nil_dei(Device *d, Uint8 port)
 7-{
 8-	return d->dat[port];
 9-}
10-
11-static void
12-nil_deo(Device *d, Uint8 port)
13-{
14-	(void)d;
15-	(void)port;
16-}
17-
18 static int
19 start(Uxn *u, char *rom)
20 {
21@@ -190,22 +177,22 @@ start(Uxn *u, char *rom)
22 	u->dei = uxn11_dei;
23 	u->deo = uxn11_deo;
24 
25-	/* system   */ uxn_port(u, 0x0, nil_dei, nil_deo);
26-	/* console  */ uxn_port(u, 0x1, nil_dei, nil_deo);
27-	/* screen   */ uxn_port(u, 0x2, nil_dei, nil_deo);
28-	/* empty    */ uxn_port(u, 0x3, nil_dei, nil_deo);
29-	/* empty    */ uxn_port(u, 0x4, nil_dei, nil_deo);
30-	/* empty    */ uxn_port(u, 0x5, nil_dei, nil_deo);
31-	/* empty    */ uxn_port(u, 0x6, nil_dei, nil_deo);
32-	/* empty    */ uxn_port(u, 0x7, nil_dei, nil_deo);
33-	/* control  */ uxn_port(u, 0x8, nil_dei, nil_deo);
34-	/* mouse    */ uxn_port(u, 0x9, nil_dei, nil_deo);
35-	/* file0    */ uxn_port(u, 0xa, nil_dei, nil_deo);
36-	/* file1    */ uxn_port(u, 0xb, nil_dei, nil_deo);
37-	/* datetime */ uxn_port(u, 0xc, nil_dei, nil_deo);
38-	/* empty    */ uxn_port(u, 0xd, nil_dei, nil_deo);
39-	/* reserved */ uxn_port(u, 0xe, nil_dei, nil_deo);
40-	/* reserved */ uxn_port(u, 0xf, nil_dei, nil_deo);
41+	/* system   */ uxn_port(u, 0x0);
42+	/* console  */ uxn_port(u, 0x1);
43+	/* screen   */ uxn_port(u, 0x2);
44+	/* empty    */ uxn_port(u, 0x3);
45+	/* empty    */ uxn_port(u, 0x4);
46+	/* empty    */ uxn_port(u, 0x5);
47+	/* empty    */ uxn_port(u, 0x6);
48+	/* empty    */ uxn_port(u, 0x7);
49+	/* control  */ uxn_port(u, 0x8);
50+	/* mouse    */ uxn_port(u, 0x9);
51+	/* file0    */ uxn_port(u, 0xa);
52+	/* file1    */ uxn_port(u, 0xb);
53+	/* datetime */ uxn_port(u, 0xc);
54+	/* empty    */ uxn_port(u, 0xd);
55+	/* reserved */ uxn_port(u, 0xe);
56+	/* reserved */ uxn_port(u, 0xf);
57 
58 	screen_resize(&uxn_screen, WIDTH, HEIGHT);
59 	if(!uxn_eval(u, PAGE_PROGRAM))