Browse code

Setting up stage to add versioning

neauoire authored on 08/08/2023 21:13:07
Showing 14 changed files
... ...
@@ -81,8 +81,8 @@ else
81 81
 fi
82 82
 
83 83
 ${CC} ${CFLAGS} src/uxnasm.c -o bin/uxnasm
84
-${CC} ${CFLAGS} src/uxn.c src/devices/system.c src/devices/file.c src/devices/datetime.c src/devices/mouse.c src/devices/controller.c src/devices/screen.c src/devices/audio.c src/uxnemu.c ${UXNEMU_LDFLAGS} ${FILE_LDFLAGS} -o bin/uxnemu
85
-${CC} ${CFLAGS} src/uxn.c src/devices/system.c src/devices/file.c src/devices/datetime.c src/uxncli.c ${FILE_LDFLAGS} -o bin/uxncli
84
+${CC} ${CFLAGS} src/uxn.c src/devices/system.c src/devices/console.c src/devices/file.c src/devices/datetime.c src/devices/mouse.c src/devices/controller.c src/devices/screen.c src/devices/audio.c src/uxnemu.c ${UXNEMU_LDFLAGS} ${FILE_LDFLAGS} -o bin/uxnemu
85
+${CC} ${CFLAGS} src/uxn.c src/devices/system.c src/devices/console.c src/devices/file.c src/devices/datetime.c src/uxncli.c ${FILE_LDFLAGS} -o bin/uxncli
86 86
 
87 87
 if [ $install = 1 ]
88 88
 then
... ...
@@ -14,6 +14,7 @@ HFILES=\
14 14
 	src/devices/mouse.h\
15 15
 	src/devices/screen.h\
16 16
 	src/devices/system.h\
17
+	src/devices/console.h\
17 18
 	src/uxn.h\
18 19
 
19 20
 CLEANFILES=$TARG $ROM
... ...
@@ -34,19 +35,19 @@ bin:
34 35
 %.rom:Q: %.tal bin/uxnasm
35 36
 	bin/uxnasm $stem.tal $target >/dev/null
36 37
 
37
-bin/uxncli: file.$O datetime.$O system.$O uxncli.$O uxn.$O
38
+bin/uxncli: file.$O datetime.$O system.$O console.$O uxncli.$O uxn.$O
38 39
 	$LD $LDFLAGS -o $target $prereq
39 40
 
40 41
 bin/uxnasm: uxnasm.$O
41 42
 	$LD $LDFLAGS -o $target $prereq
42 43
 
43
-bin/uxnemu: audio.$O controller.$O datetime.$O file.$O mouse.$O screen.$O system.$O uxn.$O uxnemu.$O
44
+bin/uxnemu: audio.$O controller.$O datetime.$O file.$O mouse.$O screen.$O system.$O console.$O uxn.$O uxnemu.$O
44 45
 	$LD $LDFLAGS -o $target $prereq
45 46
 
46 47
 (uxnasm|uxncli|uxnemu|uxn)\.$O:R: src/\1.c
47 48
 	$CC $CFLAGS -Isrc -o $target src/$stem1.c
48 49
 
49
-(audio|controller|datetime|file|mouse|screen|system)\.$O:R: src/devices/\1.c
50
+(audio|controller|datetime|file|mouse|screen|system|console)\.$O:R: src/devices/\1.c
50 51
 	$CC $CFLAGS -Isrc -o $target src/devices/$stem1.c
51 52
 
52 53
 nuke:V: clean
... ...
@@ -12,6 +12,11 @@ WITH REGARD TO THIS SOFTWARE.
12 12
 
13 13
 typedef signed int Sint32;
14 14
 
15
+
16
+#define AUDIO_VERSION 1
17
+#define AUDIO_DEIMASK 0x0000
18
+#define AUDIO_DEOMASK 0x0000
19
+
15 20
 #define SAMPLE_FREQUENCY 44100
16 21
 #define POLYPHONY 4
17 22
 
18 23
new file mode 100644
... ...
@@ -0,0 +1,40 @@
1
+#include <stdio.h>
2
+#include <stdlib.h>
3
+
4
+#include "../uxn.h"
5
+#include "console.h"
6
+
7
+/*
8
+Copyright (c) 2022-2023 Devine Lu Linvega, Andrew Alderwick
9
+
10
+Permission to use, copy, modify, and distribute this software for any
11
+purpose with or without fee is hereby granted, provided that the above
12
+copyright notice and this permission notice appear in all copies.
13
+
14
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
15
+WITH REGARD TO THIS SOFTWARE.
16
+*/
17
+
18
+int
19
+console_input(Uxn *u, char c, int type)
20
+{
21
+	Uint8 *d = &u->dev[0x10];
22
+	d[0x2] = c;
23
+	d[0x7] = type;
24
+	return uxn_eval(u, PEEK2(d));
25
+}
26
+
27
+void
28
+console_deo(Uint8 *d, Uint8 port)
29
+{
30
+	switch(port) {
31
+	case 0x8:
32
+		fputc(d[port], stdout);
33
+		fflush(stdout);
34
+		return;
35
+	case 0x9:
36
+		fputc(d[port], stderr);
37
+		fflush(stderr);
38
+		return;
39
+	}
40
+}
0 41
\ No newline at end of file
1 42
new file mode 100644
... ...
@@ -0,0 +1,22 @@
1
+/*
2
+Copyright (c) 2022 Devine Lu Linvega, Andrew Alderwick
3
+
4
+Permission to use, copy, modify, and distribute this software for any
5
+purpose with or without fee is hereby granted, provided that the above
6
+copyright notice and this permission notice appear in all copies.
7
+
8
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9
+WITH REGARD TO THIS SOFTWARE.
10
+*/
11
+
12
+#define CONSOLE_VERSION 1
13
+#define CONSOLE_DEIMASK 0x0000
14
+#define CONSOLE_DEOMASK 0x0000
15
+
16
+#define CONSOLE_STD 0x1
17
+#define CONSOLE_ARG 0x2
18
+#define CONSOLE_EOA 0x3
19
+#define CONSOLE_END 0x4
20
+
21
+int console_input(Uxn *u, char c, int type);
22
+void console_deo(Uint8 *d, Uint8 port);
... ...
@@ -9,6 +9,10 @@ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 9
 WITH REGARD TO THIS SOFTWARE.
