I can’t understand How the W register is incremented every time with the value 22H since the content of 12H register is 0 and every time we add it with 0 and stores the result back in the w register it becomes 0+22H = 22H. I think the result will be a fixed value i.e 22H
in line 4 ADDWF 12H, W: This instruction adds the value in register 12H (which is 0) to the value in the W register (which is 22H) and stores the result back in the W register. The W register now contains 22H.
in line 5 ADDWF 12H, W: This instruction again adds the value in register 12H (still 0) to the value in the W register (which is 22H) and stores the result back in the W register. The W register now contains 22H.
I wrote here what I understood,
MOVLW 0: This instruction loads the literal value 0 into the W register.
MOVWF 12H: This instruction moves the value in the W register (which is now 0) into register 12H.
MOVLW 22H: This instruction loads the literal value 22H into the W register.
ADDWF 12H, W: This instruction adds the value in register 12H (which is 0) to the value in the W register (which is 22H) and stores the result back in the W register. The W register now contains 22H.
ADDWF 12H, W: This instruction again adds the value in register 12H (still 0) to the value in the W register (which is 22H) and stores the result back in the W register. The W register now contains 22H.
W = (W=22H +0) = 22H
ADDWF 12H, W: This instruction repeats the addition, resulting in the W register having 22H.
W = (W= 22 H +0) = 22H
ADDWF 12H, W: The final addition takes place, and the W register now holds 22H.
Score: Khatus Wins, Whoever wrote that loses their job!
I think they swapped lines 1 and 3. They intended to demonstrate putting 22H into address 12H, clearing W then adding the contents of address 12H four times.
In addition, file register 12H is used for other purposes on most PICs so it shouldn't be used as variable storage.