# Assembly Language Question

#### Jack912

Joined May 12, 2013
3
Accumulator's content is 4AH, what will be the content of the flags (S,Z,AC,P and CY) after the addition of 59H? The instruction is ADI 59H .Could somebody explain on it ?quite confused on this part..

#### piratepaul

Joined May 20, 2013
35
No idea... I use batt's a lot...

4Ah = 4 amphours

ccA = cold cranking amps.

Don't know if it is lead/acid ... sealed, high maintinence, high/low discharge, nicad or, or, or.
Or I could tell you a bit more.

#### evilclem

Joined Dec 20, 2011
116
Hi Jack,

If you could tell us what chip you are writing this for, it would help.

#### Papabravo

Joined Feb 24, 2006
16,498
I vote for the 8085.

S is the "sign" flag, which is set according to the the sign of the result
Z is the "zero" flag which is set if the result of an operation is 0
AC is th Auxiliary Carry which is set if there is a carry from bit 3. Used in BCD arithmetic
P is the Parity bit and is set to the Parity of the result, but I forget which way it goes.
CY is the Carry flag and is set to the carry out of the mos significant bit.

So using Hexadecimal arithmetic you add 04AH to 059H and you get 0??H
Since the result is NOT 000H the Z flag will not be set it will be cleared.
Now you just figure out what happens to the rest.

#### Jack912

Joined May 12, 2013
3
s=1 as D7 is 1 ; z=0, AC=0 as D3 is 0 ; p=0 as even parity ;cy =0 as no carry .Are they correct ? Not sure whether S and AC are correct....

#### Papabravo

Joined Feb 24, 2006
16,498
I think AC should be a 1 since there is a carry from the low nibble to the high nibble.

00AH + 009H = 013H

That's a 3 with an Aux Carry of 1

D3 of the result is indeed 0, but it is not relevant to AC, It is the Carry from bit 3 of the addition.

#### Jack912

Joined May 12, 2013
3
What is nibble? For this case how is it there is a carry from the low nibble to the high nibble? Could u explain it further ..

#### t06afre

Joined May 11, 2009
5,934

#### Papabravo

Joined Feb 24, 2006
16,498
What is nibble? For this case how is it there is a carry from the low nibble to the high nibble? Could u explain it further ..
I thought I did explain it. The least significant digits are 00AH and 009H. When you add them together you get 013H which cannot fit in four bits so you say

"0AH plus 09H is 013H, bring down the 3 and carry the one." How do you do addition in your head? I always talk to myself when I do it.