10 10
 */
11 11
 
12
+#define CONTROL_VERSION 1
13
+#define CONTROL_DEIMASK 0x0000
14
+#define CONTROL_DEOMASK 0x0000
15
+
12 16
 void controller_down(Uxn *u, Uint8 *d, Uint8 mask);
13 17
 void controller_up(Uxn *u, Uint8 *d, Uint8 mask);
14 18
 void controller_key(Uxn *u, Uint8 *d, Uint8 key);
... ...
@@ -9,4 +9,8 @@ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 9
 WITH REGARD TO THIS SOFTWARE.
10 10
 */
11 11
 
12
+#define DATETIME_VERSION 1
13
+#define DATETIME_DEIMASK 0x0000
14
+#define DATETIME_DEOMASK 0x0000
15
+
12 16
 Uint8 datetime_dei(Uxn *u, Uint8 addr);
... ...
@@ -9,6 +9,10 @@ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 9
 WITH REGARD TO THIS SOFTWARE.
10 10
 */
11 11
 
12
+#define FILE_VERSION 1
13
+#define FILE_DEIMASK 0x0000
14
+#define FILE_DEOMASK 0x0000
15
+
12 16
 #define POLYFILEY 2
13 17
 #define DEV_FILE0 0xa
14 18
 
... ...
@@ -9,6 +9,11 @@ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 9
 WITH REGARD TO THIS SOFTWARE.
10 10
 */
11 11
 
12
+
13
+#define MOUSE_VERSION 1
14
+#define MOUSE_DEIMASK 0x0000
15
+#define MOUSE_DEOMASK 0x0000
16
+
12 17
 void mouse_down(Uxn *u, Uint8 *d, Uint8 mask);
13 18
 void mouse_up(Uxn *u, Uint8 *d, Uint8 mask);
14 19
 void mouse_pos(Uxn *u, Uint8 *d, Uint16 x, Uint16 y);
... ...
@@ -10,6 +10,10 @@ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 10
 WITH REGARD TO THIS SOFTWARE.
11 11
 */
12 12
 
13
+#define SCREEN_VERSION 1
14
+#define SCREEN_DEIMASK 0x0000
15
+#define SCREEN_DEOMASK 0x0000
16
+
13 17
 typedef struct UxnScreen {
14 18
 	int width, height, x1, y1, x2, y2;
15 19
 	Uint32 palette[4], *pixels;
... ...
@@ -96,32 +96,6 @@ system_deo(Uxn *u, Uint8 *d, Uint8 port)
96 96
 	}
97 97
 }
98 98
 
99
-/* Console */
100
-
101
-int
102
-console_input(Uxn *u, char c, int type)
103
-{
104
-	Uint8 *d = &u->dev[0x10];
105
-	d[0x2] = c;
106
-	d[0x7] = type;
107
-	return uxn_eval(u, PEEK2(d));
108
-}
109
-
110
-void
111
-console_deo(Uint8 *d, Uint8 port)
112
-{
113
-	switch(port) {
114
-	case 0x8:
115
-		fputc(d[port], stdout);
116
-		fflush(stdout);
117
-		return;
118
-	case 0x9:
119
-		fputc(d[port], stderr);
120
-		fflush(stderr);
121
-		return;
122
-	}
123
-}
124
-
125 99
 /* Errors */
126 100
 
127 101
 int
... ...
@@ -9,16 +9,13 @@ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 9
 WITH REGARD TO THIS SOFTWARE.
10 10
 */
11 11
 
12
-#define RAM_PAGES 0x10
12
+#define SYSTEM_VERSION 1
13
+#define SYSTEM_DEIMASK 0x0000
14
+#define SYSTEM_DEOMASK 0x0000
13 15
 
14
-#define CONSOLE_STD 0x1
15
-#define CONSOLE_ARG 0x2
16
-#define CONSOLE_EOA 0x3
17
-#define CONSOLE_END 0x4
16
+#define RAM_PAGES 0x10
18 17
 
19 18
 int system_load(Uxn *u, char *filename);
20 19
 void system_inspect(Uxn *u);
21 20
 int system_error(char *msg, const char *err);
22 21
 void system_deo(Uxn *u, Uint8 *d, Uint8 port);
23
-int console_input(Uxn *u, char c, int type);
24
-void console_deo(Uint8 *d, Uint8 port);
... ...
@@ -3,6 +3,7 @@
3 3
 
4 4
 #include "uxn.h"
5 5
 #include "devices/system.h"
6
+#include "devices/console.h"
6 7
 #include "devices/file.h"
7 8
 #include "devices/datetime.h"
8 9
 
... ...
@@ -10,6 +10,7 @@
10 10
 #pragma clang diagnostic ignored "-Wtypedef-redefinition"
11 11
 #include <SDL.h>
12 12
 #include "devices/system.h"
13
+#include "devices/console.h"
13 14
 #include "devices/screen.h"
14 15
 #include "devices/audio.h"
15 16
 #include "devices/file.h"