commit 121f61e
neauoire
·
2022-04-05 17:48:13 +0000 UTC
parent 5d80ab0
Removed uxn_port
5 files changed,
+8,
-36
+5,
-5
1@@ -154,7 +154,7 @@ file_delete(UxnFile *c)
2 /* IO */
3
4 void
5-file_deo(Uint8 id, Device *d, Uint8 port)
6+file_deo(Uint8 id, Uint8 *ram, Device *d, Uint8 port)
7 {
8 UxnFile *c = &uxn_file[id];
9 Uint16 addr, len, res;
10@@ -164,7 +164,7 @@ file_deo(Uint8 id, Device *d, Uint8 port)
11 DEVPEEK16(len, 0xa);
12 if(len > 0x10000 - addr)
13 len = 0x10000 - addr;
14- res = file_stat(c, &d->u->ram[addr], len);
15+ res = file_stat(c, &ram[addr], len);
16 DEVPOKE16(0x2, res);
17 break;
18 case 0x6:
19@@ -173,7 +173,7 @@ file_deo(Uint8 id, Device *d, Uint8 port)
20 break;
21 case 0x9:
22 DEVPEEK16(addr, 0x8);
23- res = file_init(c, (char *)&d->u->ram[addr], 0x10000 - addr);
24+ res = file_init(c, (char *)&ram[addr], 0x10000 - addr);
25 DEVPOKE16(0x2, res);
26 break;
27 case 0xd:
28@@ -181,7 +181,7 @@ file_deo(Uint8 id, Device *d, Uint8 port)
29 DEVPEEK16(len, 0xa);
30 if(len > 0x10000 - addr)
31 len = 0x10000 - addr;
32- res = file_read(c, &d->u->ram[addr], len);
33+ res = file_read(c, &ram[addr], len);
34 DEVPOKE16(0x2, res);
35 break;
36 case 0xf:
37@@ -189,7 +189,7 @@ file_deo(Uint8 id, Device *d, Uint8 port)
38 DEVPEEK16(len, 0xa);
39 if(len > 0x10000 - addr)
40 len = 0x10000 - addr;
41- res = file_write(c, &d->u->ram[addr], len, d->dat[0x7]);
42+ res = file_write(c, &ram[addr], len, d->dat[0x7]);
43 DEVPOKE16(0x2, res);
44 break;
45 }
+1,
-1
1@@ -13,6 +13,6 @@ WITH REGARD TO THIS SOFTWARE.
2 #define POLYFILEY 2
3 #define DEV_FILE0 0xa
4
5-void file_deo(Uint8 id, Device *d, Uint8 port);
6+void file_deo(Uint8 id, Uint8 *ram, Device *d, Uint8 port);
7 Uint8 file_dei(Uint8 id, Uint8 *d, Uint8 port);
8 int load_rom(Uxn *u, char *filename);
+0,
-8
1@@ -113,11 +113,3 @@ uxn_boot(Uxn *u, Uint8 *ram)
2 u->dpg = (Uint8*)(ram + 0x10200);
3 return 1;
4 }
5-
6-Device *
7-uxn_port(Uxn *u, Uint8 id)
8-{
9- Device *d = &u->dev[id];
10- d->u = u;
11- return d;
12-}
+0,
-2
1@@ -34,7 +34,6 @@ typedef struct {
2 } Stack;
3
4 typedef struct Device {
5- struct Uxn *u;
6 Uint8 dat[16];
7 } Device;
8
9@@ -49,4 +48,3 @@ typedef struct Uxn {
10 int uxn_boot(Uxn *u, Uint8 *ram);
11 int uxn_eval(Uxn *u, Uint16 pc);
12 int uxn_halt(Uxn *u, Uint8 error, Uint16 addr);
13-Device *uxn_port(Uxn *u, Uint8 id);
+2,
-20
1@@ -80,8 +80,8 @@ uxn11_deo(Uxn *u, Uint8 addr, Uint8 v)
2 case 0x00: system_deo(u, d->dat, p); break;
3 case 0x10: console_deo(d->dat, p); break;
4 case 0x20: screen_deo(u->ram, d->dat, p); break;
5- case 0xa0: file_deo(0, d, p); break;
6- case 0xb0: file_deo(1, d, p); break;
7+ case 0xa0: file_deo(0, u->ram, d, p); break;
8+ case 0xb0: file_deo(1, u->ram, d, p); break;
9 }
10 }
11
12@@ -176,24 +176,6 @@ start(Uxn *u, char *rom)
13 fprintf(stderr, "Loaded %s\n", rom);
14 u->dei = uxn11_dei;
15 u->deo = uxn11_deo;
16-
17- /* system */ uxn_port(u, 0x0);
18- /* console */ uxn_port(u, 0x1);
19- /* screen */ uxn_port(u, 0x2);
20- /* empty */ uxn_port(u, 0x3);
21- /* empty */ uxn_port(u, 0x4);
22- /* empty */ uxn_port(u, 0x5);
23- /* empty */ uxn_port(u, 0x6);
24- /* empty */ uxn_port(u, 0x7);
25- /* control */ uxn_port(u, 0x8);
26- /* mouse */ uxn_port(u, 0x9);
27- /* file0 */ uxn_port(u, 0xa);
28- /* file1 */ uxn_port(u, 0xb);
29- /* datetime */ uxn_port(u, 0xc);
30- /* empty */ uxn_port(u, 0xd);
31- /* reserved */ uxn_port(u, 0xe);
32- /* reserved */ uxn_port(u, 0xf);
33-
34 screen_resize(&uxn_screen, WIDTH, HEIGHT);
35 if(!uxn_eval(u, PAGE_PROGRAM))
36 return error("Boot", "Failed to start rom.");