home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume5 / smallc / part3 / 6809 / mrabs.u < prev    next >
Encoding:
Text File  |  1986-11-30  |  422 b   |  27 lines

  1. |    mrabs.  converts both args to unsigned, and
  2. |    remembers result sign as the sign of the left
  3. |    argument.  (for signed modulo)
  4. |    result d contains right, sign is non-zero
  5. |    if result (from mod) should be negative.
  6. |
  7. |
  8. .globl mrabs
  9.     left=8.
  10.     right=4.
  11.     sign=3.
  12. mrabs:    clr    sign(s)
  13.     ldd    left(s)
  14.     bge    tryr
  15.     nega
  16.     negb
  17.     sbca    #0
  18.     std    left(s)
  19.     inc    sign(s)
  20. tryr:    ldd    right(s)
  21.     bge    done
  22.     nega
  23.     negb
  24.     sbca    #0
  25.     std    right(s)
  26. done:    rts
  27.