Setting the stage for link device

This commit is contained in:
neauoire 2023-08-24 21:25:11 -07:00
parent b3c68a17fb
commit 0ed2617506
6 changed files with 53 additions and 4 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 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 EMU_src=${CLI_src} src/devices/screen.c src/devices/controller.c src/devices/mouse.c
RELEASE_flags=-DNDEBUG -O2 -g0 -s RELEASE_flags=-DNDEBUG -O2 -g0 -s
@ -29,6 +29,6 @@ clean:
bin/uxnasm: src/uxnasm.c bin/uxnasm: src/uxnasm.c
@ cc ${RELEASE_flags} src/uxnasm.c -o bin/uxnasm @ cc ${RELEASE_flags} src/uxnasm.c -o bin/uxnasm
bin/uxncli: ${CLI_src} src/uxncli.c 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 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

27
src/devices/link.c Normal file
View File

@ -0,0 +1,27 @@
#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.
*/
Uint8
link_dei(Uxn *u, Uint8 addr)
{
return 0;
}
void
link_deo(Uint8 *ram, Uint8 *d, Uint8 port)
{
}

17
src/devices/link.h Normal file
View File

@ -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);

View File

@ -89,7 +89,8 @@ system_version(Uxn *u, char *name, char *date)
} }
void void
system_boot(Uxn *u, int soft){ system_boot(Uxn *u, int soft)
{
int i; int i;
for(i = 0x100 * soft; i < 0x10000; i++) for(i = 0x100 * soft; i < 0x10000; i++)
u->ram[i] = 0; u->ram[i] = 0;

View File

@ -15,6 +15,7 @@
#include "devices/mouse.h" #include "devices/mouse.h"
#include "devices/file.h" #include "devices/file.h"
#include "devices/datetime.h" #include "devices/datetime.h"
#include "devices/link.h"
/* /*
Copyright (c) 2022 Devine Lu Linvega 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 0x20: screen_deo(u->ram, &u->dev[d], p); break;
case 0xa0: file_deo(0, 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 0xb0: file_deo(1, u->ram, &u->dev[d], p); break;
case 0xf0: link_deo(u, &u->dev[d], p); break;
} }
} }

View File

@ -6,6 +6,7 @@
#include "devices/console.h" #include "devices/console.h"
#include "devices/file.h" #include "devices/file.h"
#include "devices/datetime.h" #include "devices/datetime.h"
#include "devices/link.h"
/* /*
Copyright (c) 2021-2023 Devine Lu Linvega, Andrew Alderwick 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 0x10: console_deo(&u->dev[d], p); break;
case 0xa0: file_deo(0, 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 0xb0: file_deo(1, u->ram, &u->dev[d], p); break;
case 0xf0: link_deo(u, &u->dev[d], p); break;
} }
} }