mirror of
https://git.sr.ht/~rabbits/uxn
synced 2024-11-26 15:53:01 +00:00
Print system versions for uxncli with -v flag
This commit is contained in:
parent
2e1b56018b
commit
9c25f801d0
8 changed files with 30 additions and 15 deletions
|
@ -31,7 +31,7 @@ Build the assembler and emulator by running the `build.sh` script. The assembler
|
|||
If you wish to build the emulator without graphics mode:
|
||||
|
||||
```sh
|
||||
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
|
||||
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
|
||||
```
|
||||
|
||||
### Plan 9
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
/*
|
||||
Copyright (c) 2021 Devine Lu Linvega
|
||||
Copyright (c) 2021 Andrew Alderwick
|
||||
Copyright (c) 2021 Devine Lu Linvega, Andrew Alderwick
|
||||
|
||||
Permission to use, copy, modify, and distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (c) 2022 Devine Lu Linvega, Andrew Alderwick
|
||||
Copyright (c) 2021 Devine Lu Linvega, Andrew Alderwick
|
||||
|
||||
Permission to use, copy, modify, and distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
/*
|
||||
Copyright (c) 2021 Devine Lu Linvega
|
||||
Copyright (c) 2021 Andrew Alderwick
|
||||
Copyright (c) 2021 Devine Lu Linvega, Andrew Alderwick
|
||||
|
||||
Permission to use, copy, modify, and distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
@ -77,12 +77,23 @@ system_inspect(Uxn *u)
|
|||
void
|
||||
system_connect(Uint8 device, Uint8 ver, Uint16 dei, Uint16 deo)
|
||||
{
|
||||
/* printf("%02x -> v%d %04x %04x\n", device, ver, dei, deo); */
|
||||
dev_vers[device] = ver;
|
||||
dei_mask[device] = dei;
|
||||
deo_mask[device] = deo;
|
||||
}
|
||||
|
||||
int
|
||||
system_version(void)
|
||||
{
|
||||
int i;
|
||||
printf("Varvara Emulator 1.0\n");
|
||||
printf("Device Version Dei Deo\n", i, dev_vers[i], dei_mask[i], deo_mask[i]);
|
||||
for(i = 0; i < 0x10; i++)
|
||||
if(dev_vers[i])
|
||||
printf("%6x %7d %04x %04x\n", i, dev_vers[i], dei_mask[i], deo_mask[i]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* IO */
|
||||
|
||||
void
|
||||
|
|
|
@ -16,6 +16,7 @@ WITH REGARD TO THIS SOFTWARE.
|
|||
#define RAM_PAGES 0x10
|
||||
|
||||
void system_connect(Uint8 device, Uint8 ver, Uint16 dei, Uint16 deo);
|
||||
int system_version(void);
|
||||
int system_load(Uxn *u, char *filename);
|
||||
void system_inspect(Uxn *u);
|
||||
int system_error(char *msg, const char *err);
|
||||
|
|
|
@ -9,8 +9,6 @@ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|||
WITH REGARD TO THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#define PAGE_PROGRAM 0x0100
|
||||
|
||||
/* clang-format off */
|
||||
|
||||
#define POKE2(d, v) { (d)[0] = (v) >> 8; (d)[1] = (v); }
|
||||
|
@ -20,6 +18,8 @@ WITH REGARD TO THIS SOFTWARE.
|
|||
|
||||
/* clang-format on */
|
||||
|
||||
#define PAGE_PROGRAM 0x0100
|
||||
|
||||
typedef unsigned char Uint8;
|
||||
typedef signed char Sint8;
|
||||
typedef unsigned short Uint16;
|
||||
|
|
17
src/uxncli.c
17
src/uxncli.c
|
@ -47,17 +47,22 @@ main(int argc, char **argv)
|
|||
Uxn u;
|
||||
int i = 1;
|
||||
if(i == argc)
|
||||
return system_error("usage", "uxncli file.rom [args..]");
|
||||
if(!uxn_boot(&u, (Uint8 *)calloc(0x10000 * RAM_PAGES, sizeof(Uint8))))
|
||||
return system_error("Boot", "Failed");
|
||||
if(!system_load(&u, argv[i++]))
|
||||
return system_error("Load", "Failed");
|
||||
/* connect devices */
|
||||
return system_error("usage", "uxncli [-v] file.rom [args..]");
|
||||
/* Boot Varvara */
|
||||
system_connect(0x0, SYSTEM_VERSION, SYSTEM_DEIMASK, SYSTEM_DEOMASK);
|
||||
system_connect(0x1, CONSOLE_VERSION, CONSOLE_DEIMASK, CONSOLE_DEOMASK);
|
||||
system_connect(0xa, FILE_VERSION, FILE_DEIMASK, FILE_DEOMASK);
|
||||
system_connect(0xb, FILE_VERSION, FILE_DEIMASK, FILE_DEOMASK);
|
||||
system_connect(0xc, DATETIME_VERSION, DATETIME_DEIMASK, DATETIME_DEOMASK);
|
||||
if(!uxn_boot(&u, (Uint8 *)calloc(0x10000 * RAM_PAGES, sizeof(Uint8))))
|
||||
return system_error("Boot", "Failed");
|
||||
/* Read flags */
|
||||
if(argv[i][0] == '-' && argv[i][1] == 'v')
|
||||
return system_version();
|
||||
/* Load rom */
|
||||
if(!system_load(&u, argv[i++]))
|
||||
return system_error("Load", "Failed");
|
||||
/* Game Loop */
|
||||
u.dev[0x17] = argc - i;
|
||||
if(uxn_eval(&u, PAGE_PROGRAM)) {
|
||||
for(; i < argc; i++) {
|
||||
|
|
Loading…
Reference in a new issue