#include #include #include #define STEP_MAX 0x80000000 #define PAGE_PROGRAM 0x100 #define RAM_PAGES 0x10 /* Copyright (c) 2021-2025 Devine Lu Linvega, Andrew Alderwick, Andrew Richards, Eiríkr Åsheim, Sigrid Solveig Haflínudóttir 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. cc -DNDEBUG -O2 -g0 -s src/uxncli.c -lutil -o bin/uxncli */ /* @|Uxn --------------------------------------------------------------- */ typedef unsigned char Uint8; typedef signed char Sint8; typedef unsigned short Uint16; typedef signed short Sint16; typedef unsigned int Uint32; typedef struct { Uint8 dat[0x100], ptr; } Stack; typedef struct Uxn { Uint8 *ram, dev[0x100]; Stack wst, rst; } Uxn; Uint8 emu_dei(Uint8 addr); void emu_deo(Uint8 addr, Uint8 value); static Uxn uxn; /* clang-format off */ #define PEEK2(d) (*(d) << 8 | (d)[1]) #define POKE2(d, v) { *(d) = (v) >> 8; (d)[1] = (v); } #define OPC(opc, init, body) {\ case 0x00|opc: {const int _2=0,_r=0;init body;} break;\ case 0x20|opc: {const int _2=1,_r=0;init body;} break;\ case 0x40|opc: {const int _2=0,_r=1;init body;} break;\ case 0x60|opc: {const int _2=1,_r=1;init body;} break;\ case 0x80|opc: {const int _2=0,_r=0,k=uxn.wst.ptr;init uxn.wst.ptr=k;body;} break;\ case 0xa0|opc: {const int _2=1,_r=0,k=uxn.wst.ptr;init uxn.wst.ptr=k;body;} break;\ case 0xc0|opc: {const int _2=0,_r=1,k=uxn.rst.ptr;init uxn.rst.ptr=k;body;} break;\ case 0xe0|opc: {const int _2=1,_r=1,k=uxn.rst.ptr;init uxn.rst.ptr=k;body;} break;\ } /* Microcode */ #define JMI a = uxn.ram[pc] << 8 | uxn.ram[pc + 1], pc += a + 2; #define REM if(_r) uxn.rst.ptr -= 1 + _2; else uxn.wst.ptr -= 1 + _2; #define INC(s) uxn.s.dat[uxn.s.ptr++] #define DEC(s) uxn.s.dat[--uxn.s.ptr] #define JMP(x) { if(_2) pc = x; else pc += (Sint8)x; } #define PO1(o) { o = _r ? DEC(rst) : DEC(wst);} #define PO2(o) { if(_r) o = DEC(rst), o |= DEC(rst) << 8; else o = DEC(wst), o |= DEC(wst) << 8; } #define POx(o) { if(_2) PO2(o) else PO1(o) } #define PU1(i) { if(_r) INC(rst) = i; else INC(wst) = i; } #define RP1(i) { if(_r) INC(wst) = i; else INC(rst) = i; } #define PUx(i) { if(_2) { c = (i); PU1(c >> 8) PU1(c) } else PU1(i) } #define GET(o) { if(_2) PO1(o[1]) PO1(o[0]) } #define PUT(i) { PU1(i[0]) if(_2) PU1(i[1]) } #define DEI(i,o) o[0] = emu_dei(i); if(_2) o[1] = emu_dei(i + 1); PUT(o) #define DEO(i,j) emu_deo(i, j[0]); if(_2) emu_deo(i + 1, j[1]); #define PEK(i,o,m) o[0] = uxn.ram[i]; if(_2) o[1] = uxn.ram[(i + 1) & m]; PUT(o) #define POK(i,j,m) uxn.ram[i] = j[0]; if(_2) uxn.ram[(i + 1) & m] = j[1]; int uxn_eval(Uint16 pc) { Uint32 a, b, c, x[2], y[2], z[2], step; if(!pc || uxn.dev[0x0f]) return 0; for(step = STEP_MAX; step; step--) { switch(uxn.ram[pc++]) { /* BRK */ case 0x00: return 1; /* JCI */ case 0x20: if(DEC(wst)) { JMI break; } pc += 2; break; /* JMI */ case 0x40: JMI break; /* JSI */ case 0x60: c = pc + 2; INC(rst) = c >> 8; INC(rst) = c; JMI break; /* LI2 */ case 0xa0: INC(wst) = uxn.ram[pc++]; /* fall-through */ /* LIT */ case 0x80: INC(wst) = uxn.ram[pc++]; break; /* L2r */ case 0xe0: INC(rst) = uxn.ram[pc++]; /* fall-through */ /* LIr */ case 0xc0: INC(rst) = uxn.ram[pc++]; break; /* INC */ OPC(0x01,POx(a),PUx(a + 1)) /* POP */ OPC(0x02,REM ,{}) /* NIP */ OPC(0x03,GET(x) REM ,PUT(x)) /* SWP */ OPC(0x04,GET(x) GET(y),PUT(x) PUT(y)) /* ROT */ OPC(0x05,GET(x) GET(y) GET(z),PUT(y) PUT(x) PUT(z)) /* DUP */ OPC(0x06,GET(x),PUT(x) PUT(x)) /* OVR */ OPC(0x07,GET(x) GET(y),PUT(y) PUT(x) PUT(y)) /* EQU */ OPC(0x08,POx(a) POx(b),PU1(b == a)) /* NEQ */ OPC(0x09,POx(a) POx(b),PU1(b != a)) /* GTH */ OPC(0x0a,POx(a) POx(b),PU1(b > a)) /* LTH */ OPC(0x0b,POx(a) POx(b),PU1(b < a)) /* JMP */ OPC(0x0c,POx(a),JMP(a)) /* JCN */ OPC(0x0d,POx(a) PO1(b),if(b) JMP(a)) /* JSR */ OPC(0x0e,POx(a),RP1(pc >> 8) RP1(pc) JMP(a)) /* STH */ OPC(0x0f,GET(x),RP1(x[0]) if(_2) RP1(x[1])) /* LDZ */ OPC(0x10,PO1(a),PEK(a, x, 0xff)) /* STZ */ OPC(0x11,PO1(a) GET(y),POK(a, y, 0xff)) /* LDR */ OPC(0x12,PO1(a),PEK(pc + (Sint8)a, x, 0xffff)) /* STR */ OPC(0x13,PO1(a) GET(y),POK(pc + (Sint8)a, y, 0xffff)) /* LDA */ OPC(0x14,PO2(a),PEK(a, x, 0xffff)) /* STA */ OPC(0x15,PO2(a) GET(y),POK(a, y, 0xffff)) /* DEI */ OPC(0x16,PO1(a),DEI(a, x)) /* DEO */ OPC(0x17,PO1(a) GET(y),DEO(a, y)) /* ADD */ OPC(0x18,POx(a) POx(b),PUx(b + a)) /* SUB */ OPC(0x19,POx(a) POx(b),PUx(b - a)) /* MUL */ OPC(0x1a,POx(a) POx(b),PUx(b * a)) /* DIV */ OPC(0x1b,POx(a) POx(b),PUx(a ? b / a : 0)) /* AND */ OPC(0x1c,POx(a) POx(b),PUx(b & a)) /* ORA */ OPC(0x1d,POx(a) POx(b),PUx(b | a)) /* EOR */ OPC(0x1e,POx(a) POx(b),PUx(b ^ a)) /* SFT */ OPC(0x1f,PO1(a) POx(b),PUx(b >> (a & 0xf) << (a >> 4))) } } return 0; } /* clang-format on */ /* @|System ------------------------------------------------------------ */ static char *system_boot_path; static void system_print(char *name, Stack *s) { Uint8 i; fprintf(stderr, "%s ", name); for(i = s->ptr - 8; i != (Uint8)(s->ptr); i++) fprintf(stderr, "%02x%c", s->dat[i], i == 0xff ? '|' : ' '); fprintf(stderr, "<%02x\n", s->ptr); } static int system_load(Uint8 *ram, char *rom_path) { FILE *f = fopen(rom_path, "rb"); if(f) { int i = 0, l = fread(ram, 0x10000 - PAGE_PROGRAM, 1, f); while(l && ++i < RAM_PAGES) l = fread(ram + 0x10000 * i - PAGE_PROGRAM, 0x10000, 1, f); fclose(f); } return !!f; } static int system_boot(Uint8 *ram, char *rom_path, int has_args) { uxn.ram = ram; system_boot_path = rom_path; uxn.dev[0x17] = has_args; if(ram && system_load(uxn.ram + PAGE_PROGRAM, rom_path)) return uxn_eval(PAGE_PROGRAM); return 0; } static Uint8 system_dei(Uint8 addr) { switch(addr) { case 0x4: return uxn.wst.ptr; case 0x5: return uxn.rst.ptr; default: return uxn.dev[addr]; } } static void system_deo(Uint8 port) { switch(port) { case 0x3: { Uint16 value; Uint16 addr = PEEK2(uxn.dev + 2); Uint8 *aptr = uxn.ram + addr; Uint16 length = PEEK2(aptr + 1); if(uxn.ram[addr] == 0x0) { Uint32 a = PEEK2(aptr + 3) * 0x10000 + PEEK2(aptr + 5); Uint32 b = a + length; value = uxn.ram[addr + 7]; for(; a < b; uxn.ram[a++] = value); } else if(uxn.ram[addr] == 0x1) { Uint32 a = PEEK2(aptr + 3) * 0x10000 + PEEK2(aptr + 5); Uint32 b = a + length; Uint32 c = PEEK2(aptr + 7) * 0x10000 + PEEK2(aptr + 9); for(; a < b; uxn.ram[c++] = uxn.ram[a++]); } else if(uxn.ram[addr] == 0x2) { Uint32 a = PEEK2(aptr + 3) * 0x10000 + PEEK2(aptr + 5); Uint32 b = a + length; Uint32 c = PEEK2(aptr + 7) * 0x10000 + PEEK2(aptr + 9); Uint32 d = c + length; for(; b >= a; uxn.ram[--d] = uxn.ram[--b]); } else fprintf(stderr, "Unknown command: %s\n", &uxn.ram[addr]); break; } case 0x4: uxn.wst.ptr = uxn.dev[4]; break; case 0x5: uxn.rst.ptr = uxn.dev[5]; break; case 0xe: system_print("WST", &uxn.wst); system_print("RST", &uxn.rst); break; } } /* @|Console ----------------------------------------------------------- */ #define CONSOLE_STD 0x1 #define CONSOLE_ARG 0x2 #define CONSOLE_EOA 0x3 #define CONSOLE_END 0x4 static int console_vector; #undef _POSIX_C_SOURCE #define _POSIX_C_SOURCE 200112L #include #include #include #ifdef __linux #include #include #endif #ifdef __NetBSD__ #include #include #endif /* subprocess support */ static char *fork_args[4] = {"/bin/sh", "-c", "", NULL}; static int child_mode; static int to_child_fd[2]; static int from_child_fd[2]; static int saved_in; static int saved_out; static pid_t child_pid; /* child_mode: * 0x01: writes to child's stdin * 0x02: reads from child's stdout * 0x04: reads from child's stderr * 0x08: kill previous process (if any) but do not start * (other bits ignored for now ) */ #define CMD_LIVE 0x15 /* 0x00 not started, 0x01 running, 0xff dead */ #define CMD_EXIT 0x16 /* if dead, exit code of process */ #define CMD_ADDR 0x1c /* address to read command args from */ #define CMD_MODE 0x1e /* mode to execute, 0x00 to 0x07 */ #define CMD_EXEC 0x1f /* write to execute programs, etc */ /* call after we're sure the process has exited */ static void clean_after_child(void) { child_pid = 0; if(child_mode & 0x01) { close(to_child_fd[1]); dup2(saved_out, 1); } if(child_mode & (0x04 | 0x02)) { close(from_child_fd[0]); dup2(saved_in, 0); } child_mode = 0; saved_in = -1; saved_out = -1; } static void start_fork_pipe(void) { pid_t pid; pid_t parent_pid = getpid(); int addr = PEEK2(&uxn.dev[CMD_ADDR]); fflush(stdout); if(child_mode & 0x08) { uxn.dev[CMD_EXIT] = uxn.dev[CMD_LIVE] = 0x00; return; } if(child_mode & 0x01) { /* parent writes to child's stdin */ if(pipe(to_child_fd) == -1) { uxn.dev[CMD_EXIT] = uxn.dev[CMD_LIVE] = 0xff; fprintf(stderr, "Pipe error to child.\n"); return; } } if(child_mode & (0x04 | 0x02)) { /* parent reads from child's stdout and/or stderr */ if(pipe(from_child_fd) == -1) { uxn.dev[CMD_EXIT] = uxn.dev[CMD_LIVE] = 0xff; fprintf(stderr, "Pipe error from child.\n"); return; } } fork_args[2] = (char *)&uxn.ram[addr]; pid = fork(); if(pid < 0) { /* failure */ uxn.dev[CMD_EXIT] = uxn.dev[CMD_LIVE] = 0xff; fprintf(stderr, "Fork failure.\n"); } else if(pid == 0) { /* child */ #ifdef __linux__ int r = prctl(PR_SET_PDEATHSIG, SIGTERM); if(r == -1) { perror(0); exit(6); } if(getppid() != parent_pid) exit(13); #endif if(child_mode & 0x01) { dup2(to_child_fd[0], 0); close(to_child_fd[1]); } if(child_mode & (0x04 | 0x02)) { if(child_mode & 0x02) dup2(from_child_fd[1], 1); if(child_mode & 0x04) dup2(from_child_fd[1], 2); close(from_child_fd[0]); } fflush(stdout); execvp(fork_args[0], fork_args); exit(1); } else { /*parent*/ child_pid = pid; uxn.dev[CMD_LIVE] = 0x01; uxn.dev[CMD_EXIT] = 0x00; if(child_mode & 0x01) { saved_out = dup(1); dup2(to_child_fd[1], 1); close(to_child_fd[0]); } if(child_mode & (0x04 | 0x02)) { saved_in = dup(0); dup2(from_child_fd[0], 0); close(from_child_fd[1]); } } } static void check_child(void) { int wstatus; if(child_pid) { if(waitpid(child_pid, &wstatus, WNOHANG)) { uxn.dev[CMD_LIVE] = 0xff; uxn.dev[CMD_EXIT] = WEXITSTATUS(wstatus); clean_after_child(); } else { uxn.dev[CMD_LIVE] = 0x01; uxn.dev[CMD_EXIT] = 0x00; } } } static void kill_child(void) { int wstatus; if(child_pid) { kill(child_pid, 9); if(waitpid(child_pid, &wstatus, WNOHANG)) { uxn.dev[CMD_LIVE] = 0xff; uxn.dev[CMD_EXIT] = WEXITSTATUS(wstatus); clean_after_child(); } } } static void start_fork(void) { fflush(stderr); kill_child(); child_mode = uxn.dev[CMD_MODE]; start_fork_pipe(); } static int console_input(int c, int type) { if(c == EOF) c = 0, type = 4; uxn.dev[0x12] = c, uxn.dev[0x17] = type; uxn_eval(console_vector); return type != 4; } static void console_arguments(int i, int argc, char **argv) { for(; i < argc; i++) { char *p = argv[i]; while(*p) console_input(*p++, CONSOLE_ARG); console_input('\n', i == argc - 1 ? CONSOLE_END : CONSOLE_EOA); } } static Uint8 console_dei(Uint8 addr) { switch(addr) { case CMD_LIVE: case CMD_EXIT: check_child(); break; } return uxn.dev[addr]; } static void console_deo(Uint8 addr) { FILE *fd; switch(addr) { case 0x11: console_vector = PEEK2(&uxn.dev[0x10]); return; case 0x18: fd = stdout, fputc(uxn.dev[0x18], fd), fflush(fd); break; case 0x19: fd = stderr, fputc(uxn.dev[0x19], fd), fflush(fd); break; case CMD_EXEC: start_fork(); break; } } /* @|File -------------------------------------------------------------- */ #include #include #include typedef struct { FILE *f; DIR *dir; char *filepath; enum { IDLE, FILE_READ, FILE_WRITE, DIR_READ, DIR_WRITE } state; } UxnFile; static UxnFile ufs[2]; static Uint8 dirbuf[0x10000], *_dirbuf = dirbuf; static void make_pathfile(char *pathbuf, const char *filepath, const char *basename) { char c = '/'; while(*filepath) c = *filepath++, *pathbuf = c, pathbuf++; if(c != '/') *pathbuf = '/', pathbuf++; while(*basename) *pathbuf = *basename++, pathbuf++; *pathbuf = 0; } static int put_fill(Uint8 *dest, int len, char c) { int i; for(i = 0; i < len; i++) *dest = c, dest++; return len; } static int put_size(Uint8 *dest, int len, int size) { int i; for(i = 0, dest += len; i < len; i++, size >>= 4) *(--dest) = "0123456789abcdef"[(Uint8)(size & 0xf)]; return len; } static int put_text(Uint8 *dest, const char *text) { Uint8 *anchor = dest; while(*text) *dest = *text++, dest++; *dest = 0; return dest - anchor; } static int put_stat(Uint8 *dest, int len, int size, int err, int dir, int capsize) { if(err) return put_fill(dest, len, '!'); if(dir) return put_fill(dest, len, '-'); if(capsize && size >= 0x10000) return put_fill(dest, len, '?'); return put_size(dest, len, size); } static int put_statfile(Uint8 *dest, const char *filepath, const char *basename) { int err, dir; struct stat st; Uint8 *anchor = dest; char pathbuf[0x2000]; make_pathfile(pathbuf, filepath, basename); err = stat(pathbuf, &st); dir = S_ISDIR(st.st_mode); dest += put_stat(dest, 4, st.st_size, err, dir, 1); dest += put_text(dest, " "); dest += put_text(dest, basename); dest += put_text(dest, dir ? "/\n" : "\n"); return dest - anchor; } static int put_fdir(Uint8 *dest, int len, const char *filepath, DIR *dir) { int i; struct dirent *de = readdir(dir); for(_dirbuf = dirbuf; de != NULL; de = readdir(dir)) { char *name = de->d_name; if(name[0] == '.' && (name[1] == '.' || name[1] == '\0')) continue; else _dirbuf += put_statfile(_dirbuf, filepath, name); } for(i = 0; i < len && dirbuf[i]; i++) dest[i] = dirbuf[i]; dest[i] = 0; return i; } static int is_dir_path(char *p) { char c; int saw_slash = 0; while((c = *p++)) saw_slash = c == '/'; return saw_slash; } static int is_dir_real(char *p) { struct stat st; return stat(p, &st) == 0 && S_ISDIR(st.st_mode); } static int file_write_dir(char *p) { int ok = 1; char c, *s = p; for(; ok && (c = *p); p++) { if(c == '/') { *p = '\0'; ok = is_dir_real(s) || (mkdir(s, 0755) == 0); *p = c; } } return ok; } static void file_reset(int id) { if(ufs[id].f != NULL) fclose(ufs[id].f), ufs[id].f = NULL; if(ufs[id].dir != NULL) closedir(ufs[id].dir), ufs[id].dir = NULL; ufs[id].state = IDLE; } static int file_init(int id, Uint16 addr) { file_reset(id); ufs[id].filepath = (char *)&uxn.ram[addr]; return 0; } static int file_not_ready(int id) { if(ufs[id].filepath == 0) { fprintf(stderr, "File %d is uninitialized\n", id); return 1; } else return 0; } static int file_read(int id, Uint16 addr, int len) { void *dest = &uxn.ram[addr]; if(file_not_ready(id)) return 0; if(ufs[id].state != FILE_READ && ufs[id].state != DIR_READ) { file_reset(id); if((ufs[id].dir = opendir(ufs[id].filepath)) != NULL) ufs[id].state = DIR_READ; else if((ufs[id].f = fopen(ufs[id].filepath, "rb")) != NULL) ufs[id].state = FILE_READ; } if(ufs[id].state == FILE_READ) return fread(dest, 1, len, ufs[id].f); if(ufs[id].state == DIR_READ) return put_fdir(dest, len, ufs[id].filepath, ufs[id].dir); return 0; } static int file_write(int id, Uint16 addr, int len, Uint8 flags) { int ret = 0; if(file_not_ready(id)) return 0; file_write_dir(ufs[id].filepath); if(ufs[id].state != FILE_WRITE && ufs[id].state != DIR_WRITE) { file_reset(id); if(is_dir_path(ufs[id].filepath)) ufs[id].state = DIR_WRITE; else if((ufs[id].f = fopen(ufs[id].filepath, (flags & 0x01) ? "ab" : "wb")) != NULL) ufs[id].state = FILE_WRITE; } if(ufs[id].state == FILE_WRITE) if((ret = fwrite(&uxn.ram[addr], 1, len, ufs[id].f)) > 0 && fflush(ufs[id].f) != 0) ret = 0; if(ufs[id].state == DIR_WRITE) ret = is_dir_real(ufs[id].filepath); return ret; } static int file_stat(int id, Uint16 addr, int len) { int err, dir; struct stat st; if(file_not_ready(id)) return 0; err = stat(ufs[id].filepath, &st); dir = S_ISDIR(st.st_mode); return put_stat(&uxn.ram[addr], len, st.st_size, err, dir, 0); } static int file_delete(int id) { if(file_not_ready(id)) return -1; return unlink(ufs[id].filepath); } static void file_success(int port, int value) { POKE2(&uxn.dev[port], value); } /* file registers */ static int rL1, rL2; static void file_deo(Uint8 port) { switch(port) { /* File 1 */ case 0xab: rL1 = PEEK2(&uxn.dev[0xaa]); break; case 0xa5: file_success(0xa2, file_stat(0, PEEK2(&uxn.dev[0xa4]), rL1)); break; case 0xa6: file_success(0xa2, file_delete(0)); break; case 0xa9: file_success(0xa2, file_init(0, PEEK2(&uxn.dev[0xa8]))); break; case 0xad: file_success(0xa2, file_read(0, PEEK2(&uxn.dev[0xac]), rL1)); break; case 0xaf: file_success(0xa2, file_write(0, PEEK2(&uxn.dev[0xae]), rL1, uxn.dev[0xa7])); break; /* File 2 */ case 0xbb: rL2 = PEEK2(&uxn.dev[0xba]); break; case 0xb5: file_success(0xb2, file_stat(1, PEEK2(&uxn.dev[0xb4]), rL2)); break; case 0xb6: file_success(0xb2, file_delete(1)); break; case 0xb9: file_success(0xb2, file_init(1, PEEK2(&uxn.dev[0xb8]))); break; case 0xbd: file_success(0xb2, file_read(1, PEEK2(&uxn.dev[0xbc]), rL2)); break; case 0xbf: file_success(0xb2, file_write(1, PEEK2(&uxn.dev[0xbe]), rL2, uxn.dev[0xb7])); break; } } /* @|Datetime ---------------------------------------------------------- */ #include static Uint8 datetime_dei(Uint8 addr) { time_t seconds = time(NULL); struct tm zt = {0}; struct tm *t = localtime(&seconds); if(t == NULL) t = &zt; switch(addr) { case 0xc0: return (t->tm_year + 1900) >> 8; case 0xc1: return (t->tm_year + 1900); case 0xc2: return t->tm_mon; case 0xc3: return t->tm_mday; case 0xc4: return t->tm_hour; case 0xc5: return t->tm_min; case 0xc6: return t->tm_sec; case 0xc7: return t->tm_wday; case 0xc8: return t->tm_yday >> 8; case 0xc9: return t->tm_yday; case 0xca: return t->tm_isdst; default: return uxn.dev[addr]; } } /* @|Core -------------------------------------------------------------- */ Uint8 emu_dei(Uint8 addr) { switch(addr & 0xf0) { case 0x00: return system_dei(addr); case 0x10: console_dei(addr); break; case 0xc0: return datetime_dei(addr); } return uxn.dev[addr]; } void emu_deo(Uint8 addr, Uint8 value) { uxn.dev[addr] = value; switch(addr & 0xf0) { case 0x00: system_deo(addr); break; case 0x10: console_deo(addr); break; case 0xa0: file_deo(addr); break; case 0xb0: file_deo(addr); break; } } int main(int argc, char **argv) { int i = 1; if(argc == 2 && argv[1][0] == '-' && argv[1][1] == 'v') return !fprintf(stdout, "Uxn11 - Varvara Emulator(cli), 20 Mar 2025.\n"); else if(argc == 1) return !fprintf(stdout, "usage: %s [-v] file.rom [args..]\n", argv[0]); else if(!system_boot((Uint8 *)calloc(0x10000 * RAM_PAGES, sizeof(Uint8)), argv[i++], argc > 2)) return !fprintf(stdout, "Could not load %s.\n", argv[i - 1]); if(console_vector) { console_arguments(i, argc, argv); while(!uxn.dev[0x0f] && console_input(fgetc(stdin), 0x1)); } return uxn.dev[0x0f] & 0x7f; }