From c6da616d018ecfc5a26686e88ab520b54b7fa6ed Mon Sep 17 00:00:00 2001 From: alekseiplusplus Date: Mon, 27 Nov 2023 18:51:50 +1100 Subject: revamped build; minor pointless changes --- src/Makefile | 41 +++++++++++++++++++++++++++++++++++++++++ src/cpu/core.h | 26 +++++++++++++++++--------- src/cpu/table.c | 1 + src/main.c | 10 ++-------- src/signetics.h | 2 +- src/video/interface.h | 4 +++- 6 files changed, 65 insertions(+), 19 deletions(-) create mode 100644 src/Makefile (limited to 'src') diff --git a/src/Makefile b/src/Makefile new file mode 100644 index 0000000..fcb1c3a --- /dev/null +++ b/src/Makefile @@ -0,0 +1,41 @@ +SDL = -L/usr/lib -lSDL2 + +MAIN_COMPONENTS = cpu.a video.a apple.a + +TARGET_CPU = cpu/6502.o cpu/addressing.o cpu/instructions.o cpu/table.o +TARGET_VIDEO = video/ncurses.o + + +# Executable Targets + +default: $(MAIN_COMPONENTS) + gcc -o ../build/apple-c main.c $^ + +interpreter: cpu.a apple.a + gcc -o ../build/interpreter interpreter.c $^ + + + +# Internal Libraries + +cpu.a: $(TARGET_CPU) + ar cr $@ $^ + +video.a: $(TARGET_VIDEO) + ar cr $@ $^ + +apple.a: + ar cr $@ $^ + +*.o: *.c + gcc -c $^ + + + +# Clean + +clean: + rm *.a + rm *.o + rm cpu/*.o + rm video/*.o \ No newline at end of file diff --git a/src/cpu/core.h b/src/cpu/core.h index 03d20d0..26a6bc5 100644 --- a/src/cpu/core.h +++ b/src/cpu/core.h @@ -1,12 +1,16 @@ #ifndef CPU_CORE_H #define CPU_CORE_H -typedef unsigned char - byte; -typedef unsigned short - address; +typedef +unsigned char +byte; -enum Addressing { +typedef +unsigned short +address; + +enum Addressing +{ eImmediate, eAccumulator, eZeroPage, @@ -21,15 +25,19 @@ enum Addressing { eIndirectAbsolute, eRelative }; +typedef +int +Addressing; -typedef int Addressing; - -typedef struct AddData{ +typedef +struct AddData +{ int cycles; int length; address add; byte value; -} AddData; +} +AddData; byte getMemory(address x); diff --git a/src/cpu/table.c b/src/cpu/table.c index 0f70889..fb419d2 100644 --- a/src/cpu/table.c +++ b/src/cpu/table.c @@ -16,6 +16,7 @@ void callInstructionTable(int i, address val){ uintptr_t a = getInstructionTableFunction(i); memcpy(&func, a, sizeof(uintptr_t)); Addressing* r = (InstructionTable + ((sizeof(uintptr_t)*256) + (sizeof(Addressing) * i))); + idata = fAddress(*r, val); func(*r, val); } diff --git a/src/main.c b/src/main.c index fe81be5..746d290 100644 --- a/src/main.c +++ b/src/main.c @@ -1,14 +1,8 @@ -#include"include.h" - - int main() { + //VideoInit(); - - - // This line retrieves data about instruction used - idata = fAddress(addr, val); - + AppleOn(); return 0; } \ No newline at end of file diff --git a/src/signetics.h b/src/signetics.h index af25a98..45f9a3a 100644 --- a/src/signetics.h +++ b/src/signetics.h @@ -3,7 +3,7 @@ #include"cpu/core.h" #include"stdlib.h" -byte CharacterROM[0x40] = { +const byte CharacterROM[0x40] = { '@' , 'A' , 'B' , 'C' , 'D' , 'E' , 'F' , 'G' , 'H' , 'I' , 'J' , 'K' , 'L' , 'M' , 'N' , 'O' , 'P' , 'Q' , 'R' , 'S' , 'T' , 'U' , 'V' , 'W' , 'X' , 'Y' , 'Z' , '[' , '\\', ']' , '^' , '_' , ' ' , '!' , '"' , '#' , '$' , '%' , '&' , '\'', '(' , ')' , '*' , '+' , ',' , '-' , '.' , '/' , diff --git a/src/video/interface.h b/src/video/interface.h index 9c77de2..0167037 100644 --- a/src/video/interface.h +++ b/src/video/interface.h @@ -3,4 +3,6 @@ void VideoInit(); -void VideoClose(); \ No newline at end of file +void VideoClose(); + +void DisplayCharacter(char In); \ No newline at end of file -- cgit v1.2.3