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

Support activities in supply chain management, What are the some support ac...

What are the some support activities in primary functions of Supply Chain Management? To support primary functions of Supply Chain Management there will be a company’s infrastr

What is the cih, CIH, also known  as Chernobyl or Spacefiller, is a Microso...

CIH, also known  as Chernobyl or Spacefiller, is a Microsoft Windows computer virus which first emerged in 1998. It is one of the most damaging viruses, overwriting critical inform

Explain conditions for the critical section problem solution, What are the ...

What are the properties which a data item should possess to implement a critical section? The Critical Section Problem Solution should satisfy the following conditions: 1.

How free-space is managed using bit vector implementation, How free-space i...

How free-space is managed using bit vector implementation? The free-space list is executed as a bit map or bit vector. Each block is shown by 1 bit. If the block is free, the b

Determine the purpose of GDTR, Elucidate the purpose of GDTR. If the microp...

Elucidate the purpose of GDTR. If the microprocessor sends linear address 00200000H to paging mechanism, which paging directory entry and which page table entry is accessed? GD

Define edge triggered d flip flop, Define Edge Triggered D flip-flop? D...

Define Edge Triggered D flip-flop? D latch has only two inputs C(control) and D(data). The operation of a D flip-flop is a lot simpler and it has only one input addition to the

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

Software architecture of microprocessor, The 68HC11 series is based on the ...

The 68HC11 series is based on the Motorola 6800/1 programming instruction set and hence is a fairly simple 8 bit microprocessor. The internal structure of the 6800/1 is shown below

Explain rmtrack, Highlights of the RMTrack application: ? Web based ac...

Highlights of the RMTrack application: ? Web based access permits your users to access the database from anywhere. ? Available as a hosted solution or a download for local in

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