Code Explain Assembly code and possible translation to C Lan

Code: Explain Assembly code and possible translation to C Lang.

Explain Assembly code and possible translation to C Lang. INCLUDE \"P18F242.INC\" C3LOCK 0 times 000 i ENDC org 0 go to main org 0 times 200 main movf i, f bnz end if movf i, w addwf j, f end_if ... rest of code ... This code is in Assembly Language. Explain, which is the operation of this code...

Solution

movf i,f ---- assign value of i to i. And set Z flag if number is zero

bnz checks for branch not zero

movf i,w ---- assign value of i in w => w = i

addwf j,f ---- adds content of w with contents of j and stores in j. => j = j + w => j = j+i

if(i!=0) {

    j = j+i;

}

Code: Explain Assembly code and possible translation to C Lang. Explain Assembly code and possible translation to C Lang. INCLUDE \

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site