comparison code_part1/OSTC_code_asm_part1/dive_icons.asm @ 145:8bda2452a532

FIX bad mix icon when active gas in not G1.
author JeanDo
date Sun, 09 Jan 2011 11:45:20 +0100
parents 6a94f96e9cea
children 420e62cd88ad
comparison
equal deleted inserted replaced
144:4c961f1a1536 145:8bda2452a532
54 movff WREG, win_leftx2 54 movff WREG, win_leftx2
55 movlw UPPER(dive_air_block) 55 movlw UPPER(dive_air_block)
56 movwf TBLPTRU 56 movwf TBLPTRU
57 57
58 ;---- Explore gas list ------------------------------------------- 58 ;---- Explore gas list -------------------------------------------
59 ; EEADR <-- gas# + 6 59 ; EEADR <-- 4*gas# + 6
60 ; EEADR-2 = default O2% 60 ; EEADR-2 = default O2%
61 ; EEADR-1 = default He% 61 ; EEADR-1 = default He%
62 ; EEADR+0 = current O2% 62 ; EEADR+0 = current O2%
63 ; EEADR+1 = current He% 63 ; EEADR+1 = current He%
64 ; EEADR+4 = next gaz current O2% 64 ; EEADR+4 = next gaz current O2%
65 65
66 read_int_eeprom d'27' ; read gas flag register --> hi 66 clrf EEADRH ; read gas flag register --> hi
67 movlw .27
68 movwf EEADR
69 call read_eeprom
67 movff EEDATA,hi 70 movff EEDATA,hi
68 rrcf hi ; Dummy shift first... why does it works ? 71 rlcf hi,F ; Push a dummy bit.
69 setf lo ; Start with gas# -1 72 setf lo ; Start with gas# -1
70 clrf PRODL ; =0 : no nitrox found yet. 73 clrf PRODL ; =0 : no nitrox found yet.
71
72 dive_type_loop:
73 incf lo,F ; Next gaz number.
74 74
75 movlw .33 ; Read first gas #. 75 movlw .33 ; Read first gas #.
76 movwf EEADR 76 movwf EEADR
77 call read_eeprom 77 call read_eeprom
78 movff EEDATA,PRODH ; first --> PRODH (1..5)
79
80 dive_type_loop:
81 incf lo,F ; Next gaz number. Range 0..4
82
83 rrcf hi,F ; Rotate BEFORE checking active gas!
84
78 incf lo,W ; Current gas# 1..5 85 incf lo,W ; Current gas# 1..5
79 subwf EEDATA,W ; == first ? 86 subwf PRODH,W ; == first gas ?
80 bz dive_type_loop_2 ; YES: analyse that gas ! 87 bz dive_type_loop_2 ; YES: analyse that gas !
88
89 btfss hi,0 ; Is this gas enabled ?
90 bra dive_type_loop_9 ; No: disabled.
81 91
82 rrcf hi ; Check next enabled flag ?
83 bnc dive_type_loop_9 ; Disabled.
84
85 movlw .28 ; Switch depth is at gas#+28 92 movlw .28 ; Switch depth is at gas#+28
86 addwf lo,W 93 addwf lo,W
87 movwf EEADR ; address in EEPROM. 94 movwf EEADR ; address in EEPROM.
88 call read_eeprom ; Read depth 95 call read_eeprom ; Read depth
89 clrf WREG 96 clrf WREG