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

2.) Specify the expected result in the W register after the execution of the fol

ID: 2080710 • Letter: 2

Question

2.) Specify the expected result in the W register after the execution of the following instructions and specify the flags that are set after the addition.

MOVLW

0x89

ADDLW

0x77

MOVLW

0x89

ADDLW

0x77

Explanation / Answer

MOVLW k simply moves the constant k into the W register. Thus, MOVLW 0x89 moves the literal 0x89 into the W register. Therefore, the value in W register after the execution of this instruction is 0x89. ADDLW 0x77 adds 0x77 with the contents of W register and stores the result in W register. That is, W+0x77->W. After MOVLW 0x89, W=0x89H=10001001B. After ADDLW 0x77, W=W+0x77=10001001+01110111= 100000000=0x00H with 1 being carry. The flags being affected are Carry flag, DC and Zero flag. Since carry=1, C=1. Since after lower nibble addition, an auxiliary carry =1 is produced, DC=1 and since result in W=0x00H or is 0, zero flag or Z=1.