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

What are the components of loadrunner, The workings of LoadRunner are The V...

The workings of LoadRunner are The Virtual User Generator, Controller, and the Agent process, LoadRunner examines and Monitoring, LoadRunner Books Online. What Component of LoadRun

Decision trees, Decision Trees: Visualize you only ever do four things...

Decision Trees: Visualize you only ever do four things at the weekend such as go shopping or watch a movie or play tennis and just stay in. In such case what you do depends on

How aliases are used in DNS, How aliases are used in DNS? Explain. CNAM...

How aliases are used in DNS? Explain. CNAME entries are analogous to a symbolic link in a file system- the entry gives an alias for other DNS entry. Corporation of expertsmind

Convert the following from hexadecimal to binary, Q. Convert the following ...

Q. Convert the following from hexadecimal to binary, decimal, BCD and octal. a) 111 b) ABC.25 c) 2.C Q. Convert the following from BCD to binary, decimal, hexadecimal an

Explain busy hour calling rate in telephone traffic, With reference to tele...

With reference to telephone traffic, explain the terms BHCR. BHCR: Busy hour calling rate is explained as the average number of calls originated through a subscriber througho

CRTscreen as a two-dimensional matrix, Explain the statement- CRT screen as...

Explain the statement- CRT screen as a two-dimensional matrix One can imagine the CRT screen as a two-dimensional matrix which has m rows and n  columns and this is usually ref

What are the languages evolved in the html open standard, What are the lang...

What are the languages evolved in the html open standard Even the companies or developers themselves have been affected with such modifications to the open standards since they

What is the use of unions in c ?, Unions allow the same area of memory to b...

Unions allow the same area of memory to be accessed as different data types. The insurance example above would not work. Unions are useful (often in embedded programming) when i

What is the linkage section, The linkage section is part of a known as prog...

The linkage section is part of a known as program that 'links' or maps to data items in the calling program are working storage. It is the part of the called program where these sh

Logical difference among move a to b and compute b = a, What is the  logic...

What is the  logical difference among Move A TO B and COMPUTE B = A ? Ans) In case of Move A TO B it will move whatever the value of a in to b. It mean it will move nume

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