diff --git a/console.txt b/console.txt index d3daa0c..6ef7f62 100644 --- a/console.txt +++ b/console.txt @@ -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 diff --git a/src/devices/console.c b/src/devices/console.c index 434eb1a..eb9c069 100644 --- a/src/devices/console.c +++ b/src/devices/console.c @@ -1,6 +1,10 @@ #undef _POSIX_C_SOURCE #define _POSIX_C_SOURCE 200112L +#ifdef __NetBSD__ +#define _NETBSD_SOURCE +#endif + #include #include #include @@ -16,6 +20,7 @@ #ifdef __NetBSD__ #include +#include #include #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; diff --git a/src/devices/system.c b/src/devices/system.c index 3f55aad..e958735 100644 --- a/src/devices/system.c +++ b/src/devices/system.c @@ -132,14 +132,12 @@ 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; - ram[addr + 19] = 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; + } } /* IO */