comparison src/math.inc @ 634:4050675965ea

3.10 stable release
author heinrichsweikamp
date Tue, 28 Apr 2020 17:34:31 +0200
parents 185ba2f91f59
children 7d8a4c60ec1a
comparison
equal deleted inserted replaced
633:690c48db7b5b 634:4050675965ea
1 ;============================================================================= 1 ;=============================================================================
2 ; 2 ;
3 ; File math.inc combined next generation V3.08.8 3 ; File math.inc * combined next generation V3.09.4k
4 ; 4 ;
5 ; 5 ;
6 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. 6 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
7 ;============================================================================= 7 ;=============================================================================
8 ; HISTORY 8 ; HISTORY
9 ; 2011-08-03 : [mH] moving from OSTC code 9 ; 2011-08-03 : [mH] moving from OSTC code
10 10
11 extern convert_time ; convert minutes in hi:lo to hours (up:hi) and minutes (lo)
12 ; also usable for conversion of seconds to minutes and seconds
13 ; trashes xA, xB, xC
14 11
15 extern div16 ; divA:2 = divA:2 / 2^WREG SHIFT-RIGHT with UNSIGNED values 12 ;-----------------------------------------------------------------------------
13 ; SHIFT-RIGHT with UNSIGNED values
14 ;
15 extern div16 ; divA:2 = divA:2 / 2^WREG
16 ; trashes WREG 16 ; trashes WREG
17 17
18 extern mult16 ; divA:2 = divA:2 * 2^WREG SHIFT-LEFT with UNSIGNED values 18
19 ;-----------------------------------------------------------------------------
20 ; SHIFT-LEFT with UNSIGNED values
21 ;
22 extern mult16 ; divA:2 = divA:2 * 2^WREG
19 ; trashes WREG 23 ; trashes WREG
20 24
21 extern addU16 ; sub_c:2 = sub_a:2 + sub_b:2 ADDITION with UNSIGNED values 25
26 ;-----------------------------------------------------------------------------
27 ; ADDITION with UNSIGNED values
28 ;
29 extern addU16 ; sub_c:2 = sub_a:2 + sub_b:2
22 ; trashes WREG 30 ; trashes WREG
23 31
24 extern sub16 ; sub_c:2 = sub_a:2 - sub_b:2 SUBTRACTION with SIGNED values 32
33 ;-----------------------------------------------------------------------------
34 ; SUBTRACTION with SIGNED values
35 ;
36 extern sub16 ; sub_c:2 = sub_a:2 - sub_b:2
25 ; sets neg_flag if result is < 0 37 ; sets neg_flag if result is < 0
26 ; trashes WREG 38 ; trashes WREG
27 39
28 extern subU16 ; sub_c:2 = sub_a:2 - sub_b:2 SUBTRACTION with UNSIGNED values 40
41 ;-----------------------------------------------------------------------------
42 ; SUBTRACTION with UNSIGNED values
43 ;
44 extern subU16 ; sub_c:2 = sub_a:2 - sub_b:2
29 ; sets neg_flag if result is < 0 45 ; sets neg_flag if result is < 0
30 ; trashes WREG 46 ; trashes WREG
31 47
32 extern cmpU16 ; trashed = sub_a:2 - sub_b:2 COMPARE with UNSIGNED values 48
49 ;-----------------------------------------------------------------------------
50 ; COMPARE with UNSIGNED values
51 ;
52 extern cmpU16 ; trashed = sub_a:2 - sub_b:2
33 ; sets neg_flag if result is < 0, but does not store result itself 53 ; sets neg_flag if result is < 0, but does not store result itself
34 ; trashes WREG 54 ; trashes WREG
35 55
36 extern mult16x16 ; xC:4 = xA:2 * xB:2 MULTIPLICATION with UNSIGNED values 56
57 ;-----------------------------------------------------------------------------
58 ; MULTIPLICATION with UNSIGNED values
59 ;
60 extern mult16x16 ; xC:4 = xA:2 * xB:2
37 ; trashes PRODL, PRODH, WREG 61 ; trashes PRODL, PRODH, WREG
38 62
39 extern div16x16 ; xC:2 = xA:2 / xB:2 with xA as remainder DIVISION with UNSIGNED values 63
64 ;-----------------------------------------------------------------------------
65 ; DIVISION with UNSIGNED values
66 ;
67 extern div16x16 ; xC:2 = xA:2 / xB:2 with xA as remainder
40 ; trashes xB, WREG 68 ; trashes xB, WREG
41 69
42 extern div32x16 ; xC:4 = xC:4 / xB:2 with xA as remainder DIVISION with UNSIGNED values 70
71 ;-----------------------------------------------------------------------------
72 ; DIVISION with UNSIGNED values
73 ;
74 extern div32x16 ; xC:4 = xC:4 / xB:2 with xA as remainder
43 ; trashes WREG 75 ; trashes WREG
44 76
45 extern isr_shift_C31 ; 24 bit shift, repeated WREG times, dedicated to a specific usage 77
78 ;-----------------------------------------------------------------------------
79 ; Math Functions specific for Use by ISR
80 ;-----------------------------------------------------------------------------
81
82 ;-----------------------------------------------------------------------------
83 ; 24 bit shift, repeated WREG times, dedicated to a specific usage
84 ;
85 extern isr_shift_C31
46 86
47 87
48 extern isr_unsigned_mult16x16 ; isr_xC = isr_xA * isr_xB MULTIPLICATION with UNSIGNED values ** for ISR only ** 88 ;-----------------------------------------------------------------------------
89 ; MULTIPLICATION with UNSIGNED values
90 ;
91 extern isr_unsigned_mult16x16 ; isr_xC = isr_xA * isr_xB
49 ; trashes PRODL, PRODH, WREG 92 ; trashes PRODL, PRODH, WREG
50 93
51 extern isr_signed_mult16x16 ; isr_xC = isr_xA * isr_xB MULTIPLICATION with SIGNED values ** for ISR only ** 94
95 ;-----------------------------------------------------------------------------
96 ; MULTIPLICATION with SIGNED values
97 ;
98 extern isr_signed_mult16x16 ; isr_xC = isr_xA * isr_xB
52 ; trashes PRODL, PRODH, WREG 99 ; trashes PRODL, PRODH, WREG
100
101 ;-----------------------------------------------------------------------------