Mercurial > public > hwos_code
diff src/math.inc @ 634:4050675965ea
3.10 stable release
author | heinrichsweikamp |
---|---|
date | Tue, 28 Apr 2020 17:34:31 +0200 |
parents | 185ba2f91f59 |
children | 7d8a4c60ec1a |
line wrap: on
line diff
--- a/src/math.inc Thu Mar 05 15:06:14 2020 +0100 +++ b/src/math.inc Tue Apr 28 17:34:31 2020 +0200 @@ -1,6 +1,6 @@ ;============================================================================= ; -; File math.inc combined next generation V3.08.8 +; File math.inc * combined next generation V3.09.4k ; ; ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. @@ -8,45 +8,94 @@ ; HISTORY ; 2011-08-03 : [mH] moving from OSTC code - extern convert_time ; convert minutes in hi:lo to hours (up:hi) and minutes (lo) - ; also usable for conversion of seconds to minutes and seconds - ; trashes xA, xB, xC - extern div16 ; divA:2 = divA:2 / 2^WREG SHIFT-RIGHT with UNSIGNED values +;----------------------------------------------------------------------------- +; SHIFT-RIGHT with UNSIGNED values +; + extern div16 ; divA:2 = divA:2 / 2^WREG ; trashes WREG - extern mult16 ; divA:2 = divA:2 * 2^WREG SHIFT-LEFT with UNSIGNED values + +;----------------------------------------------------------------------------- +; SHIFT-LEFT with UNSIGNED values +; + extern mult16 ; divA:2 = divA:2 * 2^WREG ; trashes WREG - extern addU16 ; sub_c:2 = sub_a:2 + sub_b:2 ADDITION with UNSIGNED values + +;----------------------------------------------------------------------------- +; ADDITION with UNSIGNED values +; + extern addU16 ; sub_c:2 = sub_a:2 + sub_b:2 ; trashes WREG - extern sub16 ; sub_c:2 = sub_a:2 - sub_b:2 SUBTRACTION with SIGNED values + +;----------------------------------------------------------------------------- +; SUBTRACTION with SIGNED values +; + extern sub16 ; sub_c:2 = sub_a:2 - sub_b:2 ; sets neg_flag if result is < 0 ; trashes WREG - extern subU16 ; sub_c:2 = sub_a:2 - sub_b:2 SUBTRACTION with UNSIGNED values + +;----------------------------------------------------------------------------- +; SUBTRACTION with UNSIGNED values +; + extern subU16 ; sub_c:2 = sub_a:2 - sub_b:2 ; sets neg_flag if result is < 0 ; trashes WREG - extern cmpU16 ; trashed = sub_a:2 - sub_b:2 COMPARE with UNSIGNED values + +;----------------------------------------------------------------------------- +; COMPARE with UNSIGNED values +; + extern cmpU16 ; trashed = sub_a:2 - sub_b:2 ; sets neg_flag if result is < 0, but does not store result itself ; trashes WREG - extern mult16x16 ; xC:4 = xA:2 * xB:2 MULTIPLICATION with UNSIGNED values + +;----------------------------------------------------------------------------- +; MULTIPLICATION with UNSIGNED values +; + extern mult16x16 ; xC:4 = xA:2 * xB:2 ; trashes PRODL, PRODH, WREG - extern div16x16 ; xC:2 = xA:2 / xB:2 with xA as remainder DIVISION with UNSIGNED values + +;----------------------------------------------------------------------------- +; DIVISION with UNSIGNED values +; + extern div16x16 ; xC:2 = xA:2 / xB:2 with xA as remainder ; trashes xB, WREG - extern div32x16 ; xC:4 = xC:4 / xB:2 with xA as remainder DIVISION with UNSIGNED values + +;----------------------------------------------------------------------------- +; DIVISION with UNSIGNED values +; + extern div32x16 ; xC:4 = xC:4 / xB:2 with xA as remainder ; trashes WREG - extern isr_shift_C31 ; 24 bit shift, repeated WREG times, dedicated to a specific usage + +;----------------------------------------------------------------------------- +; Math Functions specific for Use by ISR +;----------------------------------------------------------------------------- + +;----------------------------------------------------------------------------- +; 24 bit shift, repeated WREG times, dedicated to a specific usage +; + extern isr_shift_C31 - extern isr_unsigned_mult16x16 ; isr_xC = isr_xA * isr_xB MULTIPLICATION with UNSIGNED values ** for ISR only ** +;----------------------------------------------------------------------------- +; MULTIPLICATION with UNSIGNED values +; + extern isr_unsigned_mult16x16 ; isr_xC = isr_xA * isr_xB ; trashes PRODL, PRODH, WREG - extern isr_signed_mult16x16 ; isr_xC = isr_xA * isr_xB MULTIPLICATION with SIGNED values ** for ISR only ** + +;----------------------------------------------------------------------------- +; MULTIPLICATION with SIGNED values +; + extern isr_signed_mult16x16 ; isr_xC = isr_xA * isr_xB ; trashes PRODL, PRODH, WREG + +;----------------------------------------------------------------------------- \ No newline at end of file