Logo 
Search:

Assembly Language Articles

Submit Article
Home » Articles » Assembly Language » Homework HelpRSS Feeds

Program to compare two characters and display message accordingly

Posted By: Ethan Evans     Category: Assembly Language     Views: 15220

Program to compare two characters and display message accordingly.

Code for Program to compare two characters and display message accordingly in Assembly Language

.8086
.MODEL SMALL
.DATA
  CHAR DB " "
  MESSAGE1 DB 0AH,0DH,'****FIRST IS GREATER****','$'
  MESSAGE2 DB 0AH,0DH,'****SECOND IS GREATER****','$'
  MESSAGE3 DB 0AH,0DH,'****ALL ARE EQUAL****','$'

  INPUT_M DB 0AH,0DH,'ENTER CHARACTER',0DH,0AH,'$'
.CODE
  MAIN PROC
    MOV AX,@DATA
    MOV DS,AX

    MOV DX,OFFSET INPUT_M
    MOV AH,09
    INT 21H

    MOV AH,01
    INT 21H

    MOV CHAR,AL
    MOV DX,OFFSET INPUT_M

    MOV AH,09
    INT 21H

    MOV AH,01
    INT 21H

    CMP CHAR,AL
    JE  EQUAL
    JGE GREAT

    MOV DX,OFFSET MESSAGE2
    JMP PRINT
EQUAL:  MOV DX,OFFSET MESSAGE3
    JMP PRINT
    GREAT:  MOV DX,OFFSET MESSAGE1
PRINT:  MOV AH,09
        INT 21H
    MOV AH,4CH
    INT 21H
  MAIN ENDP
    END MAIN
  
Share: 



Ethan Evans
Ethan Evans author of Program to compare two characters and display message accordingly is from London, United Kingdom.
 
View All Articles

 

Other Interesting Articles in Assembly Language:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!