0
|
1 ;=============================================================================
|
|
2 ;
|
604
|
3 ; File math.inc REFACTORED VERSION V2.99d
|
0
|
4 ;
|
|
5 ;
|
|
6 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
|
|
7 ;=============================================================================
|
|
8 ; HISTORY
|
|
9 ; 2011-08-03 : [mH] moving from OSTC code
|
|
10
|
604
|
11 extern convert_time ; converts hi:lo in minutes to hours (up:hi) and minutes (lo)
|
|
12 ; also usable for conversion of seconds to minutes and seconds
|
|
13 ; trashes xA, xB, xC
|
|
14
|
|
15 extern div16 ; divA:2 = divA:2 / 2^WREG
|
|
16 ; trashes WREG
|
|
17
|
|
18 extern mult16 ; divA:2 = divA:2 * 2^WREG
|
|
19 ; trashes WREG
|
|
20
|
|
21 extern sub16 ; sub_c:2 = sub_a:2 - sub_b:2 with SIGNED values
|
|
22 ; sets neg_flag if result is < 0
|
|
23 ; trashes WREG
|
|
24
|
|
25 extern subU16 ; sub_c:2 = sub_a:2 - sub_b:2 with UNSIGNED values
|
|
26 ; sets neg_flag if result is < 0
|
|
27 ; trashes WREG
|
|
28
|
|
29 extern mult16x16 ; xC:4 = xA:2 * xB:2 with UNSIGNED values
|
|
30 ; trashes PRODL, PRODH, WREG
|
|
31
|
|
32 extern div16x16 ; xC:2 = xA:2 / xB:2 with xA as remainder
|
|
33 ; trashes xB, WREG
|
|
34
|
|
35 extern div32x16 ; xC:4 = xC:4 / xB:2 with xA as remainder
|
|
36 ; trashes WREG
|
|
37
|
|
38 extern isr_shift_C31 ; 24 bit shift, repeated WREG times,
|
|
39 ; dedicated to a specific usage
|
|
40
|
|
41 extern isr_unsigned_mult16x16 ; isr_xC = isr_xA * _isr_xB with UNSIGNED values
|
|
42 ; trashes PRODL, PRODH, WREG
|
|
43
|
|
44 extern isr_signed_mult16x16 ; isr_xC = isr_xA * _isr_xB with SIGNED values
|
|
45 ; trashes PRODL, PRODH, WREG
|