easy6502
easy6502 copied to clipboard
SBC (subtract with carry)
It seems that SBC is not calculating correctly
Address Hexdump Dissassembly
-------------------------------
$0600 a9 09 LDA #$09
$0602 e9 01 SBC #$01
0600: a9 09 e9 01
A=$07 X=$00 Y=$00
SP=$ff PC=$0605
NV-BDIZC
00110001
The calculation is correct.
SBC is subtract with carry. If C is 0 prior to the SBC instruction, it subtracts one more than you expect.
To avoid the problem, always use SEC instruction before SBC