home *** CD-ROM | disk | FTP | other *** search
/ Crawly Crypt Collection 1 / crawlyvol1.bin / program / compiler / nasm20b / nasm_src / xhash.s < prev    next >
Text File  |  1993-01-19  |  2KB  |  56 lines

  1. ; ----------------------------------------------------------------------
  2. ;                   Copyright (C) 1990 by Natürlich!
  3. ;                      This file is copyrighted!
  4. ;                Refer to the documentation for details.
  5. ; ----------------------------------------------------------------------
  6.          .export  calc_hash
  7.          .import  hash_tab
  8.  
  9.  
  10. calc_hash:
  11.          move.l   a1,-(a7)
  12.          move.l   d1,-(a7)
  13.  
  14.          lea      hash_tab,a1
  15.          moveq    #0,d0          ; target register clean
  16.          clr.w    d1
  17.          move.b   (a0)+,d0       ; get first byte into it d0
  18.          beq.b    done           ; quit on 0
  19.          move.b   0(a1,d0.w),d0  ; get hash value for char
  20.  
  21.          move.b   (a0)+,d1       ; get next char
  22.          beq.b    done           ; EOL = 0 then ->
  23.          move.b   0(a1,d1.w),d1  ; get hash value
  24.          asl.w    #5,d0          ; shift old 5 bits up
  25.          or.w     d1,d0          ; and OR our new value
  26.  
  27.          move.b   (a0)+,d1       ; next
  28.          beq.b    done
  29.          move.b   0(a1,d1.w),d1
  30.          asl.w    #5,d0
  31.          or.w     d1,d0
  32.  
  33.          swap     d0             ; don't want to shift 32 bits
  34.  
  35.          move.b   (a0)+,d0       ; start with fresh 16 bits
  36.          beq.b    done
  37.          move.b   0(a1,d0.w),d0
  38.  
  39.          move.b   (a0)+,d1
  40.          beq.b    done
  41.          move.b   0(a1,d1.w),d1
  42.          asl.w    #5,d0
  43.          or.w     d1,d0
  44.  
  45.          move.b   (a0),d1
  46.          beq.b    done
  47.          move.b   0(a1,d1.w),d1
  48.          asl.w    #5,d0
  49.          or.w     d1,d0
  50.  
  51. done:    move.l   (a7)+,d1
  52.          move.l   (a7)+,a1
  53.          rts
  54.  
  55.  
  56.