added concrete implementations of putc(), getc(), getchar() and gets()
[tangerine.git] / arch / .unmaintained / m68k-native / clib / __divsi3.s
blob36e931a885a314c6b69625476200ba7feb280592
1 | $Id$
3 | Code taken from libnix
6 .globl _div
7 .globl _ldiv
8 .globl ___modsi3
9 .globl ___divsi3
11 | D1.L = D0.L % D1.L signed
13 ___modsi3: moveml sp@(4:W),d0/d1
14 jbsr ___divsi4
15 movel d1,d0
16 rts
18 | D0.L = D0.L / D1.L signed
20 _div:
21 _ldiv:
22 ___divsi3: moveml sp@(4:W),d0/d1
23 ___divsi4: movel d3,sp@-
24 movel d2,sp@-
25 moveq #0,d2
26 tstl d0
27 bpls LC5
28 negl d0
29 addql #1,d2
30 LC5: movel d2,d3
31 tstl d1
32 bpls LC4
33 negl d1
34 eoriw #1,d3
35 LC4: jbsr ___udivsi4
36 LC3: tstw d2
37 beqs LC2
38 negl d0
39 LC2: tstw d3
40 beqs LC1
41 negl d1
42 LC1: movel sp@+,d2
43 movel sp@+,d3
44 rts