Hey guys and gals!
Is there any way on the 6502 that you can check if all bits in the accumulator are set to 1 in a specific order in just one operation?
I thought AND would do the trick but I can only check if ANY of the bits are set that way.
This branches with AND:
I would like it to branch only if BOTH bit 2 and 3 in a are set, as in %1100, %1110 or %1101. Is there any way I can do this or do I have to AND each bit separately?
Cheers!
Is there any way on the 6502 that you can check if all bits in the accumulator are set to 1 in a specific order in just one operation?
I thought AND would do the trick but I can only check if ANY of the bits are set that way.
This branches with AND:
Code:
lda #%1000
and #%1100
bne :+
and #%1100
bne :+
I would like it to branch only if BOTH bit 2 and 3 in a are set, as in %1100, %1110 or %1101. Is there any way I can do this or do I have to AND each bit separately?
Cheers!