diff --git a/boot.rom b/boot.rom new file mode 100644 index 0000000..37ad1b6 Binary files /dev/null and b/boot.rom differ diff --git a/makefile b/makefile index 7e2c675..e007864 100644 --- a/makefile +++ b/makefile @@ -5,18 +5,16 @@ EMU_src=${CLI_src} src/devices/screen.c src/devices/controller.c src/devices/mou RELEASE_flags=-DNDEBUG -O2 -g0 -s DEBUG_flags=-std=c89 -D_POSIX_C_SOURCE=199309L -DDEBUG -Wall -Wno-unknown-pragmas -Wpedantic -Wshadow -Wextra -Werror=implicit-int -Werror=incompatible-pointer-types -Werror=int-conversion -Wvla -g -Og -fsanitize=address -fsanitize=undefined -.PHONY: all debug dest rom run test install uninstall format clean +.PHONY: all debug dest run test install uninstall format clean all: dest bin/uxnasm bin/uxncli bin/uxn11 dest: @ mkdir -p bin -rom: - @ ./bin/uxnasm etc/screen.bounds.tal bin/res.rom -run: all bin/uxnasm bin/uxncli bin/uxn11 rom - @ ./bin/uxn11 bin/res.rom +run: all bin/uxnasm bin/uxncli bin/uxn11 + @ ./bin/uxn11 test: bin/uxnasm bin/uxncli bin/uxn11 - @ ./bin/uxnasm && ./bin/uxncli && ./bin/uxn11 && ./bin/uxnasm -v && ./bin/uxncli -v && ./bin/uxn11 -v + @ ./bin/uxnasm -v && ./bin/uxncli -v && ./bin/uxn11 -v @ ./bin/uxnasm etc/opctest.tal bin/opctest.rom @ ./bin/uxncli bin/opctest.rom install: bin/uxnasm bin/uxncli bin/uxn11 @@ -26,7 +24,7 @@ uninstall: format: @ clang-format -i src/uxnasm.c src/uxncli.c src/uxn11.c src/devices/* clean: - @ rm -f bin/uxnasm bin/uxncli bin/uxn11 bin/polycat.rom bin/polycat.rom.sym + @ rm -fr bin bin/uxnasm: src/uxnasm.c @ cc ${RELEASE_flags} ${CFLAGS} src/uxnasm.c -o bin/uxnasm diff --git a/src/uxn11.c b/src/uxn11.c index 6e91401..b52a95f 100644 --- a/src/uxn11.c +++ b/src/uxn11.c @@ -265,16 +265,14 @@ main(int argc, char **argv) { Uxn u = {0}; int i = 1; - if(i == argc) { - fprintf(stdout, "usage: %s [-v] file.rom [args..]\n", argv[0]); - return 0; - } - if(argv[i][0] == '-' && argv[i][1] == 'v') { - fprintf(stdout, "Uxn11 - Varvara Emulator, 14 Feb 2023.\n"); + char *rom; + if(i != argc && argv[i][0] == '-' && argv[i][1] == 'v') { + fprintf(stdout, "Uxn11 - Varvara Emulator, 22 Feb 2023.\n"); i++; } - if(!system_boot(&u, (Uint8 *)calloc(0x10000 * RAM_PAGES, sizeof(Uint8)), argv[i++])) { - fprintf(stdout, "Could not boot.\n"); + rom = i == argc ? "boot.rom" : argv[i++]; + if(!system_boot(&u, (Uint8 *)calloc(0x10000 * RAM_PAGES, sizeof(Uint8)), rom)) { + fprintf(stdout, "usage: %s [-v] file.rom [args..]\n", argv[0]); return 0; } if(!display_init()) {