ADD, ADDB

 

ADD        fr,#literal        Add literal into fr


Words:        2        Cycles:        2                Affects:        W, C, DC, Z

 

Operation:        Literal is added into fr via W. C will be set if an overflow occurs; otherwise, C will be cleared. DC will be set or cleared depending on whether or not an overflow occurs in the lower nibble. Z will be set if the result is 0; otherwise, Z will be cleared. W is left holding the literal value.

 

Coding:        MOV  W,#lit   (MOVLW  lit)

       ADD  fr,W     (ADDWF  fr,1)

 

 

ADD        fr1,fr2                Add fr2 into fr1


Words:        2        Cycles:        2                Affects:        W, C, DC, Z

 

Operation:        Fr2 is added into fr1 via W. C will be set if an overflow occurs; otherwise, C will be cleared. DC will be set or cleared depending on whether or not an overflow occurs in the lower nibble. Z will be set if the result is 0; otherwise, Z will be cleared. W is left holding the contents of frb.

 

Coding:        MOV  W,fr2   (MOVF   fr2,0)

       ADD  fr1,W   (ADDWF  fr1,1)

 

 

ADD        fr,W                Add W into fr


Words:        1        Cycles:        1                Affects:        C, DC, Z

 

Operation:        W is added into fr. C will be set if an overflow occurs, otherwise C will be cleared. DC will be set or cleared depending on whether or not an overflow occurs in the lower nibble. Z will be set if the result is 0, otherwise Z will be cleared.

 

Coding:        ADDWF fr,1

 

 

ADD        W,fr                Add fr into W


Words:        1        Cycles:        1                Affects:        C, DC, Z

 

Operation:        Fr is added into W. C will be set if an overflow occurs, otherwise C will be cleared. DC will be set or cleared depending on whether or not an overflow occurs in the lower nibble. Z will be set if the result is 0, otherwise Z will be cleared.

 

Coding:        ADDWF fr,0

 

 

ADDB        fr,bit                Add bit into fr


Words:        2        Cycles:        2                Affects:        Z

 

Operation:        If bit is set, fr is incremented. If fr is incremented, Z will be set if the result is 0; otherwise, Z will be cleared. This instruction is useful for adding the carry into the upper byte of a double-byte sum after the lower byte has been computed.

 

Coding:        SNC  bit   (BTFSC  bit)

       INC  fr        (INCF   fr,1)