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 --- ToDo | 31 ------------------------------- makefile | 8 -------- 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 +++- 8 files changed, 65 insertions(+), 58 deletions(-) delete mode 100644 ToDo delete mode 100644 makefile create mode 100644 src/Makefile diff --git a/ToDo b/ToDo deleted file mode 100644 index a077586..0000000 --- a/ToDo +++ /dev/null @@ -1,31 +0,0 @@ -Immediate To Do List -Now that I have decided to pick this back up to finish it off, I have some things which I need to do. - [X] Rewrite the makefile to compile all the files together using the standard make procedure. - -> [ ] Need to figure out what is up with the multiple definitions - [ ] Write out interface.h functions - [X] table.h refuses to play ball with uintptr_t types. - - - - -! ! ! ! ! ! !! ! ! ! ! !! -WE ARE BACK - -- Need to define GetKeyboard events and shtuff for interacting with special memory locations - - - - -TESING PHASE -[ ] Test how stack works. Create a stack position macro. -[ ] Once all stack commands are certain, push processor status to stack to be able to debug flags. - -Make all 6502 related parts even more modular, so as to make it possible to use in other projects if the want arises. - - - - Tests to make -LDA/SBC -JMP -CMP,CPX,CPY -stack instructions diff --git a/makefile b/makefile deleted file mode 100644 index b352f37..0000000 --- a/makefile +++ /dev/null @@ -1,8 +0,0 @@ -SDL = -L/usr/lib -lSDL2 - -interpreter: - mkdir build - gcc src/interpreter.c -o build/testing - -clean: - rm build/* \ No newline at end of file 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