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

How is recursion handled internally, How is recursion handled internally? ...

How is recursion handled internally? Internally, every recursive call to a function requires storing the intermediate values of the parameters and local variables in a run time

Explain about interrupt procedure, Q. Explain about Interrupt Procedure? ...

Q. Explain about Interrupt Procedure? The interrupt procedure uses request header to conclude the function requested by DOS. It also performs all functions for device driver. T

NETWORK ADMIN, Discuss the risks of having a single root user and how more ...

Discuss the risks of having a single root user and how more limited management abilities can be given to others users on Linux/UNIX systems.uestion #Minimum 100 words accepted#

Describe the object modeling notations, OBJECT MODELING NOTATIONS: BASIC ...

OBJECT MODELING NOTATIONS: BASIC Concepts A system is the collection of subsystems which organised to accomplish a purpose and described by a set of models from variou

Distinguish between e-mode and depletion mode mosfet, Distinguish between e...

Distinguish between enhancement mode and depletion mode metal oxide semiconductor field effect transistors giving their characteristics. Ans. Enhancement mode and depleti

What are the data types of vhdl, What are the Data types of VHDL VHDL....

What are the Data types of VHDL VHDL. A multitude of language or user defined data types can be used. This may mean dedicated conversion functions are needed to convert object

Importance of spectrum to the mobile sector, (a) The statement "Standards ...

(a) The statement "Standards create markets or markets create standards" has been the subject of considerable debate. Discuss the advantages and disadvantages to having multiple

Explain the concept of concurrent and parallel execution, The Concept of Co...

The Concept of Concurrent and Parallel Execution Real world systems are concurrent in nature and computer science is about modeling the real world. Illustrations of real world

Define the term- analysis, Define the term- Analysis The analysis invol...

Define the term- Analysis The analysis involves some or all of the following stages: Fact finding - this is usually done in four ways. Understanding the current syst

Properties of electronic cash, Properties : 1.  Monetary Value: Monetar...

Properties : 1.  Monetary Value: Monetary value must be backed by also cash, bank - authorized credit cards or bank certified cashier's cheque. 2.  Interoperability: E-cash

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