1: / hash routine for diff
2: / effectively spreads the string out into 7-bit
3: / bytes, then sums the result 1's-complement
4: / by 16-bit bytes and adds 1 to avoid zero answer
5:
6: / r4 hash accumulator
7: / r3 current offset
8: / r2 first time flag
9: .globl _readhash
10: .globl getc
11:
12: .data
13: _readhash:
14: mov 2(sp),0f
15: mov r5,-(sp)
16: mov r4,-(sp)
17: mov r3,-(sp)
18: mov r2,-(sp)
19: mov $1,r4
20: mov r4,r2
21: clr r3
22: 1:
23: jsr r5,getc; 0: 0
24: bes 2f
25: clr r2
26: cmp r0,$'\n
27: beq 1f
28: ashc $-16.,r0
29: ashc r3,r0
30: add r0,r4
31: adc r4
32: add r1,r4
33: adc r4
34: add $7,r3
35: cmp r3,$16.
36: blt 1b
37: sub $16.,r3
38: br 1b
39: 2:
40: tst r2
41: bne 2f
42: mov $2,r0
43: sys write; 3f; 4f-3f
44: 2:
45: clr r4
46: 1:
47: mov r4,r0
48: mov (sp)+,r2
49: mov (sp)+,r3
50: mov (sp)+,r4
51: mov (sp)+,r5
52: rts pc
53: 3:
54: <incomplete line omitted\n>
55: 4:
56: .even
Defined variables
_readhash
declared in line
9; defined in line
13; used 2 times