Find the value of the C flag after the execution of the foll
Solution
Activity 2:
LD1 are simply the load instructions which will load the registers with values, so for example
LD1 R20, $85 means the value of register named R20 is 85 , less formally R20 =85
Here we are performing hexadecimal addition where the digits are from 0 to 15 and the digits from 10-15 are represented as A-F, the addition of hexadecimal can be understood with the following simple example:
1 1
A D D
+ D A D
______________
8 8 A
The first step is D + D which means 13 + 13 =26
to find the sum and carry we use 26 = 1 x 16 + 10(A)
so the answer to D+D = A with C=1
Here we get the final carry as C=1 as A+D+1 = 8 with carry =1
So the final carry is 1 in this case, similarly, we will get the following results:
a) 17 with C=1
b) 87 with C=0
c) 47 with C=1
d) INC means to add the value by 1, so we have to add 1 in R25 twice means FE+1 and again add 1 to it.
FE+1= FF with C=0
and FF +1 = 00 with C=1
