0
|
1 ;=============================================================================
|
|
2 ;
|
631
|
3 ; File math.inc combined next generation V3.08.8
|
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
|
631
|
11 extern convert_time ; convert minutes in hi:lo to hours (up:hi) and minutes (lo)
|
604
|
12 ; also usable for conversion of seconds to minutes and seconds
|
|
13 ; trashes xA, xB, xC
|
|
14
|
631
|
15 extern div16 ; divA:2 = divA:2 / 2^WREG SHIFT-RIGHT with UNSIGNED values
|
604
|
16 ; trashes WREG
|
|
17
|
631
|
18 extern mult16 ; divA:2 = divA:2 * 2^WREG SHIFT-LEFT with UNSIGNED values
|
604
|
19 ; trashes WREG
|
|
20
|
631
|
21 extern addU16 ; sub_c:2 = sub_a:2 + sub_b:2 ADDITION with UNSIGNED values
|
628
|
22 ; trashes WREG
|
|
23
|
631
|
24 extern sub16 ; sub_c:2 = sub_a:2 - sub_b:2 SUBTRACTION with SIGNED values
|
604
|
25 ; sets neg_flag if result is < 0
|
|
26 ; trashes WREG
|
|
27
|
631
|
28 extern subU16 ; sub_c:2 = sub_a:2 - sub_b:2 SUBTRACTION with UNSIGNED values
|
604
|
29 ; sets neg_flag if result is < 0
|
|
30 ; trashes WREG
|
|
31
|
631
|
32 extern cmpU16 ; trashed = sub_a:2 - sub_b:2 COMPARE with UNSIGNED values
|
623
|
33 ; sets neg_flag if result is < 0, but does not store result itself
|
|
34 ; trashes WREG
|
|
35
|
631
|
36 extern mult16x16 ; xC:4 = xA:2 * xB:2 MULTIPLICATION with UNSIGNED values
|
604
|
37 ; trashes PRODL, PRODH, WREG
|
|
38
|
631
|
39 extern div16x16 ; xC:2 = xA:2 / xB:2 with xA as remainder DIVISION with UNSIGNED values
|
604
|
40 ; trashes xB, WREG
|
|
41
|
631
|
42 extern div32x16 ; xC:4 = xC:4 / xB:2 with xA as remainder DIVISION with UNSIGNED values
|
604
|
43 ; trashes WREG
|
|
44
|
631
|
45 extern isr_shift_C31 ; 24 bit shift, repeated WREG times, dedicated to a specific usage
|
604
|
46
|
631
|
47
|
|
48 extern isr_unsigned_mult16x16 ; isr_xC = isr_xA * isr_xB MULTIPLICATION with UNSIGNED values ** for ISR only **
|
604
|
49 ; trashes PRODL, PRODH, WREG
|
|
50
|
631
|
51 extern isr_signed_mult16x16 ; isr_xC = isr_xA * isr_xB MULTIPLICATION with SIGNED values ** for ISR only **
|
604
|
52 ; trashes PRODL, PRODH, WREG
|