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 rational administrator, Use the Rational Administrator to: * M...

Use the Rational Administrator to: * Make and manage projects. * Make a project under configuration management. * Make a project outside of configuration management.

Forward chaining, Forward Chaining: Now we have suppose we have a set ...

Forward Chaining: Now we have suppose we have a set of axioms that we know are true statements about the world. Whether we set these to each be an initial state of the segoal

Hardware implementation for signed-magnitude data, Hardware Implementation ...

Hardware Implementation for signed-magnitude data When multiplication  is  implemented  in  digital  computer,  we  change  process lightly. Here, in place of providing registe

Floating-point processing and instruction encoding, write a program that e...

write a program that evaluate the following arithmetic expression: ((A+B) /C) * ((D-A)+E) assign test value to the variable and display the resulting value.

Prepare a decision tree, A part of an aircraft engine can be given a test b...

A part of an aircraft engine can be given a test before installation.  The test has a 75% chance of revealing a defect if it is present, and the same chance of passing a sound part

Cemistry, Discuss scales and sludge

Discuss scales and sludge

Illustrate about packet switching, Q. Illustrate about Packet switching? ...

Q. Illustrate about Packet switching? Packet switching is used to avoid long delays in transmitting data over the network. Packet switching is a technique that limits the amoun

Slope deflection equations, Slope Deflection Equations for a Member: I...

Slope Deflection Equations for a Member: In this section, we will develop a few general equations needed for further discussion in the moment distribution context. Fig

Illustration of disk formatting, Q. Illustration of disk formatting? An...

Q. Illustration of disk formatting? An illustration of disk formatting is displayed in Figure below. In this case every track comprises 30 fixed-length sectors of 600 bytes eac

What are the different database integrities, What are the different databas...

What are the different database integrities? Semantic Integrity. Relational Integrity. Primary Key Integrity. Value Set Integrity. Foreign Key integrity and

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