source: buchla-68k/alcyon/putc.s@ 9b98b6a

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

Added Alcyon C reference output.

  • Property mode set to 100644
File size: 3.5 KB
Line 
1.globl _Cbuffs
2.globl _Stdbufs
3.globl _Stdbuf
4.globl __clsall
5.bss
6L1:.ds.b 4
7.text
8.globl __ClFlag
9.comm __ClFlag,2
10.text
11_closall:
12~~closall:
13link R14,#0
14movem.l R7-R7/R13-R13,-(sp)
15~fp=R13
16*line 32
17move.l #_Cbuffs,R13
18bra L6
19L7:
20*line 33
21move.l R13,(sp)
22jsr _fclose
23add.l #18,R13
24L5:L6:
25*line 32
26cmp.l #198+_Cbuffs,R13
27blo L7
28L4:
29*line 35
30move.l L1,R8
31jsr (R8)
32L3:tst.l (sp)+
33movem.l (sp)+,R13-R13
34unlk R14
35rts
36.globl _flush_
37.text
38_flush_:
39~~flush_:
40~ptr=R13
41~data=12
42link R14,#0
43movem.l R6-R7/R13-R13,-(sp)
44~size=R7
45*line 54
46move.l 8(R14),R13
47*line 54
48*line 54
49tst __ClFlag
50bne L9
51*line 55
52*line 56
53move.l __clsall,L1
54*line 57
55move.l #_closall,__clsall
56*line 58
57move #1,__ClFlag
58*line 59
59*line 60
60L9:
61*line 61
62*line 61
63btst #2,12(R13)
64beq L10
65*line 62
66*line 63
67move.l (R13),R0
68sub.l 8(R13),R0
69move R0,R7
70*line 64
71*line 65
72*line 65
73move R7,(sp)
74move.l 8(R13),-(sp)
75move.b 13(R13),R0
76ext.w R0
77move R0,-(sp)
78jsr _write
79addq.l #6,sp
80cmp #-1,R0
81bne L11
82*line 66
83L12:
84*line 67
85*line 68
86or.b #16,12(R13)
87*line 69
88move #-1,R0
89bra L8
90*line 70
91L11:
92*line 71
93*line 72
94L10:
95*line 73
96*line 73
97cmp #-1,12(R14)
98bne L13
99*line 74
100*line 75
101and.b #-5,12(R13)
102*line 76
103clr R0
104ext.l R0
105move.l R0,(R13)
106move.l R0,4(R13)
107*line 77
108clr R0
109bra L8
110*line 78
111*line 79
112L13:
113*line 80
114*line 81
115tst.l 8(R13)
116bne L14
117*line 81
118move.l R13,(sp)
119jsr _getbuff
120*line 82
121L14:
122*line 83
123*line 83
124cmp #1,16(R13)
125bne L15
126*line 84
127*line 85
128*line 86
129move #1,(sp)
130move.l R14,-(sp)
131add.l #12,(sp)
132move.b 13(R13),R0
133ext.w R0
134move R0,-(sp)
135jsr _write
136addq.l #6,sp
137cmp #-1,R0
138beq L12
139*line 87
140*line 88
141move 12(R14),R0
142bra L8
143*line 89
144*line 90
145L15:
146*line 91
147move.l 8(R13),(R13)
148*line 92
149move.l 8(R13),R0
150move 16(R13),R1
151ext.l R1
152add.l R1,R0
153move.l R0,4(R13)
154*line 93
155or.b #4,12(R13)
156*line 95
157move.l (R13),R8
158move 12(R14),R0
159move.b R0,(R8)
160and #255,R0
161add.l #1,(R13)
162bra L8
163L8:tst.l (sp)+
164movem.l (sp)+,R7-R7/R13-R13
165unlk R14
166rts
167.globl _fflush
168.text
169_fflush:
170~~fflush:
171~ptr=8
172link R14,#-4
173*line 111
174move #-1,(sp)
175move.l 8(R14),-(sp)
176jsr _flush_
177addq.l #4,sp
178bra L16
179L16:unlk R14
180rts
181.globl _fclose
182.text
183_fclose:
184~~fclose:
185~ptr=R13
186link R14,#-2
187movem.l R7-R7/R13-R13,-(sp)
188~err=-2
189*line 126
190move.l 8(R14),R13
191*line 126
192clr -2(R14)
193*line 128
194*line 128
195tst.b 12(R13)
196beq L18
197*line 129
198*line 130
199*line 131
200btst #2,12(R13)
201beq L19
202*line 131
203move #-1,(sp)
204move.l R13,-(sp)
205jsr _flush_
206addq.l #4,sp
207move R0,-2(R14)
208*line 132
209L19:
210*line 133
211move.b 13(R13),R0
212ext.w R0
213move R0,(sp)
214jsr _close
215or R0,-2(R14)
216*line 134
217*line 135
218*line 135
219btst #1,12(R13)
220beq L20
221*line 136
222*line 137
223move.l 8(R13),R8
224move.l _Stdbufs,(R8)
225*line 138
226move.l 8(R13),_Stdbufs
227*line 139
228L20:
229*line 140
230*line 141
231L18:
232*line 142
233clr.b 12(R13)
234*line 143
235move -2(R14),R0
236bra L17
237L17:tst.l (sp)+
238movem.l (sp)+,R13-R13
239unlk R14
240rts
241.globl _putc
242.text
243_putc:
244~~putc:
245~ptr=R13
246~c=8
247link R14,#0
248movem.l R7-R7/R13-R13,-(sp)
249*line 160
250move.l 10(R14),R13
251*line 160
252*line 161
253move.l (R13),R0
254cmp.l 4(R13),R0
255blo L22
256*line 161
257move 8(R14),(sp)
258and #255,(sp)
259move.l R13,-(sp)
260jsr _flush_
261addq.l #4,sp
262bra L21
263*line 162
264L22:
265*line 163
266move.l (R13),R8
267move 8(R14),R0
268move.b R0,(R8)
269and #255,R0
270add.l #1,(R13)
271bra L21
272L21:tst.l (sp)+
273movem.l (sp)+,R13-R13
274unlk R14
275rts
276.globl _puterr
277.text
278_puterr:
279~~puterr:
280~c=8
281link R14,#-4
282*line 175
283move.l #36+_Cbuffs,(sp)
284move 8(R14),-(sp)
285jsr _putc
286addq.l #2,sp
287bra L23
288L23:unlk R14
289rts
290.data
Note: See TracBrowser for help on using the repository browser.