Advertisement
Looong

a > b

Mar 13th, 2016
2,555
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MPASM 0.65 KB | None | 0 0
  1.         list    p=PIC18f8722
  2.         #include p18f8722.inc
  3. ; Begin
  4.         code    0
  5.         goto    initialize
  6.        
  7.         udata
  8. a       res .1
  9. b       res .1
  10. c       res .1
  11. ; Start
  12.         PRG code
  13. initialize
  14. ; Set a and b here
  15. main
  16.         comf    b, W ; c = a - b
  17.         addlw   .1
  18.         addwf   a, W
  19.         movwf   c
  20.         tstfsz  c ; c == 0
  21.         bra     not_equal
  22.         movlw   .0
  23.         movwf   a
  24.         movwf   b
  25.         bra     exit
  26. not_equal
  27.         btfsc   c, 7
  28.         bra     a_gt_b
  29.         comf    c, W
  30.         addlw   .1
  31.         movwf   b
  32.         bra     exit
  33. a_gt_b
  34.         movwf   a
  35. exit
  36.         end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement