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

Write codes for following operations. (a) add the values of file register 20h an

ID: 3907483 • Letter: W

Question

Write codes for following operations. (a) add the values of file register 20h and 25h. Store the result in file register 45h. (b) add the value 50h with the content of file register 83h. Move the result to file register 75h. (c) add the values 30h and 40h. Move the result to file register 60h (d) subtract the value 50h from 6Fh (e) Subtract the content of file register 2Ah from value 40h Store the result in W register (f) Add the value 42h with the content of file register 72h. Store the result in W register. (g) Subtract the value 25h from the from file register 50h. Store the result in file register 1Eh.

Explanation / Answer

a) MOVLW 0h // Moves 0 to the working register (W)

ADDWF 20h, 0 // Adds 20h register file with W and stores back to W

ADDWF 25h, 0 // Adds 25h register file with W and stores back to W => W = 20h + 25h

MOVWF 45h // Moves the content of W to file register 45h

b) MOVLW 50h // Moves 50h to the working register (W)

ADDWF 83h, 0 // Adds 83h register file with W and stores back to W

MOVWF 75h // Moves the content of W to file register 75h

c) MOVLW 30h // Moves 50h to the working register (W)

ADDLW 40h // Adds 40h with W and stores back to W

MOVWF 60h // Moves the content of W to file register 60h

d) MOVLW 50h // Moves 50h to the working register (W)

SUBLW 6Fh // Subtracts W from 6Fh and stores in W

e) MOVLW 40h // Moves 40h to the working register (W)

SUBWF 2AH, 0  // Subtracts W from 2Ah register file and stores in W

f) MOVLW 42h // Moves 42h to the working register (W)

ADDWF 72h, 0  // Adds 72h register file with W and stores in W

g) MOVLW 25h // Moves 25h to the working register (W)

SUBWF 50h, 0 // Subtracts W from 50h register file and stores in W

MOVWF 1Eh // Moves the content of W to 1Eh register file.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote