changeset 145:8bda2452a532

FIX bad mix icon when active gas in not G1.
author JeanDo
date Sun, 09 Jan 2011 11:45:20 +0100
parents 4c961f1a1536
children c09b0be2e1e6
files code_part1/OSTC_code_asm_part1/dive_icons.asm
diffstat 1 files changed, 17 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- 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.