Tidy up makefile, fix VM memory bug
This commit is contained in:
parent
a002c494b7
commit
736bc261c1
21
Makefile
21
Makefile
|
@ -8,16 +8,21 @@
|
|||
|
||||
# Note: I understand this makefile is not as optimal as it could/should be
|
||||
|
||||
CC = gcc
|
||||
CFLAGS ?= -Wall -Wpedantic -Wextra -std=c99
|
||||
ROM = rom.bin
|
||||
CC = gcc
|
||||
CFLAGS ?= -Wall -Wpedantic -Wextra -std=c99
|
||||
DEBUG = -g -ggdb
|
||||
ROM = rom.bin
|
||||
TRACE_SUFFIX =
|
||||
TARGET = hard
|
||||
|
||||
all: hard
|
||||
all: $(TARGET)
|
||||
|
||||
trace: CFLAGS += -g -ggdb -DTRACE -lreadline
|
||||
debug: CFLAGS += $(DEBUG)
|
||||
debug: $(TARGET)
|
||||
|
||||
trace: CFLAGS += $(DEBUG) -DTRACE -lreadline
|
||||
trace: TRACE_SUFFIX = -trace
|
||||
trace: hard
|
||||
trace: $(TARGET)
|
||||
|
||||
|
||||
disass: CFLAGS += -DTRACE -lreadline
|
||||
|
@ -37,7 +42,7 @@ rom: rom.bin
|
|||
rom.bin: src/rom.asm src/zeropage.incbin
|
||||
./ass.sh src/rom.asm src/zeropage.incbin
|
||||
|
||||
hard: bin/main.o bin/vm.o
|
||||
$(TARGET): bin/main.o bin/vm.o
|
||||
$(CC) $(CFLAGS) -o bin/$@$(TRACE_SUFFIX) $^
|
||||
|
||||
clean:
|
||||
|
@ -45,5 +50,5 @@ clean:
|
|||
cleano:
|
||||
rm -f bin/*.o
|
||||
|
||||
.PHONY: all trace clean clean
|
||||
.PHONY: all debug trace clean cleano
|
||||
|
||||
|
|
3
src/vm.c
3
src/vm.c
|
@ -303,9 +303,10 @@ void vm_trace(struct CPU *cpu, uint8_t *mem, struct TRACE_T *tstate)
|
|||
break;
|
||||
case 'm':
|
||||
if (sscanf(command+2,"%i %i", &mem_start,
|
||||
&num_bytes) == EOF)
|
||||
&num_bytes) == EOF) {
|
||||
; // So far, sscanf always returns EOF
|
||||
// (idk why). TODO: fix eventually
|
||||
}
|
||||
printf("Dumping %d bytes of memory starting "
|
||||
"at 0x%04x\n", num_bytes, mem_start);
|
||||
print_vm_memory(mem, (uint16_t)mem_start,
|
||||
|
|
Loading…
Reference in New Issue