summaryrefslogtreecommitdiff
path: root/cpu.c
diff options
context:
space:
mode:
authorvin <git@vineetk.net>2024-06-30 06:28:41 -0400
committervin <git@vineetk.net>2024-06-30 06:28:41 -0400
commit5535e5de70684dd8406e53d6ce928faf9011336c (patch)
tree4e5ad2b28937462452a08d57bacfc116d6235de3 /cpu.c
parent4b7fae00103c9fbaeeba45a78a7d0c910d243dc0 (diff)
change SBC to be ADC with one's complement instead of two's
It seems that is what was expected when run with nestest.
Diffstat (limited to 'cpu.c')
-rw-r--r--cpu.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/cpu.c b/cpu.c
index c7d25ef..bcaa00b 100644
--- a/cpu.c
+++ b/cpu.c
@@ -664,7 +664,7 @@ static void
sbc(uint8_t arg)
{
/* SBC is described online as ADC with argument as two's complement */
- adc(~arg + 1);
+ adc(~arg);
}
static void
@@ -733,7 +733,8 @@ tay(void)
static void
tsx(void)
{
- regs.x = PULL();
+// regs.x = PULL();
+ regs.x = regs.sp;
STATUS_UPDATE_ZERO(regs.x);
STATUS_UPDATE_NEGATIVE(regs.x);
@@ -751,7 +752,8 @@ txa(void)
static void
txs(void)
{
- PUSH(regs.x);
+// PUSH(regs.x);
+ regs.sp = regs.x;
}
static void