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

Floating point arithmetic pipelines, Floating point Arithmetic pipelines ...

Floating point Arithmetic pipelines Floating point computations are the finest candidates for pipelining. Take the instance of addition of two floating point numbers. Following

How can you show only selected records with a form, How can you show only s...

How can you show only selected records with a form? There are dissimilar ways in which you can limit the records that you will see with a form, you can: Open a form and app

How to calculate the logic circuit outputs, How to Calculate the Logic Circ...

How to Calculate the Logic Circuit Outputs? Once the Boolean expression for a circuit output has been acquired, the output logic level can be determined for any set of input le

Basic logic gates, Basic logic gates Introduce the basic logic gates i...

Basic logic gates Introduce the basic logic gates in terms of a) their function, b) their circuit symbol, c) their truth table and d) their equivalent in Boolean a

Mode counter, desing mode level counter starting at 0011 using D flipflop

desing mode level counter starting at 0011 using D flipflop

What is npblox framework, Designed, developed, tested and documented the de...

Designed, developed, tested and documented the demo created for NPBlox framework. NPBlox framework is a framework which enabled developers to create CLI/WEB/SNMP interfaces for

Advantage of wrapping database calls into mts transactions, Advantage of wr...

Advantage of wrapping database calls into MTS transaction If database calls are complete within the context of a transaction, aborting the transaction will undo and changes that

Determine capacity in bytes of a certain memory, A certain memory has a cap...

A certain memory has a capacity of 4K × 8 (i)  How many data input and data output lines does it have? (ii) How many address lines does it have? (iii) What is its capacity in bytes

Define constraints, Define Constraints Constraints can be defined as P...

Define Constraints Constraints can be defined as Preconditions (input values) and Post Conditions (output values). Preconditions on functions are constraints which input value

Length property of array , DEscribe a console application to show all the a...

DEscribe a console application to show all the arguments passed tocommand line whereas running the application. The user can pass anynumber of arguments that should be shown. Use l

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