Smaller of Two Numbers in Assembly Language


Write and run a program using 8086 assembly language to find the smaller of two values stored in two different memory locations. [Dec 2012, Set-3]

DATA SEGMENT
    NUM1 DB 15H
    NUM2 DB 9H
    SMALL DB ?
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 SMALL, BL
    
    MOV AX, 4C00H
    INT 21H  
    
    RESULT: MOV SMALL, AL
    
    MOV AX, 4C00H
    INT 21H    
CODE ENDS

END START