Logical operations, PIC speak


if a=b call Equal to
    movf    A,W
    xorwf   B,W
    btfsc   STATUS,Z
    call    Equal_To

if a>b call greater_than
    movf    A,W
    subwf   B,W
    btfss   STATUS,C
    call    GREATER_THAN

if a<b call less_than
    movf    B,W
    subwf   A,W
    btfss   STATUS,C
    call    LESS_THAN

if a=>b call eq_or_gr
    movf    B,W
    subwf   A,W
    btfsc   STATUS,C
    call    EQ_OR_GR

if a=<b call eq_or_less
    movf    A,W
    subwf   B,W
    btfsc   STATUS,C
    call    EQ_OR_LESS

if a>b AND c>d then call _and_
    movf    A,W
    subwf   B,W
    btfsc   STATUS,C
    goto    $+5
    movf    C,W
    subwf   D,W
    btfss   STATUS,C
    call    _AND_

if a>b OR c>d then call _or_
    movf    A,W
    subwf   B,W
    btfss   STATUS,C
    goto    $+4
    movf    C,W
    subwf   D,W
    btfss   STATUS,C
    call    _OR_

Thanks to Andrew Warren for this.