summaryrefslogtreecommitdiff
path: root/software/ihu/math.inc
blob: cf065744925f2f7e9aa20ed3bc17b1fc86997360 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
  ;;
  ;;  mur.sat
  ;;
  ;;  Somewhen in the year 2012, mur.at will have a nano satellite launched
  ;;  into a low earth orbit (310 km above the surface of our planet). The
  ;;  satellite itself is a TubeSat personal satellite kit, developed and
  ;;  launched by interorbital systems. mur.sat is a joint venture of mur.at,
  ;;  ESC im Labor and realraum.
  ;;
  ;;  Please visit the project hompage at sat.mur.at for further information.
  ;;
  ;;
  ;;  Copyright (C) 2011-2013 Christian Pointner <equinox@mur.at>
  ;;
  ;;  This file is part of mur.sat.
  ;;
  ;;  mur.sat is free software: you can redistribute it and/or modify
  ;;  it under the terms of the GNU General Public License as published by
  ;;  the Free Software Foundation, either version 3 of the License, or
  ;;  any later version.
  ;;
  ;;  mur.sat is distributed in the hope that it will be useful,
  ;;  but WITHOUT ANY WARRANTY; without even the implied warranty of
  ;;  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  ;;  GNU General Public License for more details.
  ;;
  ;;  You should have received a copy of the GNU General Public License
  ;;  along with mur.sat. If not, see <http://www.gnu.org/licenses/>.
  ;;

  ;; -------------------------------------
  ;; code generated by http://www.piclist.com/cgi-bin/constdivmul.exe
mul60
  bsf       STATUS,RP1
  movwf     CALC_ACC0

  bcf       STATUS,C
  rlf       CALC_ACC0,f
  clrf      CALC_ACC1
  rlf       CALC_ACC1,f
  rlf       CALC_ACC0,f
  rlf       CALC_ACC1,f

  movf      CALC_ACC1,w
  movwf     CALC_TEMP1
  movf      CALC_ACC0,w
  movwf     CALC_TEMP0

  comf      CALC_ACC0,f
  comf      CALC_ACC1,f
  incf      CALC_ACC0,f
  skpnz
  incf      CALC_ACC1,f

  swapf     CALC_TEMP1,f
  swapf     CALC_TEMP0,f
  movf      CALC_TEMP0,w
  andlw     b'00001111'
  xorwf     CALC_TEMP0,f
  iorwf     CALC_TEMP1,f

  movf      CALC_TEMP0,w
  addwf     CALC_ACC0,f
  movf      CALC_TEMP1,w
  btfsc      STATUS,C
  incfsz    CALC_TEMP1,w
  addwf     CALC_ACC1,f

  bcf       STATUS,RP1
  return

  ;; ----------------------
mul3600
  bsf       STATUS,RP1
  movwf     CALC_ACC0

  swapf     CALC_ACC0,f
  movf      CALC_ACC0,w
  andlw     b'00001111'
  xorwf     CALC_ACC0,f
  movwf     CALC_ACC1

  movf      CALC_ACC1,w
  movwf     CALC_TEMP1
  movf      CALC_ACC0,w
  movwf     CALC_TEMP0

  swapf     CALC_TEMP1,f
  swapf     CALC_TEMP0,f
  movf      CALC_TEMP0,w
  andlw     b'00001111'
  xorwf     CALC_TEMP0,f
  iorwf     CALC_TEMP1,f
  bcf       STATUS,C
  rlf       CALC_TEMP0,f
  rlf       CALC_TEMP1,f
  clrf      CALC_TEMP2
  rlf       CALC_TEMP2,f

  clrf      CALC_ACC2
  movf      CALC_TEMP0,w
  subwf     CALC_ACC0,f
  movf      CALC_TEMP1,w
  skpc
  incfsz    CALC_TEMP1,w
  subwf     CALC_ACC1,f
  movf      CALC_TEMP2,w
  skpc
  incfsz    CALC_TEMP2,w
  subwf     CALC_ACC2,f

  bcf       STATUS,C
  rlf       CALC_TEMP0,f
  rlf       CALC_TEMP1,f
  rlf       CALC_TEMP2,f
  rlf       CALC_TEMP0,f
  rlf       CALC_TEMP1,f
  rlf       CALC_TEMP2,f
  rlf       CALC_TEMP0,f
  rlf       CALC_TEMP1,f
  rlf       CALC_TEMP2,f

  movf      CALC_TEMP0,w
  addwf     CALC_ACC0,f
  movf      CALC_TEMP1,w
  btfsc     STATUS,C
  incfsz    CALC_TEMP1,w
  addwf     CALC_ACC1,f
  movf      CALC_TEMP2,w
  btfsc     STATUS,C
  incfsz    CALC_TEMP2,w
  addwf     CALC_ACC2,f

  bcf       STATUS,RP1
  return

  ;; ----------------------
