summaryrefslogtreecommitdiff
path: root/src/cpu/6502.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cpu/6502.c')
-rw-r--r--src/cpu/6502.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/cpu/6502.c b/src/cpu/6502.c
index 366882f..e7c1669 100644
--- a/src/cpu/6502.c
+++ b/src/cpu/6502.c
@@ -8,18 +8,11 @@ address PC = 0x0000;
byte* Memory;
byte getFlag(byte flag) {
- return ((P & flag) == flag) ? 1 : 0;
+ return (P & flag) ? 1 : 0;
}
void SetFlag(byte flag, int x) {
- if (x == 1){
- if ((P & flag) == 0x0) P += flag;
- }else if (x == 0){
- if ((P & flag) == flag) P -= flag;
- }
- else{
- fprintf(stderr, "SetFlag() passed arg neither 0 or 1");
- }
+ P = (P & ~flag) | ((x != 0) ? flag : 0);
}
void flagSet(byte flag){