struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / device / lib / stm8 / _mullong.s
blob5d13e8c2fbf04d2d7408fef59bf6a0f629dd643e
1 ;--------------------------------------------------------------------------
2 ; _mullong.s
4 ; Copyright (C) 2014, Ben Shi
6 ; This library is free software; you can redistribute it and/or modify it
7 ; under the terms of the GNU General Public License as published by the
8 ; Free Software Foundation; either version 2, or (at your option) any
9 ; later version.
11 ; This library is distributed in the hope that it will be useful,
12 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ; GNU General Public License for more details.
16 ; You should have received a copy of the GNU General Public License
17 ; along with this library; see the file COPYING. If not, write to the
18 ; Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
19 ; MA 02110-1301, USA.
21 ; As a special exception, if you link this library with other files,
22 ; some of which are compiled with SDCC, to produce an executable,
23 ; this library does not by itself cause the resulting executable to
24 ; be covered by the GNU General Public License. This exception does
25 ; not however invalidate any other reasons why the executable file
26 ; might be covered by the GNU General Public License.
27 ;--------------------------------------------------------------------------
29 .globl __mullong
31 .area CODE
32 __mullong:
33 clrw x
34 pushw x
35 pushw x
36 __mullong_0:
37 ld a, (#10, sp)
38 ld xl, a
39 ld a, (#14, sp)
40 mul x, a
41 ldw (#3, sp), x
42 __mullong_1:
43 ld a, (#9, sp)
44 ld xl, a
45 ld a, (#14, sp)
46 mul x, a
47 addw x, (#2, sp)
48 ldw (#2, sp), x
49 clr a
50 adc a, #0
51 ld (#1, sp), a
53 ld a, (#10, sp)
54 ld xl, a
55 ld a, (#13, sp)
56 mul x, a
57 addw x, (#2, sp)
58 ldw (#2, sp), x
59 clr a
60 adc a, (#1, sp)
61 ld (#1, sp), a
62 __mullong_2:
63 ld a, (#10, sp)
64 ld xl, a
65 ld a, (#12, sp)
66 mul x, a
67 addw x, (#1, sp)
68 ldw (#1, sp), x
70 ld a, (#9, sp)
71 ld xl, a
72 ld a, (#13, sp)
73 mul x, a
74 addw x, (#1, sp)
75 ldw (#1, sp), x
77 ld a, (#8, sp)
78 ld xl, a
79 ld a, (#14, sp)
80 mul x, a
81 addw x, (#1, sp)
82 ldw (#1, sp), x
83 __mullong_3:
84 ld a, (#7, sp)
85 ld xl, a
86 ld a, (#14, sp)
87 mul x, a
88 ld a, xl
89 add a, (#1, sp)
90 ld (#1, sp), a
92 ld a, (#10, sp)
93 ld xl, a
94 ld a, (#11, sp)
95 mul x, a
96 ld a, xl
97 add a, (#1, sp)
98 ld (#1, sp), a
100 ld a, (#9, sp)
101 ld xl, a
102 ld a, (#12, sp)
103 mul x, a
104 ld a, xl
105 add a, (#1, sp)
106 ld (#1, sp), a
108 ld a, (#8, sp)
109 ld xl, a
110 ld a, (#13, sp)
111 mul x, a
112 ld a, xl
113 add a, (#1, sp)
114 ld (#1, sp), a
115 __mullong_4:
116 popw y
117 popw x