source: buchla-68k/alcyon/fopen.s@ bc1afe0

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

Added Alcyon C reference output.

  • Property mode set to 100644
File size: 2.7 KB
Line 
1.globl _Cbuffs
2.globl _Stdbufs
3.globl _Stdbuf
4.globl _errno
5.globl __opener
6.text
7__opener:
8~~_opener:
9~name=8
10~mode=12
11~aflag=16
12link R14,#0
13movem.l R6-R7/R13-R13,-(sp)
14~fp=R13
15~plusopt=R7
16*line 23
17move.l #_Cbuffs,R13
18*line 25
19bra L4
20L3:
21*line 26
22*line 27
23*line 28
24add.l #18,R13
25move.l R13,R0
26cmp.l #198+_Cbuffs,R0
27blo L5
28*line 28
29clr.l R0
30bra L1
31L5:L4:
32*line 29
33tst.b 12(R13)
34bne L3
35L2:
36*line 31
37move.l 12(R14),R8
38cmp.b #43,1(R8)
39beq L10000
40clr R0
41bra L10001
42L10000:move #1,R0
43L10001:move R0,R7
44*line 33
45move.l 12(R14),R8
46move.b (R8),R0
47ext.w R0
48and #127,R0
49bra L7
50*line 34
51L8:
52*line 35
53*line 36
54*line 37
55tst R7
56beq L10002
57move #2,(sp)
58bra L10004
59L10002:clr (sp)
60L10004:move 16(R14),R0
61or R0,(sp)
62move.l 8(R14),-(sp)
63jsr _open
64addq.l #4,sp
65move.b R0,13(R13)
66cmp #-1,R0
67bne L9
68*line 37
69clr.l R0
70bra L1
71L9:bra L6
72*line 38
73*line 39
74L10:
75*line 40
76*line 41
77*line 42
78tst R7
79beq L10005
80move #2,(sp)
81bra L10007
82L10005:move #1,(sp)
83L10007:move 16(R14),R0
84or R0,(sp)
85or #768,(sp)
86move.l 8(R14),-(sp)
87jsr _open
88addq.l #4,sp
89move.b R0,13(R13)
90cmp #-1,R0
91bne L11
92*line 42
93clr.l R0
94bra L1
95*line 43
96L11:bra L6
97*line 44
98*line 45
99L12:
100*line 46
101*line 47
102*line 48
103tst R7
104beq L10008
105move #2,(sp)
106bra L10010
107L10008:move #1,(sp)
108L10010:move 16(R14),R0
109or R0,(sp)
110or #256,(sp)
111move.l 8(R14),-(sp)
112jsr _open
113addq.l #4,sp
114move.b R0,13(R13)
115cmp #-1,R0
116bne L13
117*line 48
118clr.l R0
119bra L1
120*line 49
121L13:
122*line 50
123*line 50
124move #2,(sp)
125clr.l -(sp)
126move.b 13(R13),R0
127ext.w R0
128move R0,-(sp)
129jsr _lseek
130addq.l #6,sp
131tst.l R0
132bge L14
133*line 51
134*line 52
135move.b 13(R13),R0
136ext.w R0
137move R0,(sp)
138jsr _close
139*line 53
140clr.l R0
141bra L1
142*line 54
143*line 55
144L14:bra L6
145*line 56
146*line 57
147L15:
148*line 58
149*line 59
150move #22,_errno
151*line 60
152clr.l R0
153bra L1
154bra L6
155L7:cmp #97,R0
156beq L12
157cmp #114,R0
158beq L8
159cmp #119,R0
160beq L10
161bra L15
162L6:
163*line 63
164move.b #1,12(R13)
165*line 64
166move #1024,16(R13)
167*line 65
168clr.l 8(R13)
169*line 66
170clr.l 4(R13)
171*line 67
172clr.l (R13)
173*line 68
174move.l R13,R0
175bra L1
176L1:tst.l (sp)+
177movem.l (sp)+,R7-R7/R13-R13
178unlk R14
179rts
180.globl _fopen
181.text
182_fopen:
183~~fopen:
184~name=8
185~mode=12
186link R14,#-4
187*line 78
188clr (sp)
189move.l 12(R14),-(sp)
190move.l 8(R14),-(sp)
191jsr __opener
192addq.l #8,sp
193bra L16
194L16:unlk R14
195rts
196.globl _fopena
197.text
198_fopena:
199~~fopena:
200~name=8
201~mode=12
202link R14,#-4
203*line 85
204clr (sp)
205move.l 12(R14),-(sp)
206move.l 8(R14),-(sp)
207jsr __opener
208addq.l #8,sp
209bra L17
210L17:unlk R14
211rts
212.globl _fopenb
213.text
214_fopenb:
215~~fopenb:
216~name=8
217~mode=12
218link R14,#-4
219*line 92
220move #-32768,(sp)
221move.l 12(R14),-(sp)
222move.l 8(R14),-(sp)
223jsr __opener
224addq.l #8,sp
225bra L18
226L18:unlk R14
227rts
228.data
Note: See TracBrowser for help on using the repository browser.