source: buchla-68k/alcyon/strtol.s@ 9519422

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

Added Alcyon C reference output.

  • Property mode set to 100644
File size: 3.2 KB
Line 
1.globl ___atab
2.globl _strtol
3.text
4_strtol:
5~~strtol:
6~str=R13
7~base=R7
8~ptr=12
9link R14,#-4
10movem.l R4-R7/R13-R13,-(sp)
11~val=R6
12~c=R5
13~xx=-2
14~neg=-4
15*line 22
16clr -4(R14)
17*line 24
18move.l 8(R14),R13
19*line 24
20move 16(R14),R7
21*line 24
22*line 25
23tst.l 12(R14)
24beq L2
25*line 25
26move.l 12(R14),R8
27move.l R13,(R8)
28*line 26
29L2:
30*line 27
31*line 28
32tst R7
33blt L10000
34cmp #36,R7
35ble L3
36L10000:*line 28
37clr.l R0
38bra L1
39*line 29
40L3:
41*line 30
42*line 30
43move.b (R13),R5
44ext.w R5
45move.l #___atab,R8
46move.b 0(R8,R5),R0
47ext.w R0
48and #28,R0
49bne L4
50*line 31
51*line 32
52bra L7
53L6:
54*line 33
55add.l #1,R13
56move.b (R13),R5
57ext.w R5
58L7:
59*line 33
60move R5,R8
61add.l #___atab,R8
62btst #5,(R8)
63bne L6
64L5:
65*line 34
66*line 35
67move R5,R0
68bra L9
69*line 36
70L10:
71*line 37
72*line 38
73add #1,-4(R14)
74*line 39
75L11:
76*line 40
77*line 41
78add.l #1,R13
79move.b (R13),R5
80ext.w R5
81bra L8
82L9:cmp #43,R0
83beq L11
84cmp #45,R0
85beq L10
86bra L8
87L8:
88*line 42
89*line 43
90*line 44
91L4:
92*line 45
93*line 46
94tst R7
95bne L12
96*line 46
97*line 47
98cmp #48,R5
99beq L13
100*line 47
101move #10,R7
102bra L14
103L13:
104*line 48
105*line 49
106cmp.b #120,1(R13)
107beq L10001
108cmp.b #88,1(R13)
109bne L15
110L10001:*line 49
111move #16,R7
112*line 50
113bra L16
114L15:
115*line 51
116move #8,R7
117L16:L14:
118*line 52
119*line 53
120*line 54
121*line 55
122*line 56
123L12:
124*line 57
125*line 58
126move.l #___atab,R8
127move.b 0(R8,R5),R0
128ext.w R0
129and #28,R0
130beq L10002
131move R5,R8
132add.l #___atab,R8
133btst #2,(R8)
134beq L10003
135move R5,R0
136add #-48,R0
137bra L10005
138L10003:move R5,R8
139add.l #___atab,R8
140btst #4,(R8)
141beq L10006
142move R5,R0
143add #-87,R0
144bra L10008
145L10006:move R5,R0
146add #-55,R0
147L10008:L10005:move R0,-2(R14)
148cmp R0,R7
149bgt L17
150L10002:*line 58
151clr.l R0
152bra L1
153*line 59
154L17:
155*line 60
156*line 61
157*line 62
158cmp #16,R7
159bne L18
160cmp #48,R5
161bne L18
162move.b 2(R13),R0
163ext.w R0
164ext.l R0
165add.l #___atab,R0
166move.l R0,R8
167btst #7,(R8)
168beq L18
169cmp.b #120,1(R13)
170beq L10009
171cmp.b #88,1(R13)
172bne L18
173L10009:*line 62
174add.l #2,R13
175move.b (R13),R5
176ext.w R5
177*line 63
178L18:
179*line 64
180move R5,R8
181add.l #___atab,R8
182btst #2,(R8)
183beq L10010
184move R5,R0
185add #-48,R0
186bra L10012
187L10010:move R5,R8
188add.l #___atab,R8
189btst #4,(R8)
190beq L10013
191move R5,R0
192add #-87,R0
193bra L10015
194L10013:move R5,R0
195add #-55,R0
196L10015:L10012:neg R0
197ext.l R0
198move.l R0,R6
199bra L21
200L22:
201*line 65
202*line 66
203move R7,R0
204ext.l R0
205move.l R0,-(sp)
206move.l R6,-(sp)
207jsr lmul
208addq.l #8,sp
209move.l R0,R6
210move -2(R14),R0
211ext.l R0
212sub.l R0,R6
213L20:L21:
214*line 64
215add.l #1,R13
216move.b (R13),R0
217ext.w R0
218move R0,R5
219move.l #___atab,R8
220move.b 0(R8,R5),R0
221ext.w R0
222and #28,R0
223beq L10016
224move R5,R8
225add.l #___atab,R8
226btst #2,(R8)
227beq L10017
228move R5,R0
229add #-48,R0
230bra L10019
231L10017:move R5,R8
232add.l #___atab,R8
233btst #4,(R8)
234beq L10020
235move R5,R0
236add #-87,R0
237bra L10022
238L10020:move R5,R0
239add #-55,R0
240L10022:L10019:move R0,-2(R14)
241cmp R0,R7
242bgt L22
243L10016:L19:
244*line 68
245*line 69
246tst.l 12(R14)
247beq L23
248*line 69
249move.l 12(R14),R8
250move.l R13,(R8)
251*line 70
252L23:
253*line 71
254tst -4(R14)
255beq L10023
256move.l R6,R0
257bra L10025
258L10023:move.l R6,R0
259neg.l R0
260L10025:bra L1
261L1:tst.l (sp)+
262movem.l (sp)+,R5-R7/R13-R13
263unlk R14
264rts
265.data
Note: See TracBrowser for help on using the repository browser.