From 580a7040ba53367c15ca682d4ea90c31fdcca45f Mon Sep 17 00:00:00 2001 From: alekseiplusplus Date: Fri, 1 Dec 2023 00:47:05 +1100 Subject: large progress approaching functionality --- src/cpu/6502.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/cpu/6502.c') diff --git a/src/cpu/6502.c b/src/cpu/6502.c index 17796cf..ab8248e 100644 --- a/src/cpu/6502.c +++ b/src/cpu/6502.c @@ -33,10 +33,11 @@ void flagClear(byte flag){ // Functions which perform reusable routines for finding if a specific flag should be set. void SetFlagN(byte x){ - if ((x & flag_N) == flag_N) + /*if ((x & flag_N) == flag_N) SetFlag(flag_N, 1); else - SetFlag(flag_N, 0); + SetFlag(flag_N, 0);*/ + P = (x & flag_N) | (P & ~flag_N); } //Perform prior to any changes @@ -84,9 +85,11 @@ void SetMemory(address x, byte y){ byte GetStack() { + S--; return GetMemory(0x01FF - S); } -void SetStack(byte z) { - SetMemory(0x01FF - S, z); +void SetStack(byte x) { + SetMemory(0x01FF - S, x); + S++; } -- cgit v1.2.3