Compare commits

...

2 Commits

Author SHA1 Message Date
~d6 3a1b8eca03 update spec to add version 2023-12-20 10:11:06 -05:00
~d6 ea29d3bce6 get console compiling on netbsd 2023-12-20 10:10:50 -05:00
3 changed files with 19 additions and 14 deletions

View File

@ -110,11 +110,13 @@ following expansion layout:
- operation (1 byte): 03 (uuid extension)
- device (1 byte): 10 (console)
- uuid (16 bytes): 0123 1250 d878 4462 bc41 d092 7645 a2fa
- flags (2 byte): 0000 (may be updated by emulator)
- version (1 byte): 00 (set to non-zero by supporting emulators)
- flags (2 byte): 0000 (updated by supporting emulators)
after being loaded, flags will be 0x0000 if the console expansion is
not supported. otherwise, it will contain one or more of the following
flags:
after being loaded, version will be non-zero if console expansion is
supported, and zero otherwise. flags will contain bits describing the
available capabilities (0x0000 if console expansion is unsupported).
the flags are as follows:
- 0x0001: supports `execute`
- 0x0002: supports `kill`
@ -139,7 +141,7 @@ that determines whether the console expansion can be used:
@enable-uxn-console ...
@query 03 10 ( uuid ) 0123 1250 d878 4462 bc41 d092 7645 a2fa &flags 0000
@query 03 10 ( uuid ) 0123 1250 d878 4462 bc41 d092 7645 a2fa &flags 00 0000
note that uxn11 unconditionally enables the expanded console. so in
this case the uuid-based extension mechanism is only used to detect

View File

@ -1,6 +1,10 @@
#undef _POSIX_C_SOURCE
#define _POSIX_C_SOURCE 200112L
#ifdef __NetBSD__
#define _NETBSD_SOURCE
#endif
#include <poll.h>
#include <signal.h>
#include <stdio.h>
@ -16,6 +20,7 @@
#ifdef __NetBSD__
#include <sys/ioctl.h>
#include <sys/termios.h>
#include <util.h>
#endif
@ -225,7 +230,7 @@ host_raw_tty()
/* corresponds to `stty raw -echo` */
term.c_cflag |= (CS8);
term.c_iflag &= ~(IGNBRK | BRKINT | IGNPAR | PARMRK | INPCK | ISTRIP);
term.c_iflag &= ~(INLCR | IGNCR | ICRNL | IXON | IXOFF | IUCLC | IXANY | IMAXBEL);
term.c_iflag &= ~(INLCR | IGNCR | ICRNL | IXON | IXOFF | IXANY | IMAXBEL);
term.c_lflag &= ~(ICANON | ISIG | ECHO);
term.c_oflag &= ~(OPOST);
term.c_cc[VMIN] = 0;

View File

@ -132,13 +132,11 @@ system_expansion_uxn38_device(Uxn *u, Uint8 *ram, Uint16 addr)
{
Uint8 dev_id = ram[addr + 1];
Uint8 *uuid = &ram[addr + 2];
if(uuid_eq(uuid, console_uuid) != 0)
if(dev_id == 0x10) {
ram[addr + 18] = 0x00;
ram[addr + 19] = 0xff;
} else {
ram[addr + 18] = 0x00;
if(uuid_eq(uuid, console_uuid) != 0) {
int ok = dev_id == 0x10 ? 0xff : 0x00;
ram[addr + 18] = ok;
ram[addr + 19] = 0x00;
ram[addr + 20] = ok;
}
}