# HG changeset patch # User JeanDo # Date 1294569920 -3600 # Node ID 8bda2452a53260b3f3e3c5b473bd41cb0f5942af # Parent 4c961f1a15363e6dffab3185f1dc6ef441bbdf28 FIX bad mix icon when active gas in not G1. diff -r 4c961f1a1536 -r 8bda2452a532 code_part1/OSTC_code_asm_part1/dive_icons.asm --- a/code_part1/OSTC_code_asm_part1/dive_icons.asm Fri Jan 07 16:46:40 2011 +0100 +++ b/code_part1/OSTC_code_asm_part1/dive_icons.asm Sun Jan 09 11:45:20 2011 +0100 @@ -56,32 +56,39 @@ movwf TBLPTRU ;---- Explore gas list ------------------------------------------- - ; EEADR <-- gas# + 6 + ; EEADR <-- 4*gas# + 6 ; EEADR-2 = default O2% ; EEADR-1 = default He% ; EEADR+0 = current O2% ; EEADR+1 = current He% ; EEADR+4 = next gaz current O2% - read_int_eeprom d'27' ; read gas flag register --> hi + clrf EEADRH ; read gas flag register --> hi + movlw .27 + movwf EEADR + call read_eeprom movff EEDATA,hi - rrcf hi ; Dummy shift first... why does it works ? + rlcf hi,F ; Push a dummy bit. setf lo ; Start with gas# -1 clrf PRODL ; =0 : no nitrox found yet. -dive_type_loop: - incf lo,F ; Next gaz number. - movlw .33 ; Read first gas #. movwf EEADR call read_eeprom + movff EEDATA,PRODH ; first --> PRODH (1..5) + +dive_type_loop: + incf lo,F ; Next gaz number. Range 0..4 + + rrcf hi,F ; Rotate BEFORE checking active gas! + incf lo,W ; Current gas# 1..5 - subwf EEDATA,W ; == first ? + subwf PRODH,W ; == first gas ? bz dive_type_loop_2 ; YES: analyse that gas ! + + btfss hi,0 ; Is this gas enabled ? + bra dive_type_loop_9 ; No: disabled. - rrcf hi ; Check next enabled flag ? - bnc dive_type_loop_9 ; Disabled. - movlw .28 ; Switch depth is at gas#+28 addwf lo,W movwf EEADR ; address in EEPROM.