Compares a pair of characters entered by keyboard, Computer Engineering

Assignment Help:

Program: This program compares a pair of characters entered by keyboard.

; Registers used: AX, BX, CX, DX

DATA SEGMENT

                         XX DB?

                        YY DB?

DATA ENDS

CODE SEGMENT

                        ASSUME     CS:  CODE,   DS: DATA

MAINP:                       MOV AX, DATA; initialize data

                                    MOV DS, AX; segment using AX

                                    MOV CX, 03H; set counter to 3.

NEXTP:                      MOV AH, 01H; Waiting for user to enter a char.

                        INT    21H        

                                    MOV XX, AL; store the 1st input character in XX

                                    MOV AH, 01H; waiting for user to enter second 

                                    INT     21H   ;   character.

                                    MOV YY, AL; store the character to YY

                                    MOV BH, XX; load first character in BH

                                    MOV BL, YY; load second character in BL

                                    CMP BH, BL; compare the characters

                                    JNE NOT_EQUAL; 

EQUAL:                     MOV AH, 02H; if characters are equal then control 

                                    MOV DL, 'Y'    ; will execute this block and

                                    INT    21H   ; display 'Y'

                                    JMP CONTINUE; Jump to continue loop.

NOT_EQUAL:           MOV AH, 02H; if characters are not equal then

Control

                                    MOV DL, 'N''   ; will execute this block and

                                    INT 21 H    ; display 'N'

CONTINUE:              LOOP NEXT P   ; Get the next character

                                    MOV AH, 4C H; Exit to DOS

                                    INT 21 H

CODE ENDS

END MAINP


Related Discussions:- Compares a pair of characters entered by keyboard

What is the gray equivalent of decimal number 25, What is the Gray equivale...

What is the Gray equivalent of  (25) 10 Ans. Gray equivalent of (25) 10 : The Decimal number 25 has binary equivalent as (00100101) 2 The left most bits (MSB) into gray

Define the advantages of assembly language., Highlight the advantages of as...

Highlight the advantages of assembly language. The benefits of assembly language program would be Reduced errors Faster translation times Changes could be made fas

State the term- $display and $write, State the term- $display and $write ...

State the term- $display and $write $display and $write two are the same except which $display always prints a newline character at the end of its execution.

Mobile cameras, Mobile cameras are characteristically low-resolution Digita...

Mobile cameras are characteristically low-resolution Digital cameras integrated in mobile set. Photographs are characteristically only good enough to show on low resolution mobile

What is icon, An icon is a picture used to show an object. Some example obj...

An icon is a picture used to show an object. Some example objects are: data files, program files, folders, email messages, and drives. Every type of object has a dissimilar icon. T

Operating-systems/Linux, sir, please give me an source code program for Hie...

sir, please give me an source code program for Hierarchial-Directory-system using any Unix/Linux

Define various types of shift registers, What are various types of Shi...

What are various types of Shift Registers ? Ans: Kinds of Shift Registers: (i) SISO that is Serial-In Serial-Out Shift Register (ii) SIPO that is Serial-In P

What are the advantages of using xml over html, What are the advantages of ...

What are the advantages of using XML over HTML? The root cause of the problem lies within HTML that is Hyper Text Markup Language, the defector standard for web publication. Th

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd