diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile | 41 | ||||
-rw-r--r-- | src/cpu/core.h | 26 | ||||
-rw-r--r-- | src/cpu/table.c | 1 | ||||
-rw-r--r-- | src/main.c | 10 | ||||
-rw-r--r-- | src/signetics.h | 2 | ||||
-rw-r--r-- | src/video/interface.h | 4 |
6 files changed, 65 insertions, 19 deletions
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); } @@ -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 |