diff options
author | alekseiplusplus <alekseijeaves@protonmail.com> | 2023-11-27 21:15:03 +1100 |
---|---|---|
committer | alekseiplusplus <alekseijeaves@protonmail.com> | 2023-11-27 21:15:03 +1100 |
commit | d24ee5f20483aee9acbec9deb0dcc833d78cae49 (patch) | |
tree | 04ed06b7c0f4e475b9f5f5f1e3da2c044d6b5849 /src/cpu | |
parent | c6da616d018ecfc5a26686e88ab520b54b7fa6ed (diff) |
actually fixed build this time
Diffstat (limited to 'src/cpu')
-rw-r--r-- | src/cpu/6502.c | 5 | ||||
-rw-r--r-- | src/cpu/6502.h | 5 | ||||
-rw-r--r-- | src/cpu/addressing.c | 4 | ||||
-rw-r--r-- | src/cpu/addressing.h | 2 | ||||
-rw-r--r-- | src/cpu/core.h | 14 | ||||
-rw-r--r-- | src/cpu/instructions.c | 3 | ||||
-rw-r--r-- | src/cpu/instructions.h | 1 | ||||
-rw-r--r-- | src/cpu/table.c | 5 | ||||
-rw-r--r-- | src/cpu/table.h | 3 |
9 files changed, 31 insertions, 11 deletions
diff --git a/src/cpu/6502.c b/src/cpu/6502.c index 672ead3..a5c47f5 100644 --- a/src/cpu/6502.c +++ b/src/cpu/6502.c @@ -3,6 +3,11 @@ #include"6502.h" +byte acc, X, Y, P, S = 0x00; +address PC = 0x0000; +byte* Memory; +byte* ROM; + byte getFlag(byte flag) { return ((P & flag) == flag) ? 1 : 0; } diff --git a/src/cpu/6502.h b/src/cpu/6502.h index 093fc3c..14d65f3 100644 --- a/src/cpu/6502.h +++ b/src/cpu/6502.h @@ -7,11 +7,6 @@ #include"stdio.h" #include"core.h" -byte acc, X, Y, P, S = 0x00; -address PC = 0x0000; -byte* Memory; -byte* ROM; - // FLAGS #define flag_N 0x80 // Negative #define flag_V 0x40 // Overflow diff --git a/src/cpu/addressing.c b/src/cpu/addressing.c index 3fd640a..df632cf 100644 --- a/src/cpu/addressing.c +++ b/src/cpu/addressing.c @@ -4,6 +4,10 @@ #include"addressing.h" + +//Holds address of current instruction. +void* current_instruction; + address fAddressGetAddress(Addressing mode, short x) { switch(mode){ case eImplied: diff --git a/src/cpu/addressing.h b/src/cpu/addressing.h index 2c9c63a..5fea2fb 100644 --- a/src/cpu/addressing.h +++ b/src/cpu/addressing.h @@ -8,8 +8,6 @@ #include"6502.h" #include"instructions.h" -//Holds address of current instruction. -void* current_instruction; #define getInstructionLength(c) fAddressGetLength(*getInstructionTableAddressing(c)) diff --git a/src/cpu/core.h b/src/cpu/core.h index 26a6bc5..b305021 100644 --- a/src/cpu/core.h +++ b/src/cpu/core.h @@ -9,6 +9,16 @@ typedef unsigned short address; +extern byte acc; +extern byte X; +extern byte Y; +extern byte P; +extern byte S; +extern address PC; +extern byte* Memory; +extern byte* ROM; + + enum Addressing { eImmediate, @@ -43,4 +53,8 @@ byte getMemory(address x); void setMemory(address x, byte y); +extern void *current_instruction; +extern AddData idata; +extern void (*func)(Addressing, address); + #endif
\ No newline at end of file diff --git a/src/cpu/instructions.c b/src/cpu/instructions.c index 6e80602..a4c96d6 100644 --- a/src/cpu/instructions.c +++ b/src/cpu/instructions.c @@ -11,6 +11,9 @@ Fix all functions before performing testing */ + +AddData idata; + // Load and Store Instructions void fLDA(Addressing addr, address val){ diff --git a/src/cpu/instructions.h b/src/cpu/instructions.h index 6e8c1bf..33ba11d 100644 --- a/src/cpu/instructions.h +++ b/src/cpu/instructions.h @@ -6,7 +6,6 @@ #include"6502.h" //#include"addressing.h" -AddData idata; // Load and Store Instructions void fLDA(Addressing, address); diff --git a/src/cpu/table.c b/src/cpu/table.c index fb419d2..cdbe995 100644 --- a/src/cpu/table.c +++ b/src/cpu/table.c @@ -2,6 +2,11 @@ #include"table.h" + +void* InstructionTable; + +void (*func)(Addressing, address); + uintptr_t* getInstructionTableFunction(int i){ //Segmentation fault is occurring here, likely in next one too uintptr_t* r = (InstructionTable + (sizeof(uintptr_t)*i)); return r; diff --git a/src/cpu/table.h b/src/cpu/table.h index e54776d..c8ecb00 100644 --- a/src/cpu/table.h +++ b/src/cpu/table.h @@ -8,9 +8,6 @@ #include"string.h" #include"addressing.h" -void* InstructionTable; - -void (*func)(Addressing, address); #define InstructionTableSize (256 * (sizeof(uintptr_t) + sizeof(Addressing))) |