LSL doesn't affect Carry Flag in the simulator. I have test LSL and RRX and same problem, Carry is not affect. someone can very this please ? unsigned char bitflop(unsigned char Din) __arm { unsigned char Ans; // in b7b6b5b4b3b2b1b0 // out b0b1b2b3b4b5b6b7 // Switch in Arm Mode // R4 = Din // R3 = Ans // R2 = Cntr __asm { LDAV R4,R1,Din ; Our byte MOV R2, #0 ; Cntr = 0 MOV R4,R4,LSL #24 loop: MOV R4,R4,LSL #1 ; Rotate Left with C 1bit MOV R3,R3,RRX ; Rotate Right with C 1bit ADD R2,R2, #00000001 ; Cntr++ CMP R2, #00000008 BLT loop ; Cntr > 8 MOV R3,R3,LSR #24 ; Restore unsigned char STAV R3,R1,Ans } return (Ans) ; }
You need to use MOVS when you want to get the flags updated. With out the suffix 'S' flags are not updated. Reinhard