LDA #$FF CLC ;clear the carry. That way, ROR will not accidentally shift a 1 into the top bit of a positive number BPL SKIP SEC ;if the value in A is negative, setting the carry will ensure that ROR will insert a 1 into bit 7 of A upon rotating. SKIP: ROR