STM8 RRCW instruction incorrect results
Greetings, I'm attempting to use the RRCW (Rotate Word Right Logical through Carry) instruction (op code 56), but it is giving unexpected results on bit 15.
The documentation on PM0044 (pg 138/162) says: "Bit 15 of the result is a copy of the CC.C bit value before the operation." Later in the same page it says for the CC.C bit: "C ⇒ b0 Set if, before the shift, the MSB of register or memory was set, cleared otherwise." I take this to mean this op code will take 0b0000000000000001, and result in 0b1000000000000000. However, what I get instead varies, but most often results in either 0b000000000000000 (entire word cleared) or 0b110000000000000 (two bits out of word set).
The following assembler uses asxxxx, but regardless of the specific assembler used I can confirm the actual bytes sent to program flash are for op code 56 in this situation:
ldw x, #0x1
rrcw x ; 0b1000000000000000, good
rrcw x ; 0b1100000000000000, bad
rrcw x ; 0b0110000000000000, bad