Mercurial > public > mk2
comparison code_part1/OSTC_code_asm_part1/math.asm @ 354:cec312042b94
Fix sub16 neg detect (related to bug #44)
author | JeanDo |
---|---|
date | Tue, 07 Jun 2011 03:55:27 +0200 |
parents | 06299199dfb9 |
children | 07f5b0baaa57 |
comparison
equal
deleted
inserted
replaced
353:b5b030c1ae7e | 354:cec312042b94 |
---|---|
52 movwf sub_c+0 | 52 movwf sub_c+0 |
53 movf sub_b+1, W ; Get the Value to be Subbed | 53 movf sub_b+1, W ; Get the Value to be Subbed |
54 subwfb sub_a+1, W | 54 subwfb sub_a+1, W |
55 movwf sub_c+1 | 55 movwf sub_c+1 |
56 | 56 |
57 btfsc STATUS,C | 57 btfss STATUS,N ; Negativ result ? |
58 return ; result positve | 58 return ; NO: result positive done. |
59 | 59 |
60 bsf neg_flag ; result negative | 60 bsf neg_flag ; MARK result negative |
61 | 61 |
62 comf sub_c+1 ; 16bit sign change. | 62 comf sub_c+1 ; 16bit sign change. |
63 negf sub_c+0 | 63 negf sub_c+0 |
64 btfsc STATUS,C ; Carry to propagate ? | 64 btfsc STATUS,C ; Carry to propagate ? |
65 incf sub_c+1,F ; YES: do it. | 65 incf sub_c+1,F ; YES: do it. |