diff --git a/Makefile b/Makefile index 7271948..26a3c04 100644 --- a/Makefile +++ b/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 diff --git a/src/vm.c b/src/vm.c index 2563ae7..006bd6b 100644 --- a/src/vm.c +++ b/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, diff --git a/src/vm.h b/src/vm.h index 99748c0..3bd56c6 100644 --- a/src/vm.h +++ b/src/vm.h @@ -2,7 +2,7 @@ #pragma once // WAAAAAY better than a dumb header guard ;) -#define RAM_SIZE 16384 // highest it can be given 16-bit addresses +#define RAM_SIZE 65536 // highest it can be given 16-bit addresses #define STACK_LIM 64