6502 icon indicating copy to clipboard operation
6502 copied to clipboard

SBC mis-simulation (carry bit)

Open migry opened this issue 7 months ago • 0 comments

I have used your code in a simulator project of mine which simulates the Acorn Atom home computer.

I tracked down some faulty behaviour to the first use of a SBC #immediate instruction, which was setting the carry bit incorrectly.

I tried an online interactive simulator just executing SBC #$3F and setting the initial value of A ($0D). It calculated that the carry would be clear whereas your code sets the carry.

I modified the code to calculate the new carry bit using code found in another simulator. This fixed the faulty behaviour, however the simulator has further problems possibly pointing to other issues. I will try a test suite next.

In summary the carry bit calculation for sbc_J appears to be buggy.

migry avatar Jun 17 '25 01:06 migry