Swapping Upper and Lower Bits of AL Register in Assembly Language


Write and run a program using 8086 assembly language that interchanges the upper and lower four bits of AL register. You may assume that AL register contains 1001 0110. After execution of your program AL should contain 0110 1001. [Dec 2014, Set-1]

CODE SEGMENT
START:
    ASSUME CS:CODE 
    
    MOV AL, 10010110B
    
    MOV BL,AL
    MOV CL,4H    
    
    MOV DL, 00001001B 
    
    MOV AL, BL 
    MOV CL, 4H
    ROL AL,CL
       
    ADD AL,DL 
     
CODE ENDS

END START