Browse code

Removed unused device string

neauoire authored on 30/08/2021 02:52:12
Showing 5 changed files
... ...
@@ -4030,13 +4030,12 @@ uxn_boot(Uxn *u)
4030 4030
 }
4031 4031
 
4032 4032
 Device *
4033
-uxn_port(Uxn *u, Uint8 id, char *name, void (*talkfn)(Device *d, Uint8 b0, Uint8 w))
4033
+uxn_port(Uxn *u, Uint8 id, void (*talkfn)(Device *d, Uint8 b0, Uint8 w))
4034 4034
 {
4035 4035
 	Device *d = &u->dev[id];
4036 4036
 	d->addr = id * 0x10;
4037 4037
 	d->u = u;
4038 4038
 	d->mem = u->ram.dat;
4039 4039
 	d->talk = talkfn;
4040
-	(void)name;
4041 4040
 	return d;
4042 4041
 }
... ...
@@ -41,10 +41,10 @@ static Uint16 devr8(Device *d, Uint8 a) { d->talk(d, a & 0x0f, 0); return d->dat
41 41
 static void   warp8(Uxn *u, Uint16 a){ u->ram.ptr += (Sint8)a; }
42 42
 static void   pull8(Uxn *u){ push8(u->src, peek8(u->ram.dat, u->ram.ptr++)); }
43 43
 /* short mode */
44
-void          poke16(Uint8 *m, Uint16 a, Uint16 b) { poke8(m, a, b >> 8); poke8(m, a + 1, b); }
45
-Uint16        peek16(Uint8 *m, Uint16 a) { return (peek8(m, a) << 8) + peek8(m, a + 1); }
46 44
 static void   push16(Stack *s, Uint16 a) { push8(s, a >> 8); push8(s, a); }
47 45
 static Uint16 pop16(Stack *s) { Uint8 a = pop8(s), b = pop8(s); return a + (b << 8); }
46
+	   void   poke16(Uint8 *m, Uint16 a, Uint16 b) { poke8(m, a, b >> 8); poke8(m, a + 1, b); }
47
+	   Uint16 peek16(Uint8 *m, Uint16 a) { return (peek8(m, a) << 8) + peek8(m, a + 1); }
48 48
 static void   devw16(Device *d, Uint8 a, Uint16 b) { devw8(d, a, b >> 8); devw8(d, a + 1, b); }
49 49
 static Uint16 devr16(Device *d, Uint8 a) { return (devr8(d, a) << 8) + devr8(d, a + 1); }
50 50
 static void   warp16(Uxn *u, Uint16 a){ u->ram.ptr = a; }
... ...
@@ -148,13 +148,12 @@ uxn_boot(Uxn *u)
148 148
 }
149 149
 
150 150
 Device *
151
-uxn_port(Uxn *u, Uint8 id, char *name, void (*talkfn)(Device *d, Uint8 b0, Uint8 w))
151
+uxn_port(Uxn *u, Uint8 id, void (*talkfn)(Device *d, Uint8 b0, Uint8 w))
152 152
 {
153 153
 	Device *d = &u->dev[id];
154 154
 	d->addr = id * 0x10;
155 155
 	d->u = u;
156 156
 	d->mem = u->ram.dat;
157 157
 	d->talk = talkfn;
158
-	(void)name;
159 158
 	return d;
160 159
 }
... ...
@@ -46,4 +46,4 @@ Uint16 peek16(Uint8 *m, Uint16 a);
46 46
 int uxn_boot(Uxn *c);
47 47
 int uxn_eval(Uxn *u, Uint16 vec);
48 48
 int uxn_halt(Uxn *u, Uint8 error, char *name, int id);
49
-Device *uxn_port(Uxn *u, Uint8 id, char *name, void (*talkfn)(Device *, Uint8, Uint8));
49
+Device *uxn_port(Uxn *u, Uint8 id, void (*talkfn)(Device *, Uint8, Uint8));
... ...
@@ -167,22 +167,22 @@ main(int argc, char **argv)
167 167
 	if(!load(&u, argv[1]))
168 168
 		return error("Load", "Failed");
169 169
 
