Compare Value stored in Registers in Assembly Language


Write and run a program using 8086 assembly language that checks if the values stored in AL register and BL register are same. If both the values are same, the program output is “SAME”, otherwise it outputs nothing. [June 2014, Set-1]

DATA SEGMENT
    NUM1 DB 15H 
    NUM2 DB 15H
    MESSAGE db "SAME $"
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
    JE RESULT
     
    
    RESULT: 
    MOV DX, OFFSET MESSAGE
    MOV AH, 09H
    INT 21h
    
    MOV AX, 4C00H
    INT 21H    
CODE ENDS

END START