1: .globl jget,iget
2: .globl succ
3: .globl create,rewind,putchar,getchar,allocate
4: .globl smark
5: .globl rewcstr,putcstr,getcstr,size
6:
7: / currnet string manipulations
8: / keep a initial fragment handy for quick access
9: /go to allocator for the rest
10:
11: smark:
12: jsr pc,jget
13: clr cstrw
14: jmp succ
15:
16: rewcstr:
17: clr cstrr
18: rts pc
19:
20: putcstr:
21: mov cstrw,r1
22: inc cstrw
23: cmp r1,$cstrt /is it quick access?
24: bge 1f
25: movb r0,cstrb(r1) /yes, stash the char
26: rts pc
27: 1:
28: bne 1f
29: mov r0,-(sp) /first char to allocator
30: mov symp,r1
31: bne 2f
32: mov $64,r0
33: jsr pc,allocate
34: mov r1,symp
35: 2:
36: jsr pc,create
37: mov (sp)+,r0
38: 1:
39: mov symp,r1
40: jsr pc,putchar
41: rts pc
42:
43: getcstr:
44: mov cstrr,r1
45: cmp r1,cstrw
46: blt 1f
47: clr r0 /end of string
48: rts pc
49: 1:
50: inc cstrr
51: cmp r1,$cstrt
52: bge 1f
53: movb cstrb(r1),r0
54: rts pc
55: 1:
56: bne 1f
57: mov symp,r1
58: jsr pc,rewind
59: 1:
60: mov symp,r1
61: jsr pc,getchar
62: rts pc
63:
64: size:
65: jsr pc,iget
66: mov cstrw,(r0)
67: jmp succ
68:
69: cstrt = 16 /top of quick access current string
70: .data
71: symp: 0 /pointer to dynamicallly allocated current string
72: cstrw: 0 /current string write pointer
73: .bss
74: cstrr: .=.+2 /read pointer
75: cstrb: .=.+cstrt /base of quick access fragment
Defined functions
cstrt
defined in line
69; used 3 times
getcstr
declared in line
5; defined in line
43; used 7 times
putcstr
declared in line
5; defined in line
20; used 5 times
rewcstr
declared in line
5; defined in line
16; used 7 times
size
declared in line
5; defined in line
64; used 1 times
smark
declared in line
4; defined in line
11; used 10 times
Defined variables
cstrb
defined in line
75; used 2 times
cstrr
defined in line
74; used 3 times
cstrw
defined in line
72; used 5 times
symp
defined in line
71; used 5 times