Mercurial > public > mk2
annotate code_part1/OSTC_code_asm_part1/math.asm @ 562:56753ea6a791 bug_deco_clearing_missed_stops
Cleaning LOW gf reference in deco model
author | JeanDo |
---|---|
date | Sat, 25 Feb 2012 15:13:26 +0100 |
parents | 44e9b961f156 |
children | e3ffc6d62a63 |
rev | line source |
---|---|
0 | 1 ; OSTC - diving computer code |
2 ; Copyright (C) 2008 HeinrichsWeikamp GbR | |
3 | |
4 ; This program is free software: you can redistribute it and/or modify | |
5 ; it under the terms of the GNU General Public License as published by | |
6 ; the Free Software Foundation, either version 3 of the License, or | |
7 ; (at your option) any later version. | |
8 | |
9 ; This program is distributed in the hope that it will be useful, | |
10 ; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 ; GNU General Public License for more details. | |
13 | |
14 ; You should have received a copy of the GNU General Public License | |
15 ; along with this program. If not, see <http://www.gnu.org/licenses/>. | |
16 | |
17 | |
18 ; Math routines | |
161
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
19 ; history: |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
20 ; 2005-10-30: Written by Matthias Heinrichs, info@heinrichsweikamp.com |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
21 ; 2007-06-21: MH last updated |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
22 ; 2011-01-19: Clean up of isr variante. |
0 | 23 ; known bugs: |
24 ; ToDo: clean up! | |
25 | |
88 | 26 |
0 | 27 convert_time: ; converts hi:lo in minutes to hours (hi) and minutes (lo) |
28 movff lo,xA+0 ; divide by 60... | |
29 movff hi,xA+1 ; | |
30 movlw d'60' ; | |
31 movwf xB+0 ; | |
32 clrf xB+1 ; | |
33 rcall div16x16 ; xA/xB=xC with xA as remainder | |
34 movff xC+0,hi ; Hours | |
35 movff xA+0,lo ; =remaining minutes (0.....59) | |
36 return | |
37 | |
38 div16: | |
39 ; divA=divA/2^divB (divB: 8Bit only!) | |
40 bcf STATUS,C | |
41 rrcf divA+1 | |
42 rrcf divA | |
43 decfsz divB | |
44 bra div16 | |
45 return | |
46 | |
552 | 47 sub32: ;xC:4=xC:4-sub_c:4 (Warning: sub_c+3 trashes sub_a+0!) |
48 movf sub_c+0, W | |
49 subwf xC+0, F | |
50 | |
51 movf sub_c+1, W | |
52 BTFSS STATUS, C | |
53 incfsz sub_c+1, W | |
54 subwf xC+1, F | |
55 | |
56 movf sub_c+2, W | |
57 BTFSS STATUS, C | |
58 incfsz sub_c+2, W | |
59 subwf xC+2, F | |
60 | |
61 movf sub_c+3, W | |
62 BTFSS STATUS, C | |
63 incfsz sub_c+3, W | |
64 subwf xC+3, F | |
65 return | |
66 | |
544 | 67 sub16: ; sub_c = sub_a - sub_b (with signed values) |
0 | 68 bcf neg_flag |
74 | 69 movf sub_b+0, W ; Get Value to be subtracted |
70 subwf sub_a+0, W ; Do the High Byte | |
71 movwf sub_c+0 | |
72 movf sub_b+1, W ; Get the Value to be Subbed | |
73 subwfb sub_a+1, W | |
74 movwf sub_c+1 | |
342
06299199dfb9
Fix bad max depth value (fix sub16 to avoid trashing sub_b).
JeanDo
parents:
161
diff
changeset
|
75 |
354 | 76 btfss STATUS,N ; Negativ result ? |
77 return ; NO: result positive done. | |
342
06299199dfb9
Fix bad max depth value (fix sub16 to avoid trashing sub_b).
JeanDo
parents:
161
diff
changeset
|
78 |
354 | 79 bsf neg_flag ; MARK result negative |
342
06299199dfb9
Fix bad max depth value (fix sub16 to avoid trashing sub_b).
JeanDo
parents:
161
diff
changeset
|
80 |
06299199dfb9
Fix bad max depth value (fix sub16 to avoid trashing sub_b).
JeanDo
parents:
161
diff
changeset
|
81 comf sub_c+1 ; 16bit sign change. |
06299199dfb9
Fix bad max depth value (fix sub16 to avoid trashing sub_b).
JeanDo
parents:
161
diff
changeset
|
82 negf sub_c+0 |
06299199dfb9
Fix bad max depth value (fix sub16 to avoid trashing sub_b).
JeanDo
parents:
161
diff
changeset
|
83 btfsc STATUS,C ; Carry to propagate ? |
06299199dfb9
Fix bad max depth value (fix sub16 to avoid trashing sub_b).
JeanDo
parents:
161
diff
changeset
|
84 incf sub_c+1,F ; YES: do it. |
06299199dfb9
Fix bad max depth value (fix sub16 to avoid trashing sub_b).
JeanDo
parents:
161
diff
changeset
|
85 |
0 | 86 return |
87 | |
544 | 88 subU16: ; sub_c = sub_a - sub_b (with UNSIGNED values) |
426 | 89 bcf neg_flag |
90 movf sub_b+0, W ; Get Value to be subtracted | |
91 subwf sub_a+0, W ; Do the High Byte | |
92 movwf sub_c+0 | |
93 movf sub_b+1, W ; Get the Value to be Subbed | |
94 subwfb sub_a+1, W | |
95 movwf sub_c+1 | |
96 | |
97 btfsc STATUS,C ; Borrow to propagate ? (B == /CARRY) | |
98 return ; NO: result positive done. | |
99 | |
100 bsf neg_flag ; MARK result negative | |
101 | |
102 comf sub_c+1 ; 16bit sign change. | |
103 negf sub_c+0 | |
104 btfsc STATUS,C ; Carry to propagate ? | |
105 incf sub_c+1,F ; YES: do it. | |
106 | |
107 return | |
108 | |
476 | 109 ;============================================================================= |
110 | |
105 | 111 mult16x16: ;xA*xB=xC |
0 | 112 clrf xC+2 ; Clear the High-Order Bits |
113 clrf xC+3 | |
114 movf xA, w ; Do the "L" Multiplication first | |
115 mulwf xB | |
116 movf PRODL, w ; Save result | |
117 movwf xC | |
118 movf PRODH, w | |
119 movwf xC+1 | |
120 movf xA, w ; Do the "I" Multiplication | |
121 mulwf xB+1 | |
122 movf PRODL, w ; Save the Most Significant Byte First | |
123 addwf xC+1, f | |
124 movf PRODH, w | |
125 addwfc xC+2, f ; Add to the Last Result | |
126 movf xA+1, w ; Do the "O" Multiplication | |
127 mulwf xB | |
128 movf PRODL, w ; Add the Lower Byte Next | |
129 addwf xC+1, f | |
130 movf PRODH, w ; Add the High Byte First | |
131 addwfc xC+2, f | |
132 btfsc STATUS, C ; Add the Carry | |
133 incf xC+3, f | |
134 movf xA+1, w ; Do the "F" Multiplication | |
135 mulwf xB+1 | |
136 movf PRODL, w | |
137 addwf xC+2, f | |
138 movf PRODH, w | |
139 addwfc xC+3, f | |
140 return | |
141 | |
476 | 142 ;============================================================================= |
0 | 143 |
144 div16x16: ;xA/xB=xC with xA as remainder | |
145 ;uses divB as temp variable | |
146 clrf xC+0 | |
147 clrf xC+1 | |
148 MOVF xB+0,W ; Check for zero | |
149 IORWF xB+1,W ; | |
150 BTFSC STATUS,Z ; Check for zero | |
151 RETLW H'FF' ; return 0xFF if illegal | |
152 MOVLW 1 ; Start count at 1 | |
153 MOVWF divB ; Clear Count | |
154 div16x16_1 | |
155 BTFSC xB+1,7 ; High bit set ? | |
156 bra div16x16_2 ; Yes then continue | |
157 INCF divB,F ; Increment count | |
158 | |
159 bcf STATUS,C | |
160 rlcf xB+0,F | |
161 rlcf xB+1,F | |
162 bra div16x16_1 | |
163 div16x16_2: | |
164 ; Shift result left | |
165 bcf STATUS,C | |
166 rlcf xC+0,F | |
167 rlcf xC+1,F | |
168 | |
169 ; Reduce Divisor | |
170 | |
171 MOVF xB,W ; Get low byte of subtrahend | |
172 SUBWF xA,F ; Subtract DST(low) - SRC(low) | |
173 MOVF xB+1,W ; Now get high byte of subtrahend | |
174 BTFSS STATUS,C ; If there was a borrow, rather than | |
175 INCF xB+1,W ; decrement high byte of dst we inc src | |
176 SUBWF xA+1,F ; Subtract the high byte and we're done | |
177 | |
178 | |
179 BTFSC STATUS, C ; Did it reduce? | |
180 bra div16x16_3 ; No, so it was less than | |
181 | |
182 movf xB+0,W ; Reverse subtraction | |
183 addwf xA+0,F | |
184 movf xB+1,W | |
185 addwfc xA+1,F | |
186 | |
187 bra div16x16_4 ; Continue the process | |
188 div16x16_3: | |
189 BSF xC+0,0 ; Yes it did, this gets a 1 bit | |
190 div16x16_4: | |
191 DECF divB,F ; Decrement N_COUNT | |
192 BTFSC STATUS,Z ; If its not zero then continue | |
193 return | |
194 | |
195 bcf STATUS,C | |
196 rrcf xB+1,F | |
197 rrcf xB+0,F | |
198 | |
199 bra div16x16_2 ; Next bit. | |
200 | |
476 | 201 ;============================================================================= |
202 | |
0 | 203 div32x16: ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder |
204 ; Setup | |
205 movlw .32 ; setup shift counter | |
206 movwf divB | |
207 movf xC+3,W ; move ACCb to ACCf | |
208 movwf xA+1 | |
209 movf xC+2,W | |
210 movwf xA+0 | |
211 movf xC+1,W ; move ACCc to ACCe | |
212 movwf sub_a+1 | |
213 movf xC+0,W | |
214 movwf sub_a+0 | |
215 clrf xC+3 | |
216 clrf xC+2 | |
217 clrf xC+1 | |
218 clrf xC+0 | |
219 clrf sub_b+1 | |
220 clrf sub_b+0 | |
221 div32x16_2 | |
222 bcf STATUS,C | |
223 rlcf sub_a+0,F | |
224 rlcf sub_a+1,F | |
225 rlcf xA+0,F | |
226 rlcf xA+1,F | |
227 rlcf sub_b+0,F | |
228 rlcf sub_b+1,F | |
229 movf xB+1,W | |
230 subwf sub_b+1,W ; check if a>d | |
231 btfss STATUS,Z | |
476 | 232 bra div32x16_3 |
0 | 233 movf xB+0,W |
234 subwf sub_b+0,W ; if msb equal then check lsb | |
235 div32x16_3 | |
236 btfss STATUS,C ; carry set if d>a | |
476 | 237 bra div32x16_4 |
0 | 238 movf xB+0,W ; d-a into d |
239 subwf sub_b+0,F | |
240 btfss STATUS,C | |
241 decf sub_b+1,F | |
242 movf xB+1,W | |
243 subwf sub_b+1,F | |
244 bsf STATUS,C ; shift a 1 into b (result) | |
245 div32x16_4 | |
246 rlcf xC+0,F | |
247 rlcf xC+1,F | |
248 rlcf xC+2,F | |
249 rlcf xC+3,F | |
250 decfsz divB,F ; loop until all bits checked | |
476 | 251 bra div32x16_2 |
0 | 252 return |
253 | |
161
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
254 ;============================================================================= |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
255 ; u16 * u16 --> 32bit multiply (xA * xB --> xC) |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
256 ; Used in interupt service routines, to compute temperature and pressure. |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
257 ; |
0 | 258 isr_mult16x16: |
259 clrf isr_xC+2 ; Clear the High-Order Bits | |
260 clrf isr_xC+3 | |
261 movf isr_xA, w ; Do the "L" Multiplication first | |
262 mulwf isr_xB | |
263 movf PRODL, w ; Save result | |
161
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
264 movwf isr_xC+0 |
0 | 265 movf PRODH, w |
266 movwf isr_xC+1 | |
161
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
267 movf isr_xA+0, w ; Do the "I" Multiplication |
0 | 268 mulwf isr_xB+1 |
269 movf PRODL, w ; Save the Most Significant Byte First | |
270 addwf isr_xC+1, f | |
271 movf PRODH, w | |
272 addwfc isr_xC+2, f ; Add to the Last Result | |
273 movf isr_xA+1, w ; Do the "O" Multiplication | |
274 mulwf isr_xB | |
275 movf PRODL, w ; Add the Lower Byte Next | |
276 addwf isr_xC+1, f | |
277 movf PRODH, w ; Add the High Byte First | |
278 addwfc isr_xC+2, f | |
279 btfsc STATUS, C ; Add the Carry | |
280 incf isr_xC+3, f | |
281 movf isr_xA+1, w ; Do the "F" Multiplication | |
282 mulwf isr_xB+1 | |
283 movf PRODL, w | |
284 addwf isr_xC+2, f | |
285 movf PRODH, w | |
286 addwfc isr_xC+3, f | |
287 return | |
161
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
288 |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
289 ;============================================================================= |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
290 ; 24bit shift, repeted WREG times. |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
291 ; Because we shift less than 8bits, and keep only C[2:1], we don't care what |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
292 ; bit is inserted... |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
293 ; |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
294 isr_shift_C31: |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
295 rrcf isr_xC+3,F ; Shift the three bytes... |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
296 rrcf isr_xC+2,F |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
297 rrcf isr_xC+1,F |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
298 decfsz WREG |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
299 bra isr_shift_C31 |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
300 return |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
301 |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
302 ;============================================================================= |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
303 ; s16 * s16 --> 32bit multiply (xA * xB --> xC) |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
304 ; Signed multiplication. |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
305 ; Code from... the Pic18F documentation ;-) |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
306 isr_unsigned_mult16x16: |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
307 MOVF isr_xA+0, W ; Lowest is simply a[0] * b[0] |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
308 MULWF isr_xB+0 |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
309 MOVFF PRODL, isr_xC+0 |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
310 MOVFF PRODH, isr_xC+1 |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
311 ; |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
312 MOVF isr_xA+1, W ; And highest a[1] * b[1] |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
313 MULWF isr_xB+1 |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
314 MOVFF PRODL, isr_xC+2 |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
315 MOVFF PRODH, isr_xC+3 |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
316 ; |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
317 MOVF isr_xA+0, W ; Intermediates do propagate: |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
318 MULWF isr_xB+1 |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
319 MOVF PRODL, W |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
320 ADDWF isr_xC+1, F ; Add cross products |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
321 MOVF PRODH, W |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
322 ADDWFC isr_xC+2, F ; with propagated carry |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
323 CLRF WREG |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
324 ADDWFC isr_xC+3, F ; on the three bytes. |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
325 ; |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
326 MOVF isr_xA+1, W ; And the second one, similarly. |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
327 MULWF isr_xB+0 |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
328 MOVF PRODL, W |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
329 ADDWF isr_xC+1, F ; Add cross products |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
330 MOVF PRODH, W |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
331 ADDWFC isr_xC+2, F |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
332 CLRF WREG |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
333 ADDWFC isr_xC+3, F |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
334 return |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
335 |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
336 isr_signed_mult16x16: |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
337 rcall isr_unsigned_mult16x16 |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
338 |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
339 ; Manage sign extension of operand B |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
340 BTFSS isr_xB+1,7 ; Is B negatif ? |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
341 BRA isr_signed_mult_checkA ; No: check ARG1 |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
342 MOVF isr_xA+0, W ; Yes: add -65536 * A |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
343 SUBWF isr_xC+2, F |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
344 MOVF isr_xA+1, W |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
345 SUBWFB isr_xC+3, F |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
346 ; And of operand A |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
347 isr_signed_mult_checkA |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
348 BTFSS isr_xA+1, 7 ; Is A negatif ? |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
349 RETURN ; No: done |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
350 MOVF isr_xB+0, W |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
351 SUBWF isr_xC+2, F |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
352 MOVF isr_xB+1, W |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
353 SUBWFB isr_xC+3, F |
8d6aca08f66b
Use signed arithmetic for pressure/temperature compensation.
JeanDo
parents:
105
diff
changeset
|
354 RETURN |