summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralekseiplusplus <alekseijeaves@protonmail.com>2023-12-07 18:28:47 +1100
committeralekseiplusplus <alekseijeaves@protonmail.com>2023-12-07 18:28:47 +1100
commitdc7e55d2798c1530fc301b232ce01d032fb9935f (patch)
tree17fe9d1b9937e4c48e7382dd6f1ece37df1de575
parentf8df4908fe6986e691ea96b4b07ffbff349ccce0 (diff)
FIXED THAT BUG.
-rw-r--r--log/log-readable.cpp10
-rw-r--r--src/cpu/instructions.c11
-rw-r--r--src/main.c2
3 files changed, 15 insertions, 8 deletions
diff --git a/log/log-readable.cpp b/log/log-readable.cpp
index e110cdc..559d7e2 100644
--- a/log/log-readable.cpp
+++ b/log/log-readable.cpp
@@ -28,7 +28,7 @@ int main()
y.erase(0,1);
Convert[x] = y;
- cout << x << " : " << Convert[x] << endl;
+ //cout << x << " : " << Convert[x] << endl;
}
RomLine.close();
@@ -42,7 +42,9 @@ int main()
{
string pc;
string t;
+
#define GobbleDelimiter Log >> t; Output << " : "
+
// Time Counter
Log >> t; Output << t; GobbleDelimiter;
// Program counter
@@ -53,14 +55,13 @@ int main()
Log >> t; Output << t; GobbleDelimiter;
// Y
Log >> t; Output << t; GobbleDelimiter;
- // Flags for( )
+ // Flags
for (int i = 0; i < 8; i++) {
char c;
Log >> c;
Output << c;
}
GobbleDelimiter;
- //Log >> t; Output << t; GobbleDelimiter;
// Stack Pointer
Log >> t; Output << t;
// If a mapping exists, print out the program counter and line code.
@@ -69,7 +70,8 @@ int main()
Output << " " << s;
}
// Otherwise, don't do anything.
- catch (out_of_range) { }
+ catch (out_of_range) {
+ }
// Newline
Output << endl;
}
diff --git a/src/cpu/instructions.c b/src/cpu/instructions.c
index 2b034c4..0f002d3 100644
--- a/src/cpu/instructions.c
+++ b/src/cpu/instructions.c
@@ -226,9 +226,11 @@ void fLSR(Addressing addr) {
void fROL(Addressing addr){
byte m = (addr == eAccumulator) ? acc : idata.value;
- SetFlag(flag_C, (m & 0b10000000));
+ byte flag_store = (m & 0b10000000);
+ //SetFlag(flag_C, (m & 0b10000000));
m = (m << 1) & 0b11111110;
m |= (getFlag(flag_C)) ? 0b00000001 : 0;
+ SetFlag(flag_C, flag_store);
SetFlagN(m);
SetFlagZ(m);
@@ -239,13 +241,16 @@ void fROL(Addressing addr){
void fROR(Addressing addr){
byte m = (addr == eAccumulator) ? acc : idata.value;
-
- SetFlag(flag_C, (m & 0b00000001));
+
+ byte flag_store = (m & 0b00000001);
+ //SetFlag(flag_C, (m & 0b00000001));
m = (m >> 1) & 0b01111111;
m |= (getFlag(flag_C)) ? 0b10000000 : 0;
+ SetFlag(flag_C, flag_store);
SetFlagN(m);
SetFlagZ(m);
+
(addr == eAccumulator)
? acc = m
: SetMemory(idata.add, m);
diff --git a/src/main.c b/src/main.c
index f8b5457..59f4117 100644
--- a/src/main.c
+++ b/src/main.c
@@ -20,7 +20,7 @@ int main() {
// Logging
fprintf(Log,
"%04x : %04x : %02x : %02x : %02x : %c%c_%c%c%c%c%c : %02x\n",
- Time, PC-idata.length, acc, X, Y,
+ Time, PC, acc, X, Y,
getFlag(flag_N) ? 'N':'.' ,
getFlag(flag_V) ? 'V':'.' ,
getFlag(flag_B) ? 'B':'.' ,