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

Describe one graphics and image editing tool, Question : Multimedia inv...

Question : Multimedia involves multiple modalities of text, audio, images, drawings, animation, and video (a) Describe three popular file formats for images (b) Most imag

What do you mean by system calls, What do you mean by system calls? Sys...

What do you mean by system calls? System calls give the interface among a process and the operating system. When a system call is executed, it is treated as by the hardware as

Advanced microprocessor, Write a program to mask bits D3D2D1D0 and to set ...

Write a program to mask bits D3D2D1D0 and to set bits D5D4 and to invert bits D7D6 of the AX register.

What is a accepting computation history, What is a accepting computation hi...

What is a accepting computation history?  An accepting computation history is explained as , Let M be a Turing machine and w be a input string,  for M on w is a sequence of con

Advantages & disadvantages of wired-and connection TTL gates, What are adva...

What are advantages and disadvantages of TTL gates design with Wired-AND connection ? Ans. Advantages and disadvantages In this IC added logic is performed with

Show packing and unpacking data, Q. Show Packing and Unpacking Data? P...

Q. Show Packing and Unpacking Data? Packing and Unpacking Data  pvm_packs - Pack active message buffer with arrays of prescribed data type: int info = pvm_pac

What is program-controlled i/o, What is program-controlled I/O? In prog...

What is program-controlled I/O? In program controlled I/O the processor repeatedly checks a status flags to achieve the needed synchronization among the processor and an input

Multi-threaded processors, The use of distributed shared memory in parallel...

The use of distributed shared memory in parallel computer architecture however the use of distributed shared memory has the problem of accessing the remote memory that results in l

What are kinds of processors, Processors can broadly be seperated into the ...

Processors can broadly be seperated into the categories of: CISC, RISC, hybrid, and special purpose.

Explain the outsourcing barriers that an organization faces, Explain the ou...

Explain the outsourcing barriers that an organization faces. 1. Critical operations that cannot be outsourced. 2. Negative customer reaction. 3. Employee resistance. 4

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