Find Smaller Value in Registers in Assembly Language


Write and run a program using 8086 assembly language that transfers two byte values stored in memory to AL and BL registers respectively. It then compares AL and BL register values and stores the smaller of the two in DL register. [Dec 2015, Set-3]

DATA SEGMENT
    NUM1 DB 15H
    NUM2 DB 9H
DATA ENDS

CODE SEGMENT
START:

    ASSUME CS:CODE, DS:DATA 
    MOV AX, DATA
    MOV DS, AX

    MOV AL, NUM1
    MOV BL, NUM2
    
    CMP AL, BL
    JLE RESULT
    
    MOV DL, BL
    
    MOV AX, 4C00H
    INT 21H  
    
    RESULT: MOV DL,AL
    
    MOV AX, 4C00H
    INT 21H    
CODE ENDS

END START