170
-	devsystem = uxn_port(&u, 0x0, "system", system_talk);
171
-	devconsole = uxn_port(&u, 0x1, "console", console_talk);
172
-	uxn_port(&u, 0x2, "empty", nil_talk);
173
-	uxn_port(&u, 0x3, "empty", nil_talk);
174
-	uxn_port(&u, 0x4, "empty", nil_talk);
175
-	uxn_port(&u, 0x5, "empty", nil_talk);
176
-	uxn_port(&u, 0x6, "empty", nil_talk);
177
-	uxn_port(&u, 0x7, "empty", nil_talk);
178
-	uxn_port(&u, 0x8, "empty", nil_talk);
179
-	uxn_port(&u, 0x9, "empty", nil_talk);
180
-	uxn_port(&u, 0xa, "file", file_talk);
181
-	uxn_port(&u, 0xb, "datetime", datetime_talk);
182
-	uxn_port(&u, 0xc, "empty", nil_talk);
183
-	uxn_port(&u, 0xd, "empty", nil_talk);
184
-	uxn_port(&u, 0xe, "empty", nil_talk);
185
-	uxn_port(&u, 0xf, "empty", nil_talk);
170
+	/* system   */ devsystem = uxn_port(&u, 0x0, system_talk);
171
+	/* console  */ devconsole = uxn_port(&u, 0x1, console_talk);
172
+	/* empty    */ uxn_port(&u, 0x2, nil_talk);
173
+	/* empty    */ uxn_port(&u, 0x3, nil_talk);
174
+	/* empty    */ uxn_port(&u, 0x4, nil_talk);
175
+	/* empty    */ uxn_port(&u, 0x5, nil_talk);
176
+	/* empty    */ uxn_port(&u, 0x6, nil_talk);
177
+	/* empty    */ uxn_port(&u, 0x7, nil_talk);
178
+	/* empty    */ uxn_port(&u, 0x8, nil_talk);
179
+	/* empty    */ uxn_port(&u, 0x9, nil_talk);
180
+	/* file     */ uxn_port(&u, 0xa, file_talk);
181
+	/* datetime */ uxn_port(&u, 0xb, datetime_talk);
182
+	/* empty    */ uxn_port(&u, 0xc, nil_talk);
183
+	/* empty    */ uxn_port(&u, 0xd, nil_talk);
184
+	/* empty    */ uxn_port(&u, 0xe, nil_talk);
185
+	/* empty    */ uxn_port(&u, 0xf, nil_talk);
186 186
 
187 187
 	run(&u);
188 188
 
... ...
@@ -525,24 +525,24 @@ main(int argc, char **argv)
525 525
 	if(!init())
526 526
 		return error("Init", "Failed to initialize emulator.");
527 527
 
528
-	devsystem = uxn_port(&u, 0x0, "system", system_talk);
529
-	devconsole = uxn_port(&u, 0x1, "console", console_talk);
530
-	devscreen = uxn_port(&u, 0x2, "screen", screen_talk);
531
-	devaudio0 = uxn_port(&u, 0x3, "audio0", audio_talk);
532
-	uxn_port(&u, 0x4, "audio1", audio_talk);
533
-	uxn_port(&u, 0x5, "audio2", audio_talk);
534
-	uxn_port(&u, 0x6, "audio3", audio_talk);
535
-	uxn_port(&u, 0x7, "---", nil_talk);
536
-	devctrl = uxn_port(&u, 0x8, "controller", nil_talk);
537
-	devmouse = uxn_port(&u, 0x9, "mouse", nil_talk);
538
-	uxn_port(&u, 0xa, "file", file_talk);
539
-	uxn_port(&u, 0xb, "datetime", datetime_talk);
540
-	uxn_port(&u, 0xc, "---", nil_talk);
541
-	uxn_port(&u, 0xd, "---", nil_talk);
542
-	uxn_port(&u, 0xe, "---", nil_talk);
543
-	uxn_port(&u, 0xf, "---", nil_talk);
544
-
545
-	/* Write screen size to dev/screen */
528
+	/* system   */ devsystem = uxn_port(&u, 0x0, system_talk);
529
+	/* console  */ devconsole = uxn_port(&u, 0x1, console_talk);
530
+	/* screen   */ devscreen = uxn_port(&u, 0x2, screen_talk);
531
+	/* audio0   */ devaudio0 = uxn_port(&u, 0x3, audio_talk);
532
+	/* audio1   */ uxn_port(&u, 0x4, audio_talk);
533
+	/* audio2   */ uxn_port(&u, 0x5, audio_talk);
534
+	/* audio3   */ uxn_port(&u, 0x6, audio_talk);
535
+	/* unused   */ uxn_port(&u, 0x7, nil_talk);
536
+	/* control  */ devctrl = uxn_port(&u, 0x8, nil_talk);
537
+	/* mouse    */ devmouse = uxn_port(&u, 0x9, nil_talk);
538
+	/* file     */ uxn_port(&u, 0xa, file_talk);
539
+	/* datetime */ uxn_port(&u, 0xb, datetime_talk);
540
+	/* unused   */ uxn_port(&u, 0xc, nil_talk);
541
+	/* unused   */ uxn_port(&u, 0xd, nil_talk);
542
+	/* unused   */ uxn_port(&u, 0xe, nil_talk);
543
+	/* unused   */ uxn_port(&u, 0xf, nil_talk);
544
+
545
+	/* Write screen size */
546 546
 	poke16(devscreen->dat, 2, ppu.width);
547 547
 	poke16(devscreen->dat, 4, ppu.height);
548 548