Klaus2m5 wrote:
Why TAY TYA? TAY only would be sufficient.
Good call -- somehow that's so obvious I missed it!
Unfortunately 65xx CPU's don't have a lot of registers, and in Scot's case -- with TOS in A -- I think it's safe to assume Y also has something important in it.
INC A DEC A (or similar) leaves Y alone but it's still 4 cycles. You're stuck with two instructions because you need DEC A to undo the change made by INC A.
Re needing to undo the change you made to A, the only exception I can see is if you used XBA (exchange the high and low bytes) as the means to update the flags.
If the result is zero -- and
assuming you intended to test for zero anyway -- then the flag update only costs 2 cycles (with no need for another XBA to undo the "change" you made). But it's hardly a general-purpose solution.
For that, CMP# (or similar) is the way to go, as others have already noted.
_________________
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html