Hi, Keith,
Maybe I did not elaborate it clearly. Firstly, the following assembly instruction "btst" only polls a bit in memory or register, and copy the bit logic to Carry bit in CCR register. for example the following instruction:
If the #M_PD5 bit is set, the C bit(bit 0 in CCR register) is set in CCR after the btst instruction, if the #M_PD5 bit is cleared, the C bit in CCR is cleared after the instruction. Note that the btst only polls the bit and take effect on the carry bit in CCR, it does not clear or set the bit in memory or register.
The bcc executes the jump based on the Carry bit in CCR register. For the instruction bcc _elsewhere, if the Carry bit in CCR register is cleared, the code beginning with _elsewhere is executed, if the Carry bit is set, the next instruction will be executed.
In conclusion, the btst changes the carry bit in CCR, the bcc instruction will branch based on the carry bit logic in CCR.
Hope it can help you
BR
Xiangjun Rong