Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

For the Status Register. What type of register is the status register? Explain t

ID: 3809678 • Letter: F

Question


For the Status Register. What type of register is the status register? Explain the function of each bit in the status Register. Also, explain with an example the Carry and Zero flags (show all possible cases). How do you remember setting the Carry flag for Addition & Subtraction? Write the following if statements in C, in Assembly language using: a) subtract/carrier-flag test and b) comparisons instructions. unsigned char i, j; if (j >= i) {j = j + i;} unsigned char i, j; if (j >= 0x25) {j = j - i;} About Decrement/Increment for counting loop, and Shift Left/Right and rotate instructions. a) Write the following statement in C, in Assembly language unsigned char i, j, k; j = 10; do {k = k + i; j = j + 1;} while (j = 18);//rest of code b) Perform the following operation in Assembly language i = i*27;

Explanation / Answer

Status register is a 8 bit register and it shows status of micro processor before and after operation

S

Z

X

AC

X

P

X

CY

S:sign flag is set when result of an operation is negative.

Z: Zero flag is set when result of an operation is o

AC:Auxilliary flag is set when there is a carry out of a lower nibble .         

CY:Cary flag is set when there is a carry generated by an operation .

P:Parity flag is set result contains even ones.

Example

Decimal                   binary

53                         00110101

+25                         00011001

+78                         01001110

Cf-0

Ovf-0

b)

if(j>=i)

{

j=j+i;

}             

Assembly language:

i: ds.b 1

j: ds.b 1

bge $j,$i,Label

add $j,$j,$i

if(j>=ox25)

{

j=j-i;

}             

Assembly language:

i: ds.b 1

j: ds.b 1

k dc.w $0X25

bge $j,$i,Label

sub $j,$j,$i

4)

i: ds.b 1

j: ds.b 1

k: ds.b 1

mov j,10

loop1   add $k,$k,$i

            add $j,$j,$i

            bne j,10

            je loop1   

S

Z

X

AC

X

P

X

CY