diff options
author | alekseiplusplus <alekseijeaves@protonmail.com> | 2023-04-29 18:04:49 +1000 |
---|---|---|
committer | alekseiplusplus <alekseijeaves@protonmail.com> | 2023-04-29 18:04:49 +1000 |
commit | 138bb8eeb4b67ab17a6d77e7afa9cd265759da0d (patch) | |
tree | bcafea69e68333a5b8b6a2e3263dd1a46b996648 | |
parent | 1c30dea63b65c7e117b3fd8ba0140dbf77a0ef73 (diff) |
misc. fixes, finished LDA test.
-rw-r--r-- | ToDo | 8 | ||||
-rw-r--r-- | headers/debug.h | 2 | ||||
-rw-r--r-- | interpreter.c | 10 | ||||
-rw-r--r-- | test/01-LDA | 33 | ||||
-rw-r--r-- | test/02-Stack | 2 | ||||
-rw-r--r-- | test/03-Arithmetic | 2 | ||||
-rw-r--r-- | test/adc | 0 | ||||
-rw-r--r-- | test/load | 19 |
8 files changed, 47 insertions, 29 deletions
@@ -1,6 +1,6 @@ -Before the next commit, this should all be completed. - -Go through instruction.h and fix every instruction to work with data structures +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. Link pthreads library, and segregate work into multiple threads. @@ -8,7 +8,7 @@ Figure out simple threading in C to run other programs within the same address s - Tests to run + Tests to make LDA/SBC JMP CMP,CPX,CPY diff --git a/headers/debug.h b/headers/debug.h index 4c2a9ba..cb9cc85 100644 --- a/headers/debug.h +++ b/headers/debug.h @@ -25,7 +25,7 @@ void dPageDump(short m){ for(int i = 0; i < 256; i+=16){ printf("\t"); for(int j = 0; j < 16; j+=1){ - printf("%2x ", Memory[(m+(i+j))]); + printf("%02x ", Memory[(m+(i+j))]); } printf("\n"); } diff --git a/interpreter.c b/interpreter.c index ff96650..0261e57 100644 --- a/interpreter.c +++ b/interpreter.c @@ -40,8 +40,9 @@ int main(int argc, char *argv[]){ continue; } + // FIXME!!! PAGE IS CLAMPED TO 00 ON THE LONG MODE // Dump a page of memory - if (c == 'M' || c == 'm'){ //EXPAND, MAKE IT PRINT SINGLE AND PAGE + if (c == 'M' || c == 'm'){ address x = 0; do { c = getc(stdin); @@ -51,10 +52,12 @@ int main(int argc, char *argv[]){ c = getc(stdin); if (c != '\n'){ x <<= 8; - x = dCharToNum(c) << 4; + x += dCharToNum(c) << 4; x += dCharToNum(getc(stdin)); + printf("@%04x:%02x\n", x, Memory[x]); } else{ + printf("Page %02x", x); dPageDump(x); } continue; @@ -94,10 +97,7 @@ int main(int argc, char *argv[]){ for(int i = 1; i >= 0; i--){ y += (dCharToNum(getc(stdin)) << (4*i)); } - - printf("%4x:%2x\n", x, y); Memory[x] = y; - continue; } diff --git a/test/01-LDA b/test/01-LDA new file mode 100644 index 0000000..7b0f0d1 --- /dev/null +++ b/test/01-LDA @@ -0,0 +1,33 @@ +# 01-LDA +#This test verifies if each addressing mode works, using the LDA instruction. + +#Init Memory + +s0007.10 +s0008.02 +s0009.02 +s000a.64 +s000b.48 +s000c.32 +s0202.11 +s0212.22 + +#Init Registers + +a201 #LDX $1 +a002 #LDY $2 + +#Tests + +a9ff 8510 #LDA Immediate store in 0010 +a50a 8511 #LDA ZP 0a store in 0011 +b50a 8512 #LDA ZP+X 0a store in 0012 +ad000a 8513 #LDA Abs store in 0013 +bd000a 8514 #LDA Abs+X store in 0014 +b9000a 8515 #LDA Abs+Y store in 0015 +a107 8517 #LDA In. X store in 0018 +b107 8518 #LDA In. Y store in 0019 + +#Print 00 Page +m00 +q diff --git a/test/02-Stack b/test/02-Stack new file mode 100644 index 0000000..037ae10 --- /dev/null +++ b/test/02-Stack @@ -0,0 +1,2 @@ +# 02-Stack +#This test checks whether each stack operation functions as expected. diff --git a/test/03-Arithmetic b/test/03-Arithmetic new file mode 100644 index 0000000..72b40e1 --- /dev/null +++ b/test/03-Arithmetic @@ -0,0 +1,2 @@ +# 03-Arithmetic +#Tests ADC, SBC, and all increment operations for value and flag correctness. diff --git a/test/adc b/test/adc deleted file mode 100644 index e69de29..0000000 --- a/test/adc +++ /dev/null diff --git a/test/load b/test/load deleted file mode 100644 index 14cdc44..0000000 --- a/test/load +++ /dev/null @@ -1,19 +0,0 @@ -#/Beginning of test. -s0000.01 -s0001.02 -s000a.64 -s000b.48 -s020c.7f - -a201 #LDX $1 - -a9ff 8510 #LDA FF, store in 0010 -a50a 8511 #LDA ZP 0a, store in 0011 -b50a 8512 #LDA ZP+X 0a, store in 0012 - -ad000a 8513 #LDA Abs, store in 0013 -bd000a 8513 #LDA Abs+X, store in 0014 - -m00 -m0001 -q |