Skip to content

Commit d94377a

Browse files
committed
Add placeholder 48-bit libcalls which invoke 64-bit libcalls
1 parent 1aad1f6 commit d94377a

File tree

1 file changed

+327
-0
lines changed

1 file changed

+327
-0
lines changed

src/crt/i48stubs.src

Lines changed: 327 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,327 @@
1+
assume adl=1
2+
3+
section .text
4+
public __i48not
5+
__i48not:
6+
push bc
7+
call __llnot
8+
pop bc
9+
ret
10+
11+
section .text
12+
public __i48and
13+
__i48and:
14+
push iy
15+
push bc
16+
call __lland
17+
pop bc
18+
pop iy
19+
ret
20+
21+
section .text
22+
public __i48or
23+
__i48or:
24+
push iy
25+
push bc
26+
call __llor
27+
pop bc
28+
pop iy
29+
ret
30+
31+
section .text
32+
public __i48xor
33+
__i48xor:
34+
push iy
35+
push bc
36+
call __llxor
37+
pop bc
38+
pop iy
39+
ret
40+
41+
section .text
42+
public __i48shl
43+
__i48shl:
44+
push bc
45+
call __llshl
46+
pop bc
47+
ret
48+
49+
section .text
50+
public __i48shru
51+
__i48shru:
52+
push bc
53+
ld bc, 0
54+
call __llshru
55+
pop bc
56+
ret
57+
58+
section .text
59+
public __i48shrs
60+
__i48shrs:
61+
push bc
62+
ex de, hl
63+
push hl
64+
add hl, hl
65+
sbc hl, hl
66+
ex (sp), hl
67+
pop bc
68+
ex de, hl
69+
call __llshrs
70+
pop bc
71+
ret
72+
73+
section .text
74+
public __i48cmpu
75+
__i48cmpu:
76+
push bc
77+
push iy
78+
push bc
79+
call __llcmpu
80+
pop bc
81+
pop bc
82+
pop bc
83+
ret
84+
85+
section .text
86+
public __i48cmpu
87+
__i48cmpzero:
88+
push bc
89+
dec sp
90+
push de
91+
inc sp
92+
pop bc
93+
call __llcmpzero
94+
pop bc
95+
ret
96+
97+
section .text
98+
public __i48cmps
99+
__i48cmps:
100+
push hl
101+
lea hl, iy
102+
add hl, hl
103+
sbc hl, hl
104+
ex (sp), hl
105+
push iy
106+
push bc
107+
ex de, hl
108+
push hl
109+
add hl, hl
110+
sbc hl, hl
111+
ex (sp), hl
112+
pop bc
113+
ex de, hl
114+
call __llcmps
115+
pop bc
116+
pop iy
117+
inc sp
118+
inc sp
119+
inc sp
120+
ret
121+
122+
section .text
123+
public __i48neg
124+
__i48neg:
125+
push bc
126+
call __llneg
127+
pop bc
128+
ret
129+
130+
section .text
131+
public __i48muls, __i48mulu
132+
__i48muls:
133+
__i48mulu:
134+
push hl
135+
or a, a
136+
sbc hl, hl
137+
ex (sp), hl
138+
push iy
139+
push bc
140+
call __llmulu
141+
pop bc
142+
pop iy
143+
inc sp
144+
inc sp
145+
inc sp
146+
ret
147+
148+
section .text
149+
public __i48divs
150+
__i48divs:
151+
push bc
152+
push hl
153+
lea hl, iy
154+
add hl, hl
155+
sbc hl, hl
156+
ex (sp), hl
157+
push iy
158+
push bc
159+
ex de, hl
160+
push hl
161+
add hl, hl
162+
sbc hl, hl
163+
ex (sp), hl
164+
pop bc
165+
ex de, hl
166+
call __lldivs
167+
pop bc
168+
pop bc
169+
pop bc
170+
pop bc
171+
ret
172+
173+
section .text
174+
public __i48divu
175+
__i48divu:
176+
push bc
177+
push hl
178+
or a, a
179+
sbc hl, hl
180+
ex (sp), hl
181+
push iy
182+
push bc
183+
ld bc, 0
184+
call __lldivu
185+
pop bc
186+
pop bc
187+
pop bc
188+
pop bc
189+
ret
190+
191+
section .text
192+
public __i48rems
193+
__i48rems:
194+
push bc
195+
push hl
196+
lea hl, iy
197+
add hl, hl
198+
sbc hl, hl
199+
ex (sp), hl
200+
push iy
201+
push bc
202+
ex de, hl
203+
push hl
204+
add hl, hl
205+
sbc hl, hl
206+
ex (sp), hl
207+
pop bc
208+
ex de, hl
209+
call __llrems
210+
pop bc
211+
pop bc
212+
pop bc
213+
pop bc
214+
ret
215+
216+
section .text
217+
public __i48remu
218+
__i48remu:
219+
push bc
220+
push hl
221+
or a, a
222+
sbc hl, hl
223+
ex (sp), hl
224+
push iy
225+
push bc
226+
ld bc, 0
227+
call __llremu
228+
pop bc
229+
pop bc
230+
pop bc
231+
pop bc
232+
ret
233+
234+
section .text
235+
public __i48dvrmu
236+
__i48dvrmu:
237+
push hl
238+
or a, a
239+
sbc hl, hl
240+
ex (sp), hl
241+
push iy
242+
push bc
243+
ld bc, 0
244+
push bc
245+
push bc
246+
push af
247+
call __lldvrmu
248+
pop af
249+
pop bc
250+
pop bc
251+
pop bc
252+
pop iy
253+
inc sp
254+
inc sp
255+
inc sp
256+
ret
257+
258+
section .text
259+
public __i48ctlz
260+
__i48ctlz:
261+
xor a, a
262+
ld b, a
263+
ld c, a
264+
call __llctlz
265+
sub a, 16
266+
ret
267+
268+
section .text
269+
public __i48popcnt
270+
__i48popcnt:
271+
call __lpopcnt
272+
dec sp
273+
push de
274+
inc sp
275+
ex (sp), hl
276+
push af
277+
call __spopcnt
278+
pop hl
279+
add a, h
280+
pop hl
281+
ret
282+
283+
section .text
284+
public __i48bitrev
285+
__i48bitrev:
286+
call __ibitrev
287+
ex de, hl
288+
jp __ibitrev
289+
290+
section .text
291+
public __i48bswap
292+
__i48bswap:
293+
push bc
294+
call __llbswap
295+
push bc
296+
push de
297+
push hl
298+
inc sp
299+
inc sp
300+
pop hl
301+
pop de
302+
inc sp
303+
pop bc
304+
ret
305+
306+
extern __llnot
307+
extern __lland
308+
extern __llor
309+
extern __llxor
310+
extern __llshl
311+
extern __llshru
312+
extern __llshrs
313+
extern __llcmpu
314+
extern __llcmpzero
315+
extern __llcmps
316+
extern __llneg
317+
extern __llmulu
318+
extern __lldivs
319+
extern __lldivu
320+
extern __llrems
321+
extern __llremu
322+
extern __lldvrmu
323+
extern __llctlz
324+
extern __lpopcnt
325+
extern __spopcnt
326+
extern __ibitrev
327+
extern __llbswap

0 commit comments

Comments
 (0)