commit 6213089

neauoire  ·  2022-04-05 16:01:05 +0000 UTC
parent dbd4300
Removed datetime as Device
5 files changed,  +11, -12
+3, -3
 1@@ -12,14 +12,14 @@ if [ "${1}" = '--install' ];
 2 then
 3 	echo "Installing.."
 4 	gcc src/uxn.c src/devices/system.c src/devices/screen.c src/devices/controller.c src/devices/mouse.c src/devices/file.c src/devices/datetime.c src/uxn11.c -D_POSIX_C_SOURCE=199309L -DNDEBUG -Os -g0 -s -o bin/uxn11 -lX11
 5-	gcc src/uxn.c src/devices/system.c src/devices/file.c src/devices/datetime.c src/uxncli.c -D_POSIX_C_SOURCE=199309L -DNDEBUG -Os -g0 -s -o bin/uxncli
 6+	# gcc src/uxn.c src/devices/system.c src/devices/file.c src/devices/datetime.c src/uxncli.c -D_POSIX_C_SOURCE=199309L -DNDEBUG -Os -g0 -s -o bin/uxncli
 7 	cp bin/uxn11 ~/bin
 8 else
 9 	gcc -std=c89 -D_POSIX_C_SOURCE=199309L -DDEBUG -Wall -Wno-unknown-pragmas -Wpedantic -Wshadow -Wextra -Werror=implicit-int -Werror=incompatible-pointer-types -Werror=int-conversion -Wvla -g -Og -fsanitize=address -fsanitize=undefined src/uxn.c src/devices/system.c src/devices/screen.c src/devices/controller.c src/devices/mouse.c src/devices/file.c src/devices/datetime.c src/uxn11.c -o bin/uxn11 -lX11
10-	gcc -std=c89 -D_POSIX_C_SOURCE=199309L -DDEBUG -Wall -Wno-unknown-pragmas -Wpedantic -Wshadow -Wextra -Werror=implicit-int -Werror=incompatible-pointer-types -Werror=int-conversion -Wvla -g -Og -fsanitize=address -fsanitize=undefined src/uxn.c src/devices/system.c src/devices/file.c src/devices/datetime.c src/uxncli.c -o bin/uxncli
11+	# gcc -std=c89 -D_POSIX_C_SOURCE=199309L -DDEBUG -Wall -Wno-unknown-pragmas -Wpedantic -Wshadow -Wextra -Werror=implicit-int -Werror=incompatible-pointer-types -Werror=int-conversion -Wvla -g -Og -fsanitize=address -fsanitize=undefined src/uxn.c src/devices/system.c src/devices/file.c src/devices/datetime.c src/uxncli.c -o bin/uxncli
12 fi
13 
14 echo "Done."
15 
16 # echo "Running.."
17-bin/uxn11 ~/roms/left.rom
18+bin/uxn11 ~/roms/catclock.rom
+2, -2
 1@@ -16,7 +16,7 @@ WITH REGARD TO THIS SOFTWARE.
 2 */
 3 
 4 Uint8
 5-datetime_dei(Device *d, Uint8 port)
 6+datetime_dei(Uint8 *d, Uint8 port)
 7 {
 8 	time_t seconds = time(NULL);
 9 	struct tm zt = {0};
10@@ -35,6 +35,6 @@ datetime_dei(Device *d, Uint8 port)
11 	case 0x8: return t->tm_yday >> 8;
12 	case 0x9: return t->tm_yday;
13 	case 0xa: return t->tm_isdst;
14-	default: return d->dat[port];
15+	default: return d[port];
16 	}
17 }
+1, -1
1@@ -10,4 +10,4 @@ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
2 WITH REGARD TO THIS SOFTWARE.
3 */
4 
5-Uint8 datetime_dei(Device *d, Uint8 port);
6+Uint8 datetime_dei(Uint8 *d, Uint8 port);
+0, -1
1@@ -32,7 +32,6 @@ uxn_eval(Uxn *u, Uint16 pc)
2 	unsigned int a, b, c, j, k, bs, instr, errcode;
3 	Uint8 kptr, *sp;
4 	Stack *src, *dst;
5-	Device *dev;
6 	if(!pc || u->dev[0].dat[0xf]) return 0;
7 	while((instr = u->ram[pc++])) {
8 		/* Return Mode */
+5, -5
 1@@ -64,10 +64,10 @@ uxn11_dei(struct Uxn *u, Uint8 addr)
 2 	Uint8 p = addr & 0x0f;
 3 	Device *d = &u->dev[addr >> 4];
 4 	switch(addr & 0xf0) {
 5-	case 0x20: screen_dei(d, p); break;
 6-	case 0xa0: file_dei(d, p); break;
 7-	case 0xb0: file_dei(d, p); break;
 8-	case 0xc0: datetime_dei(d, p); break;
 9+	case 0x20: return screen_dei(d, p); break;
10+	case 0xa0: return file_dei(d, p); break;
11+	case 0xb0: return file_dei(d, p); break;
12+	case 0xc0: return datetime_dei(d->dat, p); break;
13 	}
14 	return d->dat[p];
15 }
16@@ -204,7 +204,7 @@ start(Uxn *u, char *rom)
17 	/* mouse    */ devmouse = uxn_port(u, 0x9, nil_dei, nil_deo);
18 	/* file0    */ uxn_port(u, 0xa, file_dei, file_deo);
19 	/* file1    */ uxn_port(u, 0xb, file_dei, file_deo);
20-	/* datetime */ uxn_port(u, 0xc, datetime_dei, nil_deo);
21+	/* datetime */ uxn_port(u, 0xc, nil_dei, nil_deo);
22 	/* empty    */ uxn_port(u, 0xd, nil_dei, nil_deo);
23 	/* reserved */ uxn_port(u, 0xe, nil_dei, nil_deo);
24 	/* reserved */ uxn_port(u, 0xf, nil_dei, nil_deo);