How are comparisons done in 8086 assembly language, Computer Engineering

Assignment Help:

Q. How are comparisons done in 8086 assembly language?

There is a compare instruction CMP. Though this instruction just sets the flags on comparing two operands (both 16 bits and 8 bits). Compare instruction just subtracts value of source from destination without storing result however setting the flag at the time of the process. Normally only 3 comparisons are more important. These are:

Result of comparison    Flag(s) affected

Destination < source    Carry flag = 1

Destination = source    Zero flag = 1

Destination > source    Carry = 0, Zero = 0

Let us look at 3 illustration which show how flags are set when numbers are compared. In illustration 1 BL is less than 10 so carry flag is set. In illustration 2 the zero flag is set since both operands are equal. In illustration 3 the destination (BX) is greater than source so both zero and carry flags are clear.

Example 1: 

 MOV BL, 02h 

 CMP BL, 10h; Carry flag = 1

Example 2:

 MOV AX, F0F0h

 MOV DX, F0F0h

 CMP AX, DX; Zero flag = 1

Example 3:

MOV BX, 200H

CMP BX, 0; Zero and Carry flags = 0


Related Discussions:- How are comparisons done in 8086 assembly language

Explain throughput performance and issues in pipelining, Throughput Thr...

Throughput Throughput of a pipeline may be defined as number of results which have been achieved per unit time. It can be referred as: T = n / [m + (n-1)]. c = E / c Th

What is framework, What is framework? Framework is a skeletal structure...

What is framework? Framework is a skeletal structure of a program that must be elaborated to build a complete application. It has abstract classes.

Define memory management system, Define memory management system? The p...

Define memory management system? The part of the computer system that supervises the flow of information among auxiliary memory and main memory is known as memory management sy

What is layer, What is layer? A layered system is ordered set of virtua...

What is layer? A layered system is ordered set of virtual worlds. Every build-in terms of one's below it and providing the execution basis for one above it. The objects in ever

Explain about microprocessors, Q. Explain about Microprocessors? Microp...

Q. Explain about Microprocessors? Microprocessors have instruction sets ranging from 20 to several hundred instructions, known as microprograms, which are stored in ROM to init

What is race-around problem and how can you rectify this, What is Race-arou...

What is Race-around problem? How can you rectify this? The clock pulse which remains into the 1 state whereas both J and K are equal to 1 will reason the output to complement a

Explain folded network, Explain Folded network. Folded network: While...

Explain Folded network. Folded network: While all the inlets/outlets are connected to the subscriber lines, the logical connection shows as demonstrated in figure. When, the

Define dma controller, Define DMA controller. The I/O device interface ...

Define DMA controller. The I/O device interface control circuit that is used for direct memory access is called as DMA controller.

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