; ---------------------------------------------------------------------- ; Copyright (C) 1990 by Natrlich! ; This file is copyrighted! ; Refer to the documentation for details. ; ---------------------------------------------------------------------- .export calc_hash .import hash_tab calc_hash: move.l a1,-(a7) move.l d1,-(a7) lea hash_tab,a1 moveq #0,d0 ; target register clean clr.w d1 move.b (a0)+,d0 ; get first byte into it d0 beq.b done ; quit on 0 move.b 0(a1,d0.w),d0 ; get hash value for char move.b (a0)+,d1 ; get next char beq.b done ; EOL = 0 then -> move.b 0(a1,d1.w),d1 ; get hash value asl.w #5,d0 ; shift old 5 bits up or.w d1,d0 ; and OR our new value move.b (a0)+,d1 ; next beq.b done move.b 0(a1,d1.w),d1 asl.w #5,d0 or.w d1,d0 swap d0 ; don't want to shift 32 bits move.b (a0)+,d0 ; start with fresh 16 bits beq.b done move.b 0(a1,d0.w),d0 move.b (a0)+,d1 beq.b done move.b 0(a1,d1.w),d1 asl.w #5,d0 or.w d1,d0 move.b (a0),d1 beq.b done move.b 0(a1,d1.w),d1 asl.w #5,d0 or.w d1,d0 done: move.l (a7)+,d1 move.l (a7)+,a1 rts