Add disass make rule, change -i option to -f
x1phosura x1phosura@x1phosura.zone
Tue, 27 Apr 2021 02:47:04 -0400
2 files changed,
14 insertions(+),
8 deletions(-)
M
Makefile
→
Makefile
@@ -19,6 +19,11 @@ trace: CFLAGS += -g -ggdb -DTRACE -lreadline
trace: TRACE_SUFFIX = -trace trace: hard + +disass: CFLAGS += -DTRACE -lreadline +disass: bin/disass.o bin/vm.o + $(CC) $(CFLAGS) -o bin/$@ $^ + # TODO: add rule to make rom.h bin/%.o: src/%.c@@ -26,14 +31,15 @@ $(CC) $(CFLAGS) -o $@ -c $^
bin/vm.o: bin/main.o: +bin/disass.o: hard: bin/main.o bin/vm.o $(CC) $(CFLAGS) -o bin/$@$(TRACE_SUFFIX) $^ -clean: cleano - rm -f bin/hard bin/hard-trace +clean: + rm -f bin/* cleano: - rm -f bin/main.o bin/vm.o + rm -f bin/*.o -.PHONY: all trace clean +.PHONY: all trace clean clean
M
src/disass.c
→
src/disass.c
@@ -9,10 +9,10 @@
#include "vm.h" -char *usage = "Usage: %s [-z] [-s [start_addr]] -i [vmcodefile]\n" +char *usage = "Usage: %s [-z] [-s [start_addr]] -f [vmcodefile]\n" "-z (optional): don't display addresses next to disassembly\n" "-s (optional): start disassembly at 'start_addr' in file\n" - "-i (required): path to file to disassemble\n"; + "-f (required): path to file to disassemble\n"; /* TODO: eventually reimplement assembler in C (going to be annoying) */@@ -56,7 +56,7 @@ fprintf(stderr, usage, argv[0]);
return EXIT_FAILURE; } - while ((opt = getopt(argc, argv, "zs:i:")) != -1) { + while ((opt = getopt(argc, argv, "zs:f:")) != -1) { switch (opt) { case 'z': show_addr = false;@@ -67,7 +67,7 @@ fprintf(stderr, usage, argv[0]);
return EXIT_FAILURE; } break; - case 'i': + case 'f': strncpy(infile, optarg, 4096-1); break; case '?':