home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 3 / 3137 / umulsi3.s < prev   
Encoding:
Text File  |  1991-03-27  |  913 b   |  40 lines

  1.     .text            | cjpurcell 30Jul89
  2.     .even            |
  3.     .globl __umulsi3    |
  4.     .globl ___umulsi3    |
  5. __umulsi3:            |
  6. ___umulsi3:            |
  7.     link a6,#0        | 0 bytes of local
  8.     movel d2,sp@-        | push d2
  9.     movel a6@(8),d2        | get a
  10.     beq umul_zero        | 0? return 0
  11.     movel a6@(12),d1    | get b
  12.     beq umul_zero        | 0? return 0
  13.                 |
  14.     mulu d1,d2        | mul bottom parts
  15.     movel d2,d0        | save that
  16.     movew a6@(8),d2        | get hi part of a
  17.     beq umul_1        | zero, skip it
  18.     movel a6@(12),d1    | get b
  19.     mulu d1,d2        | mul a hi by b lo
  20.     lsll #8,d2        | shift over
  21.     lsll #8,d2        |  ...twice...
  22.     addl d2,d0        | add that in
  23. umul_1:                |
  24.     clrl d1            |
  25.     movew a6@(12),d1    | get b hi
  26.     beq umul_ret        |
  27.     movel a6@(8),d2        | and a lo
  28.     mulu d1,d2        | mult those
  29.     lsll #8,d2        | shift it over
  30.     lsll #8,d2        |  ... twice...
  31.     addl d2,d0        | and add that in
  32.     bra umul_ret        | go home
  33. umul_zero:            |
  34.     clrl d0            | return 0
  35. umul_ret:            |
  36.     movel sp@+,d2        | get d2 back
  37.                 |
  38.     unlk a6            | flush frame
  39.     rts            |
  40.