Separate Upper and Lower Bits of 8 bit Register in Assembly Language


Write and run a program using 8086 assembly language that separates the upper and lower 4 bits of the data stored in BL register. The result is stored in AH and AL register. For example, if BL register contains : 0110 1001 then after the program is run AH register will contain 0000 0110 and AL register will contain 0000 1001 [June 2014, Set-3]

CODE SEGMENT
START:
    ASSUME CS:CODE
    MOV BL, 01101001B 
    MOV AL, BL
    AND AL, 00001111B  
    MOV CL, 4H
    ROL AL, CL
     
    MOV AH,BL
    AND AH, 11110000B
    ROR AH,CL 
        
CODE ENDS

END START