Step 2 of 5
Add and subtract with ADDWF / SUBWF
Goal
Add PORTB + PORTD and display on LATC.
MOVF PORTB, W loads operand A. ADDWF PORTD, W adds B (to W) or ADDWF PORTD, F adds in place. For subtract: SUBWF (watch minuend order).
MOVF PORTB, W
ADDWF PORTD, W
MOVWF LATC
Try it
Implement A - B and turn on RB0 if the result is negative (borrow).