home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / C / OTL-MC6.DMS / in.adf / libsrc.lha / LIBSRC / mem_cmp.asm < prev    next >
Encoding:
Assembly Source File  |  1994-04-15  |  623 b   |  45 lines

  1.  
  2. *    Maxon C++
  3. *    Library-Modul "mem_cmp"
  4. *    Jens Gelhar 11.09.91, 15.04.94
  5. *    (Oh Fuck, ist das mal wieder langweilig!)
  6.  
  7.     xdef    _memcmp,memcmp__PCvPCvUi
  8.     xdef    _memchr,memchr__PCviUi
  9.  
  10. _memcmp:
  11. memcmp__PCvPCvUi:
  12.     movem.l    4(a7),a0/a1
  13.     move.l    12(a7),d1
  14.     beq.b    equal
  15. loop    move.b    (a0)+,d0
  16.     cmp.b    (a1)+,d0
  17.     bne.b    noneq
  18.     subq.l    #1,d1
  19.     bne.b    loop
  20. equal    moveq    #0,d0
  21.     rts
  22. noneq    bhi.b great
  23.     moveq #-1,d0
  24.     rts
  25. great    moveq #1,d0
  26.     rts
  27.  
  28. _memchr:
  29. memchr__PCviUi:
  30.     move.l    4(a7),a0
  31.     movem.l    8(a7),d0/d1
  32.     tst.l    d1
  33.     beq.b    nix
  34. such    cmp.b    (a0)+,d0
  35.     beq.b    find
  36.     subq.l    #1,d1
  37.     bne.b    such
  38. nix    moveq    #0,d0
  39.     rts
  40. find    move.l a0,d0
  41.     subq.l #1,d0
  42.     rts
  43.  
  44.     end
  45.