home *** CD-ROM | disk | FTP | other *** search
/ The Best of Mecomp Multimedia 2 / MECOMP-CD-II.iso / amiga / tools / system / format64 / source / assembly / nsd_add.asm
Encoding:
Assembly Source File  |  1998-04-20  |  454 b   |  31 lines

  1.  
  2.     XDef    _nsd_add
  3.  
  4. ;------------------------------------------------------------------------------
  5. ; a0 = ptr to 64 bit buffer
  6. ; d0 = 32bit source (UNSIGNED)
  7. ; d1 = 32bit increment (UNSIGNED)
  8.  
  9. _nsd_add
  10.     movem.l    d0-d2/a0,-(sp)
  11.  
  12.     move.l    20(sp),a0
  13.     move.l    24(sp),d0
  14.     move.l    d0,d1
  15.     move.l    28(sp),d2
  16.  
  17.     add.l    d2,d0
  18.     cmp.l    d0,d1
  19.     bhi    overflow
  20.  
  21.     move.l    d0,4(a0)
  22.     movem.l    (sp)+,d0-d2/a0
  23.     rts
  24.  
  25. overflow
  26.     move.l    d0,4(a0)
  27.     add.l    #1,(a0)
  28.     movem.l    (sp)+,d0-d2/a0
  29.     rts
  30.  
  31.