source: buchla-68k/alcyon/fgets.s@ cc2c9e0

Last change on this file since cc2c9e0 was 7bf3856, checked in by Thomas Lopatic <thomas@…>, 7 years ago

Added Alcyon C reference output.

  • Property mode set to 100644
File size: 1.8 KB
Line 
1.globl _Cbuffs
2.globl _Stdbufs
3.globl _Stdbuf
4.globl _agetc
5.text
6_agetc:
7~~agetc:
8~ptr=R13
9link R14,#0
10movem.l R6-R7/R13-R13,-(sp)
11~c=R7
12*line 19
13move.l 8(R14),R13
14L2:
15*line 20
16*line 20
17move.l R13,(sp)
18jsr _getc
19move R0,R7
20cmp #-1,R7
21beq L3
22*line 21
23*line 22
24and #127,R7
25move R7,R0
26bra L5
27*line 23
28L6:
29*line 24
30*line 25
31sub.l #1,(R13)
32*line 26
33move #-1,R0
34bra L1
35*line 27
36L7:
37*line 28
38L8:
39*line 29
40bra L2
41*line 30
42bra L4
43L5:tst R0
44beq L8
45cmp #10,R0
46beq L7
47cmp #26,R0
48beq L6
49bra L4
50L4:
51*line 31
52*line 32
53*line 33
54L3:
55*line 34
56move R7,R0
57bra L1
58L1:tst.l (sp)+
59movem.l (sp)+,R7-R7/R13-R13
60unlk R14
61rts
62.globl _gets
63.text
64_gets:
65~~gets:
66~line=8
67link R14,#0
68movem.l R6-R7/R13-R13,-(sp)
69~cp=R13
70~i=R7
71*line 44
72move.l 8(R14),R13
73*line 46
74bra L12
75L11:
76*line 47
77move.b R7,(R13)+
78L12:
79*line 47
80move.l #_Cbuffs,(sp)
81jsr _getc
82move R0,R7
83cmp #-1,R7
84beq L10000
85cmp #10,R7
86bne L11
87L10000:L10:
88*line 49
89clr.b (R13)
90*line 51
91*line 52
92cmp #-1,R7
93bne L13
94cmp.l 8(R14),R13
95bne L13
96*line 52
97clr.l R0
98bra L9
99*line 53
100L13:
101*line 54
102move.l 8(R14),R0
103bra L9
104L9:tst.l (sp)+
105movem.l (sp)+,R7-R7/R13-R13
106unlk R14
107rts
108.globl _fgets
109.text
110_fgets:
111~~fgets:
112~s=8
113~n=12
114~fp=14
115link R14,#0
116movem.l R6-R7/R13-R13,-(sp)
117~c=R7
118~cp=R13
119*line 66
120move.l 8(R14),R13
121*line 68
122bra L17
123L16:
124*line 69
125*line 70
126move.b R7,(R13)+
127*line 71
128*line 72
129*line 73
130cmp #10,R7
131beq L15
132L17:
133*line 74
134sub #1,12(R14)
135ble L10001
136move.l 14(R14),(sp)
137jsr _agetc
138move R0,R7
139cmp #-1,R7
140bne L16
141L10001:L15:
142*line 76
143clr.b (R13)
144*line 78
145*line 79
146cmp #-1,R7
147bne L18
148cmp.l 8(R14),R13
149bne L18
150*line 79
151clr.l R0
152bra L14
153*line 80
154L18:
155*line 81
156move.l 8(R14),R0
157bra L14
158L14:tst.l (sp)+
159movem.l (sp)+,R7-R7/R13-R13
160unlk R14
161rts
162.data
Note: See TracBrowser for help on using the repository browser.