commit 387f3c7

neauoire  ·  2022-03-28 16:51:38 +0000 UTC
parent 96b49d4
Completed file implementation
2 files changed,  +18, -6
+3, -3
 1@@ -22,12 +22,12 @@ cc src/devices/datetime.c src/devices/system.c src/devices/file.c src/uxn.c -DND
 2 
 3 - `00` system
 4 - `10` console(partial)
 5-- `20` screen(partial/vector)
 6+- `20` screen
 7 - `30` audio(missing)
 8 - `70` midi(missing)
 9 - `80` controller
10-- `90` mouse(partial/scroll)
11-- `a0` file(missing)
12+- `90` mouse(partial)
13+- `a0` file
14 - `c0` datetime
15 
16 ## Contributing
+15, -3
 1@@ -19,7 +19,7 @@ static Display *display;
 2 static Visual *visual;
 3 static Window window;
 4 
 5-static Device *devscreen, *devctrl, *devmouse;
 6+static Device *devscreen, *devctrl, *devmouse, *devfile0;
 7 
 8 #define WIDTH 64 * 8
 9 #define HEIGHT 40 * 8
10@@ -38,6 +38,18 @@ system_deo_special(Device *d, Uint8 port)
11 		screen_palette(&uxn_screen, &d->dat[0x8]);
12 }
13 
14+static void
15+file_deo(Device *d, Uint8 port)
16+{
17+	file_i_deo(d - devfile0, d, port);
18+}
19+
20+static Uint8
21+file_dei(Device *d, Uint8 port)
22+{
23+	return file_i_dei(d - devfile0, d, port);
24+}
25+
26 static int
27 console_input(Uxn *u, char c)
28 {
29@@ -195,8 +207,8 @@ start(Uxn *u, char *rom)
30 	/* empty    */ uxn_port(u, 0x7, nil_dei, nil_deo);
31 	/* control  */ devctrl = uxn_port(u, 0x8, nil_dei, nil_deo);
32 	/* mouse    */ devmouse = uxn_port(u, 0x9, nil_dei, nil_deo);
33-	/* file     */ uxn_port(u, 0xa, nil_dei, nil_deo);
34-	/* datetime */ uxn_port(u, 0xb, nil_dei, nil_deo);
35+	/* file0    */ devfile0 = uxn_port(u, 0xa, file_dei, file_deo);
36+	/* file1    */ uxn_port(u, 0xb, file_dei, file_deo);
37 	/* empty    */ uxn_port(u, 0xc, datetime_dei, nil_deo);
38 	/* empty    */ uxn_port(u, 0xd, nil_dei, nil_deo);
39 	/* empty    */ uxn_port(u, 0xe, nil_dei, nil_deo);