Mercurial > public > mk2
diff code_part1/OSTC_code_asm_part1/math.asm @ 344:797e2ac42d24 ScreenDump
MERGE with 1.91 main trunk.
author | JeanDo |
---|---|
date | Sat, 21 May 2011 14:48:07 +0200 |
parents | 06299199dfb9 |
children | cec312042b94 |
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/math.asm Tue May 17 01:05:04 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/math.asm Sat May 21 14:48:07 2011 +0200 @@ -53,23 +53,19 @@ movf sub_b+1, W ; Get the Value to be Subbed subwfb sub_a+1, W movwf sub_c+1 + btfsc STATUS,C return ; result positve -; sub_c = sub_a - sub_b + bsf neg_flag ; result negative - movff sub_c+0,sub_b+0 - movff sub_c+1,sub_b+1 - setf sub_a - setf sub_a+1 - 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 + + 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