mul86400
  bsf       STATUS,RP1

  rrf       CALC_ACC1,f
  rrf       CALC_ACC0,w
  movwf     CALC_ACC1
  clrf      CALC_ACC0
  rrf       CALC_ACC0,f

  movf      CALC_ACC1,w
  movwf     CALC_TEMP1
  movf      CALC_ACC0,w
  movwf     CALC_TEMP0

  bcf       STATUS,C
  rlf       CALC_TEMP0,f
  rlf       CALC_TEMP1,f
  clrf      CALC_TEMP2
  rlf       CALC_TEMP2,f

  clrf      CALC_ACC2
  movf      CALC_TEMP0,w
  addwf     CALC_ACC0,f
  movf      CALC_TEMP1,w
  btfsc     STATUS,C
  incfsz    CALC_TEMP1,w
  addwf     CALC_ACC1,f
  movf      CALC_TEMP2,w
  btfsc     STATUS,C
  incfsz    CALC_TEMP2,w
  addwf     CALC_ACC2,f

  swapf     CALC_TEMP2,f
  swapf     CALC_TEMP1,f
  movf      CALC_TEMP1,w
  andlw     b'00001111'
  xorwf     CALC_TEMP1,f
  iorwf     CALC_TEMP2,f
  swapf     CALC_TEMP0,f
  movf      CALC_TEMP0,w
  andlw     b'00001111'
  xorwf     CALC_TEMP0,f
  iorwf     CALC_TEMP1,f

  movf      CALC_TEMP0,w
  addwf     CALC_ACC0,f
  movf      CALC_TEMP1,w
  btfsc     STATUS,C
  incfsz    CALC_TEMP1,w
  addwf     CALC_ACC1,f
  movf      CALC_TEMP2,w
  btfsc     STATUS,C
  incfsz    CALC_TEMP2,w
  addwf     CALC_ACC2,f

  bcf       STATUS,C
  rlf       CALC_TEMP0,f
  rlf       CALC_TEMP1,f
  rlf       CALC_TEMP2,f
  rlf       CALC_TEMP0,f
  rlf       CALC_TEMP1,f
  rlf       CALC_TEMP2,f

  movf      CALC_TEMP0,w
  addwf     CALC_ACC0,f
  movf      CALC_TEMP1,w
  btfsc     STATUS,C
  incfsz    CALC_TEMP1,w
  addwf     CALC_ACC1,f
  movf      CALC_TEMP2,w
  btfsc     STATUS,C
  incfsz    CALC_TEMP2,w
  addwf     CALC_ACC2,f

  bcf       STATUS,C
  rlf       CALC_TEMP0,f
  rlf       CALC_TEMP1,f
  rlf       CALC_TEMP2,f
  rlf       CALC_TEMP0,f
  rlf       CALC_TEMP1,f
  rlf       CALC_TEMP2,f
  clrf      CALC_TEMP3
  rlf       CALC_TEMP3,f

  clrf      CALC_ACC3
  movf      CALC_TEMP0,w
  addwf     CALC_ACC0,f
  movf      CALC_TEMP1,w
  btfsc     STATUS,C
  incfsz    CALC_TEMP1,w
  addwf     CALC_ACC1,f
  movf      CALC_TEMP2,w
  btfsc     STATUS,C
  incfsz    CALC_TEMP2,w
  addwf     CALC_ACC2,f
  movf      CALC_TEMP3,w
  btfsc     STATUS,C
  incfsz    CALC_TEMP3,w
  addwf     CALC_ACC3,f

  bcf       STATUS,RP1
  return
  ;; -------------------------------------