home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_disks / 200-299 / ff269.lzh / PropGadget / div020.asm < prev    next >
Assembly Source File  |  1989-11-06  |  1KB  |  40 lines

  1. ;  There is not a man that lives, who hath not known his god-like hours.
  2. ;                                                              Wordsworth
  3. ;           Jerry J. Trantow
  4. ;           1560 A East Irving Place
  5. ;           Milwaukee, Wi 53202-1460
  6. ; written especially for Gadget calculation where result is always 32 bits
  7. ; 12 Jan 89 Now does a 64/32 with a 64 bit result
  8. ; 12 Jan 89 64 bit Quotient gets returned in the Dividend
  9. ; 14 Jan 89 passes divisor by value
  10. ; 15 Jan 89 Used Andi, ori to set X Flag
  11. ; 24 Jan 89 Division by 2^31 or larger doesn't seem to work
  12. ;  1 Feb 89 Implemented a 64/32 = 32 bit Quotient Division
  13. ;           NOTE : ONLY USE THE LOWER ULONG i.e. ONLY A 32 bit Quotient
  14.     IFD LATTICE
  15.      CSECT text
  16.      XDEF _QuadDiv020
  17.     ELSE
  18.          machine MC68020
  19.          public    _QuadDiv020
  20.     ENDC
  21.  
  22. _QuadDiv020:
  23.         link    a5,#0
  24.         movem.l    d2/d3/d5,-(sp)    ; push registers on the stack
  25.  
  26.         move.l    8(a5),a0    ; Points to Dividend  (64 bits)
  27.         move.l  (a0),d0        ; High ULONG of Quad
  28.         move.l  4(a0),d1    ; Low ULONG of Quad
  29.  
  30.         divu.l    12(a5),d0:d1    
  31. ;       move.l  d0,(a0)        ; put Remainder in High ULONG of QUAD
  32.         move.l  d1,4(a0)    ; puts Quotient in Low ULONG of QUAD
  33.  
  34.         movem.l    (sp)+,d2/d3/d5
  35.         unlk    a5
  36.         rts
  37.         end
  38.  
  39.