1: / scan
2: / r1 = pointer to input header
3: / r0 = pointer to output header
4: / switch = 0 real output
5: / not 0 output to r0
6: scan:
7: mov r0,-(sp)
8: mov r1,-(sp)
9:
10: 1:
11: mov (sp),r1
12: jsr pc,getchar
13: bes 5f
14: cmpb r0,$'\\
15: beq 3f
16: cmpb r0,$'\[
17: beq 4f
18: cmpb r0,$'\{
19: beq 4f
20: cmpb r0,$'\]
21: beq 1f
22: cmpb r0,$'\}
23: beq 7f
24: cmpb r0,$'\n
25: bne 6f
26: jsr pc,lookchar
27: bes 5f
28: movb $'\n,r0
29: 6:
30: tst switch
31: beq 2f
32: mov 2(sp),r1
33: jsr pc,putchar
34: br 1b
35: 2:
36: jsr r5,putc
37: br 1b
38: 3:
39: jsr pc,getchar
40: br 6b
41: / have [ or {
42: 4:
43: mov r(r1),-(sp)
44: jsr pc,getchar
45: bes 1f
46: cmpb r0,$'0
47: blt 4f
48: cmpb r0,$'9
49: bgt 4f
50: jsr pc,getchar
51: cmpb r0,$'\]
52: beq 3f
53: cmpb r0,$'\}
54: beq 3f
55:
56: 4:
57: mov (sp)+,r(r1)
58: mov 2(sp),r0
59: jsr pc,esub
60: mov r1,(sp)
61: mov r0,2(sp)
62: br 1b
63:
64: / have arg
65: 3:
66: tst switch
67: beq 2f
68: mov opointer,r1
69: mov 4(sp),r0
70: jsr pc,putword
71: mov 2(sp),r1
72: 2:
73: mov (sp)+,r(r1)
74: jsr pc,getchar
75: inc r(r1) /skip ]
76: jsr pc,earg
77: br 1b
78:
79: 5:
80: tst argf
81: bne 1f
82: mov ipointer,r1
83: jsr pc,pop
84: bes 1f
85: mov r0,(sp)
86: br 1b
87: 7:
88: inc curlyf
89: 1:
90: mov (sp)+,r1
91: mov (sp)+,r0
92: rts pc
Defined functions
scan
defined in line
6;
never used