summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--makefile25
-rw-r--r--src/apple.h16
-rw-r--r--src/cpu/addressing.c2
-rw-r--r--src/cpu/core.h4
-rw-r--r--src/debug.h7
-rw-r--r--src/interpreter.c1
6 files changed, 20 insertions, 35 deletions
diff --git a/makefile b/makefile
index 6b45ce4..60f7f65 100644
--- a/makefile
+++ b/makefile
@@ -1,28 +1,7 @@
SDL = -L/usr/lib -lSDL2
-OBJS = build/6502.o build/addressing.o build/instructions.o build/table.o build/apple.o
-
-build/6502.o:
- gcc -c src/cpu/6502.c -o build/6502.o
-build/addressing.o:
- gcc -c src/cpu/addressing.c -o build/addressing.o
-build/instructions.o:
- gcc -c src/cpu/instructions.c -o build/instructions.o
-build/table.o:
- gcc -c src/cpu/table.c -o build/table.o
-build/apple.o:
- gcc -c src/apple.c -o build/apple.o
-
-
-
-
-
-
-default: $(OBJS)
- gcc src/main.c -o build/main
-
-interpreter: $(OBJS)
- gcc src/interpreter.c -o interpreter $(OBJS)
+interpreter:
+ gcc src/interpreter.c -o build/testing
clean:
rm build/* \ No newline at end of file
diff --git a/src/apple.h b/src/apple.h
index 01452cf..2fe3fcb 100644
--- a/src/apple.h
+++ b/src/apple.h
@@ -1,12 +1,12 @@
-#ifndef APPLE
-#define APPLE
+#ifndef APPLE_H
+#define APPLE_H
-#include"cpu/6502.h"
-#include"cpu/addressing.h"
+#include"cpu/6502.c"
+#include"cpu/addressing.c"
#include"cpu/core.h"
-#include"cpu/instructions.h"
-#include"cpu/table.h"
+#include"cpu/instructions.c"
+#include"cpu/table.c"
#define MEMORY_SIZE 4096
@@ -28,8 +28,4 @@ void AppleOn();
void AppleReset();
-byte getMemory(address x);
-
-void setMemory(address x, byte y);
-
#endif \ No newline at end of file
diff --git a/src/cpu/addressing.c b/src/cpu/addressing.c
index 97ebb00..3fd640a 100644
--- a/src/cpu/addressing.c
+++ b/src/cpu/addressing.c
@@ -169,7 +169,7 @@ AddData fAddress(Addressing mode, short x) {
AddData ret;
ret.add = fAddressGetAddress (mode, x);
ret.value = fAddressGetValue (mode, x, ret.add);
- ret.length = fAddressGetLength (mode, x);
+ ret.length = fAddressGetLength (mode);
ret.cycles = fAddressGetCycles (mode, x, ret.add);
return ret;
} \ No newline at end of file
diff --git a/src/cpu/core.h b/src/cpu/core.h
index 71a420b..03d20d0 100644
--- a/src/cpu/core.h
+++ b/src/cpu/core.h
@@ -31,4 +31,8 @@ typedef struct AddData{
byte value;
} AddData;
+byte getMemory(address x);
+
+void setMemory(address x, byte y);
+
#endif \ No newline at end of file
diff --git a/src/debug.h b/src/debug.h
index b36d187..9a365db 100644
--- a/src/debug.h
+++ b/src/debug.h
@@ -32,7 +32,12 @@ void dPageDump(short m){
for(int i = 0; i < 256; i+=16){
printf("\t");
for(int j = 0; j < 16; j+=1){
- printf("%02x ", Memory[(m+(i+j))]);
+ if ((j+1) % 4 == 0){
+ printf("%02x ", Memory[(m+(i+j))]);
+ }
+ else {
+ printf("%02x ", Memory[(m+(i+j))]);
+ }
}
printf("\n");
}
diff --git a/src/interpreter.c b/src/interpreter.c
index 5d41522..4005998 100644
--- a/src/interpreter.c
+++ b/src/interpreter.c
@@ -2,6 +2,7 @@
// Useful for carrying out tests of the CPU instructions.
// Refer to interpreter.md for the manual
+#include"apple.c"
#include"debug.h"
//Write a custom getc function here which ignores spaces