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

  • Thread starter Thread starter kelvin56484984
  • Start date Start date
Click For Summary

Discussion Overview

The discussion revolves around determining the carry flag, overflow flag, and a "set flag" after executing a series of assembly-like instructions involving hexadecimal arithmetic. The context includes homework-related inquiries and technical explanations regarding flag settings in assembly language.

Discussion Character

  • Homework-related
  • Technical explanation
  • Conceptual clarification

Main Points Raised

  • One participant presents a step-by-step calculation to find the carry and overflow flags after performing arithmetic operations on hexadecimal values.
  • The same participant questions how to determine the "set flag" after their calculations.
  • Another participant points out that the meaning of "set flag" can vary depending on the programming language or processor architecture used.
  • A later reply clarifies that in the context of the 8086 assembly language, there is no "set flag," but there is a "sign flag" (SF) that may be relevant.

Areas of Agreement / Disagreement

Participants do not reach a consensus on the meaning of "set flag," with differing interpretations based on processor architecture and assembly language context. The discussion remains unresolved regarding the specific definition and implications of the "set flag."

Contextual Notes

The discussion highlights potential ambiguities in terminology related to flags in assembly language, particularly the absence of a "set flag" in the 8086 architecture and the need for clarity on definitions used in different contexts.

kelvin56484984
Messages
29
Reaction score
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
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"?
 
I am not sure about the meaning but I am using assembly language for 8086.
 

Similar threads

  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 5 ·
Replies
5
Views
4K