Housekeeping
This commit is contained in:
parent
d98e8d43a8
commit
7a9bc710e6
|
@ -1,6 +1,6 @@
|
|||
# Uxn11
|
||||
|
||||
An emulator for the [Uxn stack-machine](https://wiki.xxiivv.com/site/uxn.html), written in ANSI C.
|
||||
An emulator for the [Uxn stack-machine](https://wiki.xxiivv.com/site/uxn.html), written in ANSI C. The emulator contains a few linux specific utilities in the Console device to allow for it to interface with the unix systems.
|
||||
|
||||
## Building
|
||||
|
||||
|
@ -37,7 +37,7 @@ bin/uxnemu bin/polycat.rom arg1 arg2
|
|||
The file device is _sandboxed_, meaning that it should not be able to read or write outside of the working directory.
|
||||
|
||||
- `00` system
|
||||
- `10` console
|
||||
- `10` console(+)
|
||||
- `20` screen
|
||||
- `80` controller
|
||||
- `90` mouse
|
||||
|
|
|
@ -41,10 +41,13 @@ static int from_child_fd[2];
|
|||
static int saved_in;
|
||||
static int saved_out;
|
||||
|
||||
struct winsize ws = {24, 80, 8, 12};
|
||||
|
||||
static void
|
||||
parse_args(Uint8 *d, Uxn *u)
|
||||
parse_args(Uxn *u, Uint8 *d)
|
||||
{
|
||||
int addr = (d[0x3] << 8) | d[0x4];
|
||||
Uint8 *port_addr = d + 0x3;
|
||||
int addr = PEEK2(port_addr);
|
||||
char *pos = (char *)&u->ram[addr];
|
||||
int i = 0;
|
||||
do {
|
||||
|
@ -57,7 +60,7 @@ parse_args(Uint8 *d, Uxn *u)
|
|||
|
||||
/* call after we're sure the process has exited */
|
||||
static void
|
||||
clean_after_child()
|
||||
clean_after_child(void)
|
||||
{
|
||||
child_pid = 0;
|
||||
if(child_mode >= 0x80) {
|
||||
|
@ -99,7 +102,7 @@ console_listen(Uxn *u, int i, int argc, char **argv)
|
|||
}
|
||||
|
||||
static void
|
||||
start_fork_pty(Uint8 *d, Uxn *u)
|
||||
start_fork_pty(Uint8 *d)
|
||||
{
|
||||
int fd = -1;
|
||||
pid_t pid = forkpty(&fd, NULL, NULL, NULL);
|
||||
|
@ -114,7 +117,6 @@ start_fork_pty(Uint8 *d, Uxn *u)
|
|||
} else { /*parent*/
|
||||
child_pid = pid;
|
||||
pty_fd = fd;
|
||||
struct winsize ws = {24, 80, 8, 12};
|
||||
ioctl(fd, TIOCSWINSZ, &ws);
|
||||
saved_in = dup(0);
|
||||
saved_out = dup(1);
|
||||
|
@ -124,7 +126,7 @@ start_fork_pty(Uint8 *d, Uxn *u)
|
|||
}
|
||||
|
||||
static void
|
||||
start_fork_pipe(Uint8 *d, Uxn *u)
|
||||
start_fork_pipe(Uint8 *d)
|
||||
{
|
||||
if(child_mode & 0x01) {
|
||||
/* parent writes to child's stdin */
|
||||
|
@ -196,12 +198,11 @@ start_fork(Uxn *u, Uint8 *d)
|
|||
fflush(stderr);
|
||||
kill_child(d);
|
||||
child_mode = d[0x5];
|
||||
parse_args(d, u);
|
||||
if (child_mode >= 0x80) {
|
||||
start_fork_pty(d, u);
|
||||
} else {
|
||||
start_fork_pipe(d, u);
|
||||
}
|
||||
parse_args(u, d);
|
||||
if(child_mode >= 0x80)
|
||||
start_fork_pty(d);
|
||||
else
|
||||
start_fork_pipe(d);
|
||||
}
|
||||
|
||||
Uint8
|
||||
|
|
|
@ -10,8 +10,6 @@ WITH REGARD TO THIS SOFTWARE.
|
|||
*/
|
||||
|
||||
#define CONSOLE_VERSION 1
|
||||
#define CONSOLE_DEIMASK 0x0000
|
||||
#define CONSOLE_DEOMASK 0x0300
|
||||
|
||||
#define CONSOLE_STD 0x1
|
||||
#define CONSOLE_ARG 0x2
|
||||
|
|
|
@ -10,8 +10,6 @@ WITH REGARD TO THIS SOFTWARE.
|
|||
*/
|
||||
|
||||
#define CONTROL_VERSION 1
|
||||
#define CONTROL_DEIMASK 0x0000
|
||||
#define CONTROL_DEOMASK 0x0000
|
||||
|
||||
void controller_down(Uxn *u, Uint8 *d, Uint8 mask);
|
||||
void controller_up(Uxn *u, Uint8 *d, Uint8 mask);
|
||||
|
|
|
@ -10,7 +10,5 @@ WITH REGARD TO THIS SOFTWARE.
|
|||
*/
|
||||
|
||||
#define DATETIME_VERSION 1
|
||||
#define DATETIME_DEIMASK 0x07ff
|
||||
#define DATETIME_DEOMASK 0x0000
|
||||
|
||||
Uint8 datetime_dei(Uxn *u, Uint8 addr);
|
||||
|
|
|
@ -10,8 +10,6 @@ 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(Uint8 *ram, Uint8 *d, Uint8 port);
|
||||
|
|
|
@ -10,8 +10,6 @@ WITH REGARD TO THIS SOFTWARE.
|
|||
*/
|
||||
|
||||
#define SCREEN_VERSION 1
|
||||
#define SCREEN_DEIMASK 0x003c
|
||||
#define SCREEN_DEOMASK 0xc028
|
||||
|
||||
typedef struct UxnScreen {
|
||||
int width, height, x1, y1, x2, y2;
|
||||
|
@ -19,14 +17,13 @@ typedef struct UxnScreen {
|
|||
Uint8 *fg, *bg;
|
||||
} UxnScreen;
|
||||
|
||||
extern UxnScreen uxn_screen;
|
||||
extern int emu_resize(int width, int height);
|
||||
|
||||
void screen_fill(Uint8 *layer, int x1, int y1, int x2, int y2, int color);
|
||||
void screen_palette(Uint8 *addr);
|
||||
void screen_resize(Uint16 width, Uint16 height);
|
||||
void screen_change(Uint16 x1, Uint16 y1, Uint16 x2, Uint16 y2);
|
||||
void screen_redraw(Uxn *u);
|
||||
|
||||
Uint8 screen_dei(Uxn *u, Uint8 addr);
|
||||
void screen_deo(Uint8 *ram, Uint8 *d, Uint8 port);
|
||||
|
||||
extern UxnScreen uxn_screen;
|
||||
extern int emu_resize(int width, int height);
|
|
@ -10,18 +10,14 @@ WITH REGARD TO THIS SOFTWARE.
|
|||
*/
|
||||
|
||||
#define SYSTEM_VERSION 2
|
||||
#define SYSTEM_DEIMASK 0x0030
|
||||
#define SYSTEM_DEOMASK 0xff38
|
||||
|
||||
#define RAM_PAGES 0x10
|
||||
|
||||
extern char *boot_rom;
|
||||
|
||||
void system_reboot(Uxn *u, char *rom, int soft);
|
||||
void system_inspect(Uxn *u);
|
||||
int system_version(char *emulator, char *date);
|
||||
int system_error(char *msg, const char *err);
|
||||
int system_init(Uxn *u, Uint8 *ram, char *rom);
|
||||
|
||||
Uint8 system_dei(Uxn *u, Uint8 addr);
|
||||
void system_deo(Uxn *u, Uint8 *d, Uint8 port);
|
||||
|
||||
extern char *boot_rom;
|
Loading…
Reference in New Issue