Mercurial > public > mk2
diff code_part1/OSTC_code_asm_part1/math.asm @ 426:07f5b0baaa57
Adding temperature & ceiling curves
* Pink Temperature curve, using fixed scale minTp .. minTp+10.0?C.
* Vertical line fill for ceiling.
* Dark red coloring when overflowing ceiling, dark green if ok.
author | JeanDo |
---|---|
date | Sun, 31 Jul 2011 13:27:23 +0200 |
parents | cec312042b94 |
children | 7779bfa89171 |
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/math.asm Sun Jul 31 13:27:20 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/math.asm Sun Jul 31 13:27:23 2011 +0200 @@ -45,7 +45,7 @@ return sub16: -; sub_c = sub_a - sub_b +; sub_c = sub_a - sub_b (with signed values) bcf neg_flag movf sub_b+0, W ; Get Value to be subtracted subwf sub_a+0, W ; Do the High Byte @@ -66,6 +66,28 @@ return +subU16: +; sub_c = sub_a - sub_b (with UNSIGNED values) + bcf neg_flag + movf sub_b+0, W ; Get Value to be subtracted + subwf sub_a+0, W ; Do the High Byte + movwf sub_c+0 + movf sub_b+1, W ; Get the Value to be Subbed + subwfb sub_a+1, W + movwf sub_c+1 + + btfsc STATUS,C ; Borrow to propagate ? (B == /CARRY) + return ; NO: result positive done. + + bsf neg_flag ; MARK result negative + + comf sub_c+1 ; 16bit sign change. + negf sub_c+0 + btfsc STATUS,C ; Carry to propagate ? + incf sub_c+1,F ; YES: do it. + + return + mult16x16: ;xA*xB=xC clrf xC+2 ; Clear the High-Order Bits clrf xC+3