commit cb72daf
Devine Lu Linvega
·
2024-01-15 17:26:14 +0000 UTC
parent 71c8d44
Removed link device
4 files changed,
+3,
-88
M
makefile
+3,
-3
1@@ -1,5 +1,5 @@
2
3-CLI_src=src/uxn.c src/devices/system.c src/devices/console.c src/devices/file.c src/devices/datetime.c src/devices/link.c
4+CLI_src=src/uxn.c src/devices/system.c src/devices/console.c src/devices/file.c src/devices/datetime.c
5 EMU_src=${CLI_src} src/devices/screen.c src/devices/controller.c src/devices/mouse.c
6
7 RELEASE_flags=-DNDEBUG -O2 -g0 -s
8@@ -31,6 +31,6 @@ clean:
9 bin/uxnasm: src/uxnasm.c
10 @ cc ${RELEASE_flags} ${CFLAGS} src/uxnasm.c -o bin/uxnasm
11 bin/uxncli: ${CLI_src} src/uxncli.c
12- @ cc ${RELEASE_flags} ${CFLAGS} ${CLI_src} src/uxncli.c -lutil -pthread -o bin/uxncli
13+ @ cc ${RELEASE_flags} ${CFLAGS} ${CLI_src} src/uxncli.c -lutil -o bin/uxncli
14 bin/uxn11: ${EMU_src} src/uxn11.c
15- @ cc ${RELEASE_flags} ${CFLAGS} ${EMU_src} src/uxn11.c -lX11 -lutil -pthread -o bin/uxn11
16+ @ cc ${RELEASE_flags} ${CFLAGS} ${EMU_src} src/uxn11.c -lX11 -lutil -o bin/uxn11
+0,
-69
1@@ -1,69 +0,0 @@
2-#include <stdlib.h>
3-#include <stdio.h>
4-#include <pthread.h>
5-
6-#include "../uxn.h"
7-
8-/*
9-Copyright (c) 2023 Devine Lu Linvega
10-
11-Permission to use, copy, modify, and distribute this software for any
12-purpose with or without fee is hereby granted, provided that the above
13-copyright notice and this permission notice appear in all copies.
14-
15-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
16-WITH REGARD TO THIS SOFTWARE.
17-*/
18-
19-pthread_t threads[8];
20-static int tids[8];
21-static Uint16 link_vectors[8];
22-static Uint8 *link_ram;
23-
24-static void *
25-link_eval(void *x)
26-{
27- int tid = *((int *)x);
28- Uxn u;
29- Uint16 vector = link_vectors[tid];
30- u.ram = link_ram;
31- u.wst.ptr = u.rst.ptr = 0;
32- uxn_eval(&u, link_vectors[tid]);
33- threads[tid] = 0;
34- link_vectors[tid] = 0;
35- return NULL;
36-}
37-
38-static void
39-link_init(Uint8 *ram, int id, Uint16 vector)
40-{
41- tids[id] = id;
42- link_vectors[id] = vector;
43- link_ram = ram;
44- pthread_create(&threads[id], NULL, link_eval, (void *)&tids[id]);
45-}
46-
47-static void
48-link_wait(int id)
49-{
50- pthread_join(threads[id], NULL);
51- threads[id] = 0;
52-}
53-
54-Uint8
55-link_dei(Uxn *u, Uint8 addr)
56-{
57- /* TODO: return non-zero if active */
58- return 0;
59-}
60-
61-void
62-link_deo(Uint8 *ram, Uint8 *d, Uint8 port)
63-{
64- Uint8 id = port >> 0x1;
65- Uint16 vector = PEEK2(d + port - 1);
66- if(threads[id])
67- link_wait(id);
68- if(vector)
69- link_init(ram, id, vector);
70-}
+0,
-15
1@@ -1,15 +0,0 @@
2-/*
3-Copyright (c) 2022 Devine Lu Linvega, Andrew Alderwick
4-
5-Permission to use, copy, modify, and distribute this software for any
6-purpose with or without fee is hereby granted, provided that the above
7-copyright notice and this permission notice appear in all copies.
8-
9-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10-WITH REGARD TO THIS SOFTWARE.
11-*/
12-
13-#define LINK_VERSION 1
14-
15-Uint8 link_dei(Uxn *u, Uint8 addr);
16-void link_deo(Uint8 *ram, Uint8 *d, Uint8 port);
+0,
-1
1@@ -83,7 +83,6 @@ emu_deo(Uxn *u, Uint8 addr, Uint8 value)
2 case 0x20: screen_deo(u->ram, &u->dev[d], p); break;
3 case 0xa0: file_deo(0, u->ram, &u->dev[d], p); break;
4 case 0xb0: file_deo(1, u->ram, &u->dev[d], p); break;
5- case 0xf0: link_deo(u->ram, &u->dev[d], p); break;
6 }
7 }
8