| ... | ... |
@@ -31,7 +31,7 @@ Build the assembler and emulator by running the `build.sh` script. The assembler |
| 31 | 31 |
If you wish to build the emulator without graphics mode: |
| 32 | 32 |
|
| 33 | 33 |
```sh |
| 34 |
-cc src/devices/datetime.c src/devices/system.c src/devices/file.c src/uxn.c -DNDEBUG -Os -g0 -s src/uxncli.c -o bin/uxncli |
|
| 34 |
+cc src/devices/datetime.c src/devices/system.c src/devices/console.c src/devices/file.c src/uxn.c -DNDEBUG -Os -g0 -s src/uxncli.c -o bin/uxncli |
|
| 35 | 35 |
``` |
| 36 | 36 |
|
| 37 | 37 |
### Plan 9 |
| ... | ... |
@@ -1,6 +1,5 @@ |
| 1 | 1 |
/* |
| 2 |
-Copyright (c) 2021 Devine Lu Linvega |
|
| 3 |
-Copyright (c) 2021 Andrew Alderwick |
|
| 2 |
+Copyright (c) 2021 Devine Lu Linvega, Andrew Alderwick |
|
| 4 | 3 |
|
| 5 | 4 |
Permission to use, copy, modify, and distribute this software for any |
| 6 | 5 |
purpose with or without fee is hereby granted, provided that the above |
| ... | ... |
@@ -1,6 +1,5 @@ |
| 1 | 1 |
/* |
| 2 |
-Copyright (c) 2021 Devine Lu Linvega |
|
| 3 |
-Copyright (c) 2021 Andrew Alderwick |
|
| 2 |
+Copyright (c) 2021 Devine Lu Linvega, Andrew Alderwick |
|
| 4 | 3 |
|
| 5 | 4 |
Permission to use, copy, modify, and distribute this software for any |
| 6 | 5 |
purpose with or without fee is hereby granted, provided that the above |
| ... | ... |
@@ -77,12 +77,23 @@ system_inspect(Uxn *u) |
| 77 | 77 |
void |
| 78 | 78 |
system_connect(Uint8 device, Uint8 ver, Uint16 dei, Uint16 deo) |
| 79 | 79 |
{
|
| 80 |
- /* printf("%02x -> v%d %04x %04x\n", device, ver, dei, deo); */
|
|
| 81 | 80 |
dev_vers[device] = ver; |
| 82 | 81 |
dei_mask[device] = dei; |
| 83 | 82 |
deo_mask[device] = deo; |
| 84 | 83 |
} |
| 85 | 84 |
|
| 85 |
+int |
|
| 86 |
+system_version(void) |
|
| 87 |
+{
|
|
| 88 |
+ int i; |
|
| 89 |
+ printf("Varvara Emulator 1.0\n");
|
|
| 90 |
+ printf("Device Version Dei Deo\n", i, dev_vers[i], dei_mask[i], deo_mask[i]);
|
|
| 91 |
+ for(i = 0; i < 0x10; i++) |
|
| 92 |
+ if(dev_vers[i]) |
|
| 93 |
+ printf("%6x %7d %04x %04x\n", i, dev_vers[i], dei_mask[i], deo_mask[i]);
|
|
| 94 |
+ return 0; |
|
| 95 |
+} |
|
| 96 |
+ |
|
| 86 | 97 |
/* IO */ |
| 87 | 98 |
|
| 88 | 99 |
void |
| ... | ... |
@@ -16,6 +16,7 @@ WITH REGARD TO THIS SOFTWARE. |
| 16 | 16 |
#define RAM_PAGES 0x10 |
| 17 | 17 |
|
| 18 | 18 |
void system_connect(Uint8 device, Uint8 ver, Uint16 dei, Uint16 deo); |
| 19 |
+int system_version(void); |
|
| 19 | 20 |
int system_load(Uxn *u, char *filename); |
| 20 | 21 |
void system_inspect(Uxn *u); |
| 21 | 22 |
int system_error(char *msg, const char *err); |
| ... | ... |
@@ -9,8 +9,6 @@ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
| 9 | 9 |
WITH REGARD TO THIS SOFTWARE. |
| 10 | 10 |
*/ |
| 11 | 11 |
|
| 12 |
-#define PAGE_PROGRAM 0x0100 |
|
| 13 |
- |
|
| 14 | 12 |
/* clang-format off */ |
| 15 | 13 |
|
| 16 | 14 |
#define POKE2(d, v) { (d)[0] = (v) >> 8; (d)[1] = (v); }
|
| ... | ... |
@@ -20,6 +18,8 @@ WITH REGARD TO THIS SOFTWARE. |
| 20 | 18 |
|
| 21 | 19 |
/* clang-format on */ |
| 22 | 20 |
|
| 21 |
+#define PAGE_PROGRAM 0x0100 |
|
| 22 |
+ |
|
| 23 | 23 |
typedef unsigned char Uint8; |
| 24 | 24 |
typedef signed char Sint8; |
| 25 | 25 |
typedef unsigned short Uint16; |
| ... | ... |
@@ -47,17 +47,22 @@ main(int argc, char **argv) |
| 47 | 47 |
Uxn u; |
| 48 | 48 |
int i = 1; |
| 49 | 49 |
if(i == argc) |
| 50 |
- return system_error("usage", "uxncli file.rom [args..]");
|
|
| 51 |
- if(!uxn_boot(&u, (Uint8 *)calloc(0x10000 * RAM_PAGES, sizeof(Uint8)))) |
|
| 52 |
- return system_error("Boot", "Failed");
|
|
| 53 |
- if(!system_load(&u, argv[i++])) |
|
| 54 |
- return system_error("Load", "Failed");
|
|
| 55 |
- /* connect devices */ |
|
| 50 |
+ return system_error("usage", "uxncli [-v] file.rom [args..]");
|
|
| 51 |
+ /* Boot Varvara */ |
|
| 56 | 52 |
system_connect(0x0, SYSTEM_VERSION, SYSTEM_DEIMASK, SYSTEM_DEOMASK); |
| 57 | 53 |
system_connect(0x1, CONSOLE_VERSION, CONSOLE_DEIMASK, CONSOLE_DEOMASK); |
| 58 | 54 |
system_connect(0xa, FILE_VERSION, FILE_DEIMASK, FILE_DEOMASK); |
| 59 | 55 |
system_connect(0xb, FILE_VERSION, FILE_DEIMASK, FILE_DEOMASK); |
| 60 | 56 |
system_connect(0xc, DATETIME_VERSION, DATETIME_DEIMASK, DATETIME_DEOMASK); |
| 57 |
+ if(!uxn_boot(&u, (Uint8 *)calloc(0x10000 * RAM_PAGES, sizeof(Uint8)))) |
|
| 58 |
+ return system_error("Boot", "Failed");
|
|
| 59 |
+ /* Read flags */ |
|
| 60 |
+ if(argv[i][0] == '-' && argv[i][1] == 'v') |
|
| 61 |
+ return system_version(); |
|
| 62 |
+ /* Load rom */ |
|
| 63 |
+ if(!system_load(&u, argv[i++])) |
|
| 64 |
+ return system_error("Load", "Failed");
|
|
| 65 |
+ /* Game Loop */ |
|
| 61 | 66 |
u.dev[0x17] = argc - i; |
| 62 | 67 |
if(uxn_eval(&u, PAGE_PROGRAM)) {
|
| 63 | 68 |
for(; i < argc; i++) {
|