commit cb73e63

Devine Lu Linvega  ·  2024-02-22 23:47:44 +0000 UTC
parent 897e0a5
Added boot.rom
3 files changed,  +11, -15
+0, -0
+5, -7
 1@@ -5,18 +5,16 @@ EMU_src=${CLI_src} src/devices/screen.c src/devices/controller.c src/devices/mou
 2 RELEASE_flags=-DNDEBUG -O2 -g0 -s
 3 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
 4 
 5-.PHONY: all debug dest rom run test install uninstall format clean
 6+.PHONY: all debug dest run test install uninstall format clean
 7 
 8 all: dest bin/uxnasm bin/uxncli bin/uxn11
 9 
10 dest:
11 	@ mkdir -p bin
12-rom:
13-	@ ./bin/uxnasm etc/screen.bounds.tal bin/res.rom
14-run: all bin/uxnasm bin/uxncli bin/uxn11 rom
15-	@ ./bin/uxn11 bin/res.rom
16+run: all bin/uxnasm bin/uxncli bin/uxn11
17+	@ ./bin/uxn11 
18 test: bin/uxnasm bin/uxncli bin/uxn11
19-	@ ./bin/uxnasm && ./bin/uxncli && ./bin/uxn11 && ./bin/uxnasm -v && ./bin/uxncli -v && ./bin/uxn11 -v
20+	@ ./bin/uxnasm -v && ./bin/uxncli -v && ./bin/uxn11 -v
21 	@ ./bin/uxnasm etc/opctest.tal bin/opctest.rom
22 	@ ./bin/uxncli bin/opctest.rom
23 install: bin/uxnasm bin/uxncli bin/uxn11
24@@ -26,7 +24,7 @@ uninstall:
25 format:
26 	@ clang-format -i src/uxnasm.c src/uxncli.c src/uxn11.c src/devices/*
27 clean:
28-	@ rm -f bin/uxnasm bin/uxncli bin/uxn11 bin/polycat.rom bin/polycat.rom.sym
29+	@ rm -fr bin
30 
31 bin/uxnasm: src/uxnasm.c
32 	@ cc ${RELEASE_flags} ${CFLAGS} src/uxnasm.c -o bin/uxnasm
+6, -8
 1@@ -265,16 +265,14 @@ main(int argc, char **argv)
 2 {
 3 	Uxn u = {0};
 4 	int i = 1;
 5-	if(i == argc) {
 6-		fprintf(stdout, "usage: %s [-v] file.rom [args..]\n", argv[0]);
 7-		return 0;
 8-	}
 9-	if(argv[i][0] == '-' && argv[i][1] == 'v') {
10-		fprintf(stdout, "Uxn11 - Varvara Emulator, 14 Feb 2023.\n");
11+	char *rom;
12+	if(i != argc && argv[i][0] == '-' && argv[i][1] == 'v') {
13+		fprintf(stdout, "Uxn11 - Varvara Emulator, 22 Feb 2023.\n");
14 		i++;
15 	}
16-	if(!system_boot(&u, (Uint8 *)calloc(0x10000 * RAM_PAGES, sizeof(Uint8)), argv[i++])) {
17-		fprintf(stdout, "Could not boot.\n");
18+	rom = i == argc ? "boot.rom" : argv[i++];
19+	if(!system_boot(&u, (Uint8 *)calloc(0x10000 * RAM_PAGES, sizeof(Uint8)), rom)) {
20+		fprintf(stdout, "usage: %s [-v] file.rom [args..]\n", argv[0]);
21 		return 0;
22 	}
23 	if(!display_init()) {