diff options
| author | vin <git@vineetk.net> | 2024-06-30 06:28:41 -0400 |
|---|---|---|
| committer | vin <git@vineetk.net> | 2024-06-30 06:28:41 -0400 |
| commit | 5535e5de70684dd8406e53d6ce928faf9011336c (patch) | |
| tree | 4e5ad2b28937462452a08d57bacfc116d6235de3 /cpu.c | |
| parent | 4b7fae00103c9fbaeeba45a78a7d0c910d243dc0 (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.c | 8 |
1 files changed, 5 insertions, 3 deletions
| @@ -664,7 +664,7 @@ static void | |||
| 664 | sbc(uint8_t arg) | 664 | sbc(uint8_t arg) |
| 665 | { | 665 | { |
| 666 | /* SBC is described online as ADC with argument as two's complement */ | 666 | /* SBC is described online as ADC with argument as two's complement */ |
| 667 | adc(~arg + 1); | 667 | adc(~arg); |
| 668 | } | 668 | } |
| 669 | 669 | ||
| 670 | static void | 670 | static void |
| @@ -733,7 +733,8 @@ tay(void) | |||
| 733 | static void | 733 | static void |
| 734 | tsx(void) | 734 | tsx(void) |
| 735 | { | 735 | { |
| 736 | regs.x = PULL(); | 736 | // regs.x = PULL(); |
| 737 | regs.x = regs.sp; | ||
| 737 | 738 | ||
| 738 | STATUS_UPDATE_ZERO(regs.x); | 739 | STATUS_UPDATE_ZERO(regs.x); |
| 739 | STATUS_UPDATE_NEGATIVE(regs.x); | 740 | STATUS_UPDATE_NEGATIVE(regs.x); |
| @@ -751,7 +752,8 @@ txa(void) | |||
| 751 | static void | 752 | static void |
| 752 | txs(void) | 753 | txs(void) |
| 753 | { | 754 | { |
| 754 | PUSH(regs.x); | 755 | // PUSH(regs.x); |
| 756 | regs.sp = regs.x; | ||
| 755 | } | 757 | } |
| 756 | 758 | ||
| 757 | static void | 759 | static void |
