Mercurial > public > mk2
changeset 342:06299199dfb9
Fix bad max depth value (fix sub16 to avoid trashing sub_b).
author | JeanDo |
---|---|
date | Fri, 20 May 2011 01:34:59 +0200 |
parents | 2144f19fa1eb |
children | d5240792be51 |
files | code_part1/OSTC_code_asm_part1/divemode.asm code_part1/OSTC_code_asm_part1/math.asm code_part1/OSTC_code_asm_part1/pled_outputs.asm |
diffstat | 3 files changed, 14 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/divemode.asm Fri May 20 00:48:30 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/divemode.asm Fri May 20 01:34:59 2011 +0200 @@ -1436,16 +1436,16 @@ btfsc divemode call set_min_temp ; store min. temp if required - bcf temp_changed ; Display temperature? + bcf temp_changed ; Display temperature? SAFE_2BYTE_COPY temperature,lo movf lo,W cpfseq last_temperature+0 - bsf temp_changed ; Yes + bsf temp_changed ; Yes movf hi,W cpfseq last_temperature+1 - bsf temp_changed ; Yes + bsf temp_changed ; Yes btfsc temp_changed - call PLED_temp_divemode ; Displays temperature + call PLED_temp_divemode ; Displays temperature bcf pres_changed ; Display new depth? SAFE_2BYTE_COPY amb_pressure, lo @@ -1512,7 +1512,7 @@ clrf sub_a+1 SAFE_2BYTE_COPY rel_pressure, sub_b call sub16 ; sub_c = sub_a - sub_b - + btfss neg_flag bra set_dive_modes2 ; too shallow (rel_pressure<dive_threshold)
--- a/code_part1/OSTC_code_asm_part1/math.asm Fri May 20 00:48:30 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/math.asm Fri May 20 01:34:59 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
--- a/code_part1/OSTC_code_asm_part1/pled_outputs.asm Fri May 20 00:48:30 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/pled_outputs.asm Fri May 20 01:34:59 2011 +0200 @@ -2003,7 +2003,7 @@ movlw .039 cpfslt hi - bra maxdepth_greater_99_84mtr + bra maxdepth_greater_99_84mtr ; Display normal "xx.y" lfsr FSR2,letter