Removed link device

This commit is contained in:
Devine Lu Linvega 2024-01-15 09:26:14 -08:00
parent 71c8d44051
commit cb72daf8d0
4 changed files with 3 additions and 88 deletions

View File

@ -1,5 +1,5 @@
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
CLI_src=src/uxn.c src/devices/system.c src/devices/console.c src/devices/file.c src/devices/datetime.c
EMU_src=${CLI_src} src/devices/screen.c src/devices/controller.c src/devices/mouse.c
RELEASE_flags=-DNDEBUG -O2 -g0 -s
@ -31,6 +31,6 @@ clean:
bin/uxnasm: src/uxnasm.c
@ cc ${RELEASE_flags} ${CFLAGS} src/uxnasm.c -o bin/uxnasm
bin/uxncli: ${CLI_src} src/uxncli.c
@ cc ${RELEASE_flags} ${CFLAGS} ${CLI_src} src/uxncli.c -lutil -pthread -o bin/uxncli
@ cc ${RELEASE_flags} ${CFLAGS} ${CLI_src} src/uxncli.c -lutil -o bin/uxncli
bin/uxn11: ${EMU_src} src/uxn11.c
@ cc ${RELEASE_flags} ${CFLAGS} ${EMU_src} src/uxn11.c -lX11 -lutil -pthread -o bin/uxn11
@ cc ${RELEASE_flags} ${CFLAGS} ${EMU_src} src/uxn11.c -lX11 -lutil -o bin/uxn11

View File

@ -1,69 +0,0 @@
#include <stdlib.h>
#include <stdio.h>
#include <pthread.h>
#include "../uxn.h"
/*
Copyright (c) 2023 Devine Lu Linvega
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE.
*/
pthread_t threads[8];
static int tids[8];
static Uint16 link_vectors[8];
static Uint8 *link_ram;
static void *
link_eval(void *x)
{
int tid = *((int *)x);
Uxn u;
Uint16 vector = link_vectors[tid];
u.ram = link_ram;
u.wst.ptr = u.rst.ptr = 0;
uxn_eval(&u, link_vectors[tid]);
threads[tid] = 0;
link_vectors[tid] = 0;
return NULL;
}
static void
link_init(Uint8 *ram, int id, Uint16 vector)
{
tids[id] = id;
link_vectors[id] = vector;
link_ram = ram;
pthread_create(&threads[id], NULL, link_eval, (void *)&tids[id]);
}
static void
link_wait(int id)
{
pthread_join(threads[id], NULL);
threads[id] = 0;
}
Uint8
link_dei(Uxn *u, Uint8 addr)
{
/* TODO: return non-zero if active */
return 0;
}
void
link_deo(Uint8 *ram, Uint8 *d, Uint8 port)
{
Uint8 id = port >> 0x1;
Uint16 vector = PEEK2(d + port - 1);
if(threads[id])
link_wait(id);
if(vector)
link_init(ram, id, vector);
}

View File

@ -1,15 +0,0 @@
/*
Copyright (c) 2022 Devine Lu Linvega, Andrew Alderwick
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE.
*/
#define LINK_VERSION 1
Uint8 link_dei(Uxn *u, Uint8 addr);
void link_deo(Uint8 *ram, Uint8 *d, Uint8 port);

View File

@ -83,7 +83,6 @@ emu_deo(Uxn *u, Uint8 addr, Uint8 value)
case 0x20: screen_deo(u->ram, &u->dev[d], p); break;
case 0xa0: file_deo(0, u->ram, &u->dev[d], p); break;
case 0xb0: file_deo(1, u->ram, &u->dev[d], p); break;
case 0xf0: link_deo(u->ram, &u->dev[d], p); break;
}
}