1: / return name of current tty
2:
3: .globl ttyn, _ttyn
4:
5: _ttyn:
6: mov r5,-(sp)
7: mov sp,r5
8: mov 4(r5),r0
9: jsr pc,1f
10: mov (sp)+,r5
11: rts pc
12:
13: ttyn:
14: clr r0
15: 1:
16: mov $'x,name
17: tst -(sp)
18: sys fstat; buf
19: bes er1
20: mov buf+2,(sp)
21: sys open; dev; 0
22: bes er1
23: mov r0,r1
24: 1:
25: mov r1,r0
26: sys read; buf; 16.
27: bes er
28: cmp r0,$16.
29: bne er
30: mov $buf,r0
31: cmp (r0)+,(sp)
32: bne 1b
33: cmp (r0)+,$"tt
34: bne 1b
35: cmpb (r0)+,$'y
36: bne 1b
37: tstb (r0)+
38: beq 1b
39: cmpb (r0),$'\0
40: bne 1b
41: movb -(r0),name
42:
43: er:
44: mov r1,r0
45: sys close
46:
47: er1:
48: tst (sp)+
49: movb name,r0
50: rts pc
51:
52: .data
53: dev: </dev\0>
54: .even
55: .bss
56: buf: .=.+40.
57: name: .=.+2
Defined functions
_ttyn
declared in line
3; defined in line
5; used 13 times
er
defined in line
43; used 2 times
er1
defined in line
47; used 2 times
ttyn
declared in line
3; defined in line
13; used 7 times
Defined variables
buf
defined in line
56; used 4 times
dev
defined in line
53; used 1 times
name
defined in line
57; used 3 times