68HC05 Instruction Set — Part 5
Rotate Memory & Registers
ROL rotate a memory location left by one bit ROLA rotate the accumulator left by one bit ROLX rotate the index register left by one bit ROR rotate a memory location right by one bit RORA rotate the accumulator right by one bit RORX rotate the index register right by one bit
BIT bit test the accumulator and set the N or Z flags CMP compare an operand to the accumulator CPX compare an operand to the index register TST test a memory location and set the N or Z flags TSTA test the accumulator and set the N or Z flags TSTX test the index register and set the N or Z flags
Notes:
Rotate instructions operate in a fashion similar to shift instructions. A rotated operand is first shifted in the direction indicated by the instruction. The empty bit created by the shift (LSB for left and MSB for right) takes the state of the condition code register carry (C) bit, and the carry bit takes the state of the bit shifted out of the operand (MSB for left and LSB for right).
The BIT instruction sets the condition code register negative (N) or (Z) flags based on the logical AND of the accumulator and an operand. The result of this logical AND is discarded.
The compare instructions allow subsequent branch operations to determine if an argument is equal to, not equal to, greater than, greater than or equal to, less than, or less than or equal to the value in the designated register.
A register and an operand are “compared” by non-destructively subtracting the operand from the register and setting the condition code register C, N, or Z bits.
The test instructions set the negative and zero flags by non-destructively subtracting zero from a memory location (TST), the accumulator (TSTA), or the index register (TSTX).