The RAR instruction

The RAR (Rotate Accumulator Right through Carry) instruction performs a rotate-right operation on the accumulator with the carry flag taken into account.

The RAR instruction format

InstructionDescription
RAR This format is used to rotate the 8-bit value in register A to the right + CY.

Usage example

; Author: Evgeny Sergeevich Dovgopolov

main:
    mvi     a, 01h  ; Load the hexadecimal value 01h into register A
    stc             ; Set the carry flag CY
    cmc             ; Invert the carry flag
    rar             ; Rotate the value in register A one bit to the right with the CY flag taken into account

    hlt             ; Stop program execution

Example taken from the textbook "HANDYFAR - MASM (Evgeny Sergeevich Dovgopolov)".

Processor status flags

S
Yes
Z
Yes
AC
No
P
Yes
CY
Yes