Find Carry, Overflow & Set Flags: A=68H -100, B=-12+A, C=B-33H, D=C+53H

  • Thread starter kelvin56484984
  • Start date
In summary: It is set when the result of an arithmetic operation is negative and it is reset when the result is positive or zero.In summary, in the given assembly language instructions, the carry flag is set to 1, indicating an overflow, while the sign flag is set to 1, indicating a negative result. There is no specific "set flag" in the 8086 processor, but the closest is the "SF"-flag which is set when the result is negative and reset when the result is positive or zero.
  • #1
kelvin56484984
29
0

Homework Statement


Find the carrry flag,overflow flag, set flag after these instructions
A=68H -100
B=-12+A
C=B-33H
D=C+53H

Homework Equations

The Attempt at a Solution


I change the value to binary
A
68H--------->1101000
100---------->1100100

1101000
- 1100100
0000100


B
12---------->1100
After 2s complement
-12---------->11110100

11110100
+ 00000100
11111000

C
33H---------->110011

11111000
- 00110011
11000101
D
53H---------->1010011

11000101
+ 01010011
101001000So the carry flag is 1 ,
then 68H=104, 33H=51, 53H=83
{[-12+(104-100)]-51}+83
=24
Since the sign bit is 1 ,it is overflow
the overflow flag is 1
But how to find Set flag?
 
Physics news on Phys.org
  • #2
kelvin56484984 said:
But how to find Set flag?
You must tell what is meant by "set flag".
It depends on which programming language is used and/or which processor is used.
E.g. as for an "ARM"-processor, the "set flag" is a flag included in an assembly instruction:

ADD D0,D1,D2 means: D0 = D1+D2 without any set/reset of carry, sign, etc. ( set flag = 0 in the instruction)
whereas
ADDS D0,D1,D2 means: D0 = D1+D2 with set/reset of carry, sign, etc. ( set flag = 1 in the instruction)

So, what is meant by "set flag"?
 
  • #3
I am not sure about the meaning but I am using assembly language for 8086.
 
  • #4

Related to Find Carry, Overflow & Set Flags: A=68H -100, B=-12+A, C=B-33H, D=C+53H

1. What is the value of A after the calculations?

The value of A after the calculations is 68H.

2. What is the value of B after the calculations?

The value of B after the calculations is 56H.

3. What is the value of C after the calculations?

The value of C after the calculations is 43H.

4. What is the value of D after the calculations?

The value of D after the calculations is 96H.

5. What are the carry, overflow, and set flags after the calculations?

The carry flag is set to 1, indicating a carry occurred during the addition of B and A. The overflow flag is set to 0, indicating no overflow occurred during the addition. The set flag is also set to 0, indicating that the result of D is not a negative number.

Similar threads

  • Precalculus Mathematics Homework Help
Replies
3
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
5
Views
3K
Back
Top