From 0ed261750662ba4a2d16cea2327a70eb3429e5fe Mon Sep 17 00:00:00 2001 From: neauoire Date: Thu, 24 Aug 2023 21:25:11 -0700 Subject: [PATCH] Setting the stage for link device --- makefile | 6 +++--- src/devices/link.c | 27 +++++++++++++++++++++++++++ src/devices/link.h | 17 +++++++++++++++++ src/devices/system.c | 3 ++- src/uxn11.c | 2 ++ src/uxncli.c | 2 ++ 6 files changed, 53 insertions(+), 4 deletions(-) create mode 100644 src/devices/link.c create mode 100644 src/devices/link.h diff --git a/makefile b/makefile index 86cc7bf..29434aa 100644 --- a/makefile +++ b/makefile @@ -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 +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 EMU_src=${CLI_src} src/devices/screen.c src/devices/controller.c src/devices/mouse.c RELEASE_flags=-DNDEBUG -O2 -g0 -s @@ -29,6 +29,6 @@ clean: bin/uxnasm: src/uxnasm.c @ cc ${RELEASE_flags} src/uxnasm.c -o bin/uxnasm bin/uxncli: ${CLI_src} src/uxncli.c - @ cc ${RELEASE_flags} ${CLI_src} src/uxncli.c -o bin/uxncli + @ cc ${RELEASE_flags} ${CLI_src} src/uxncli.c -pthread -o bin/uxncli bin/uxn11: ${EMU_src} src/uxn11.c - @ cc ${RELEASE_flags} ${EMU_src} src/uxn11.c -lX11 -o bin/uxn11 + @ cc ${RELEASE_flags} ${EMU_src} src/uxn11.c -lX11 -pthread -o bin/uxn11 diff --git a/src/devices/link.c b/src/devices/link.c new file mode 100644 index 0000000..c80501c --- /dev/null +++ b/src/devices/link.c @@ -0,0 +1,27 @@ +#include +#include +#include + +#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. +*/ + +Uint8 +link_dei(Uxn *u, Uint8 addr) +{ + return 0; +} + +void +link_deo(Uint8 *ram, Uint8 *d, Uint8 port) +{ +} diff --git a/src/devices/link.h b/src/devices/link.h new file mode 100644 index 0000000..9939f24 --- /dev/null +++ b/src/devices/link.h @@ -0,0 +1,17 @@ +/* +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 +#define LINK_DEIMASK 0x0000 +#define LINK_DEOMASK 0xaaaa + +Uint8 link_dei(Uxn *u, Uint8 addr); +void link_deo(Uxn *u, Uint8 *d, Uint8 port); diff --git a/src/devices/system.c b/src/devices/system.c index 35984fa..9cb66fb 100644 --- a/src/devices/system.c +++ b/src/devices/system.c @@ -89,7 +89,8 @@ system_version(Uxn *u, char *name, char *date) } void -system_boot(Uxn *u, int soft){ +system_boot(Uxn *u, int soft) +{ int i; for(i = 0x100 * soft; i < 0x10000; i++) u->ram[i] = 0; diff --git a/src/uxn11.c b/src/uxn11.c index 3ab8137..81a5c7e 100644 --- a/src/uxn11.c +++ b/src/uxn11.c @@ -15,6 +15,7 @@ #include "devices/mouse.h" #include "devices/file.h" #include "devices/datetime.h" +#include "devices/link.h" /* Copyright (c) 2022 Devine Lu Linvega @@ -70,6 +71,7 @@ emu_deo(Uxn *u, Uint8 addr) 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, &u->dev[d], p); break; } } diff --git a/src/uxncli.c b/src/uxncli.c index 65082ba..0596e03 100644 --- a/src/uxncli.c +++ b/src/uxncli.c @@ -6,6 +6,7 @@ #include "devices/console.h" #include "devices/file.h" #include "devices/datetime.h" +#include "devices/link.h" /* Copyright (c) 2021-2023 Devine Lu Linvega, Andrew Alderwick @@ -39,6 +40,7 @@ emu_deo(Uxn *u, Uint8 addr) case 0x10: console_deo(&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, &u->dev[d], p); break; } }