diff options
author | alekseiplusplus <alekseijeaves@protonmail.com> | 2023-12-01 02:56:13 +1100 |
---|---|---|
committer | alekseiplusplus <alekseijeaves@protonmail.com> | 2023-12-01 02:56:13 +1100 |
commit | 8ec080d0cd9fd62c0de20780581a4750d078ea94 (patch) | |
tree | 6ade354b2ddb37dba7dedd9d7eab0f8478071ff5 /src/cpu/6502.c | |
parent | 580a7040ba53367c15ca682d4ea90c31fdcca45f (diff) |
progress, still WIP
Diffstat (limited to 'src/cpu/6502.c')
-rw-r--r-- | src/cpu/6502.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/cpu/6502.c b/src/cpu/6502.c index ab8248e..366882f 100644 --- a/src/cpu/6502.c +++ b/src/cpu/6502.c @@ -40,15 +40,13 @@ void SetFlagN(byte x){ P = (x & flag_N) | (P & ~flag_N); } -//Perform prior to any changes +//Perform prior to any changes TODO: FIX THIS! WTF WERE YOU THINKING? void SetFlagV(byte x, byte y){ - if ((x & flag_N) == (y & flag_N)){ - if (((x + y) & (flag_N ^ 0xFF)) > 0x7F) SetFlag(flag_V, 1); - else SetFlag(flag_V, 0); - }else{ - if (((x - y) & (flag_N ^ 0xFF)) > 0x7F) SetFlag(flag_V, 1); - else SetFlag(flag_V, 0); - } + address z = (address)x + (address)y; + if (z > 0xFF) + SetFlag(flag_V, 1); + else + SetFlag(flag_V, 0); } /*void SetFlagB(){ //WORK ON |