1: / call getarg(n, array [, nword] )
2: /
3: / fill in the array with the n-th argument to the routine.
4: / array is integer.
5: / n counts from 1 for the file name (first) arg
6: / if nword is specifies it gives the max number
7: / of words to fill in
8: / If no nword is given the array ends with at least one blank.
9: / if nword is given the array is blank-padded to that length.
10:
11: / iargc(dummy) returns the number of arguments
12: / (1-origin)
13:
14: .globl getarg., iargc.
15: .globl retrn, temp
16: .comm argp,2
17:
18: getarg.:
19: temp
20: .+2
21: mov $512.,r2
22: cmp *2(sp),$3
23: blt 1f
24: mov 6(r3),r2
25: mov 2(r2),r2
26: asl r2
27: asl r2
28: 1:
29: mov 4(r3),r4
30: mov 2(r3),r1
31: mov 2(r1),r1
32: mov argp,r0
33: cmp r1,(r0)
34: bgt 1f
35: asl r1
36: add r0,r1
37: mov (r1),r1
38: 2:
39: tst r2
40: ble 1f
41: movb (r1)+,(r4)+
42: beq 2f
43: dec r2
44: br 2b
45: 2:
46: dec r4
47: 1:
48: movb $' ,(r4)+
49: dec r2
50: bit $3,r2
51: bne 1b
52: cmp r2,$256.
53: bge 1f
54: tst r2
55: bgt 1b
56: 1:
57: jmp retrn
58:
59: iargc.:
60: temp
61: .+2
62: clr temp
63: mov *argp,temp+2
64: jmp retrn
Defined functions
getarg.
declared in line
14; defined in line
18; used 1 times
iargc.
declared in line
14; defined in line
59; used 1 times
Defined variables
argp
defined in line
16; used 4 times