Skip to main content

Program to right shift data within the 8-bit register

Statement: Shift an 8-bit data four bits right. The data is stored in register B.

Example:

If Register B = 90H
Then after shifting four bits right, register B = 09H

Program:

MOV A, B            ; Move the contents of B register into A    
RAR                     ; Rotate right 
RAR                      ; Rotate right
RAR                     ; Rotate right
RAR                     ; Rotate right
MOV B, A            ; Move the contents of A into B register
HLT                       ; Terminate program execution

Comments