annotate src/gaslist.asm @ 582:b455b31ce022

work on 2.97 stable
author heinrichsweikamp
date Mon, 26 Feb 2018 16:40:28 +0100
parents b7eb98dbd800
children ca4556fb60b9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
heinrichsweikamp
parents:
diff changeset
1 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
2 ;
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
3 ; File gaslist.asm ## V2.98
0
heinrichsweikamp
parents:
diff changeset
4 ;
275
653a3ab08062 rename into hwOS
heinrichsweikamp
parents: 225
diff changeset
5 ; Managing OSTC gas list
0
heinrichsweikamp
parents:
diff changeset
6 ;
heinrichsweikamp
parents:
diff changeset
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
heinrichsweikamp
parents:
diff changeset
8 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
9 ; HISTORY
heinrichsweikamp
parents:
diff changeset
10 ; 2011-08-11 : [jDG] Creation.
heinrichsweikamp
parents:
diff changeset
11
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
12 #include "hwos.inc" ; Mandatory header
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
13 #include "convert.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
14 #include "math.inc" ; div16x16 for MOD calculations
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
15 #include "strings.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
16 #include "tft.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
17 #include "tft_outputs.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
18 #include "shared_definitions.h"
0
heinrichsweikamp
parents:
diff changeset
19
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
20 extern convert_mbar_to_feet
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
21 extern customview_show_mix
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
22 extern tGasDisabled
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
23 extern tDilDisabled
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
24 extern tbar
0
heinrichsweikamp
parents:
diff changeset
25
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
26 gui CODE
0
heinrichsweikamp
parents:
diff changeset
27
heinrichsweikamp
parents:
diff changeset
28 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
29 ; Append gas description to current string.
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
30 ; Input: PRODL : gas number (0..4)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
31 ; FSR2 : Current string position.
0
heinrichsweikamp
parents:
diff changeset
32 ; Output: Text appended into buffer pointed by FSR2.
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
33
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
34 global gaslist_strcat_gas
0
heinrichsweikamp
parents:
diff changeset
35 gaslist_strcat_gas:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
36 rcall gaslist_setgas ; Sets gaslist_gas (0-4 for OC/Bailout, 5-9 for Diluents)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
37 ; Retrieve gas definition:
0
heinrichsweikamp
parents:
diff changeset
38 gaslist_strcat_gas_0:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
39 movf gaslist_gas,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
40 lfsr FSR1,opt_gas_O2_ratio ; Read opt_gas_O2_ratio[WREG]
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
41 movff PLUSW1,lo ; O2 ratio
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
42 ;movf gaslist_gas,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
43 lfsr FSR1,opt_gas_He_ratio ; Read opt_gas_He_ratio[WREG]
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
44 movff PLUSW1,hi ; He ratio
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
45 goto customview_show_mix ; Put "Nxlo", "Txlo/hi", "Air" or "O2" into Postinc2, and RETURN
0
heinrichsweikamp
parents:
diff changeset
46
heinrichsweikamp
parents:
diff changeset
47 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
48 ; Append current mix to current string (For divemode)
heinrichsweikamp
parents:
diff changeset
49 ; Input: FSR2 : Current string position.
heinrichsweikamp
parents:
diff changeset
50 ; Output: Text appended into buffer pointed by FSR2.
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
51 global gaslist_strcat_gas6
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
52 gaslist_strcat_gas6: ; Show current O2/He mix
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
53 STRCAT_TEXT tGas
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
54 STRCAT ": "
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
55 movff gas6_O2_ratio,lo
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
56 movff gas6_He_ratio,hi
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
57 goto customview_show_mix ; Put "Nxlo", "Txlo/hi", "Air" or "O2" into Postinc2, and RETURN
0
heinrichsweikamp
parents:
diff changeset
58
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
59
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
60 global gaslist_show_type
0
heinrichsweikamp
parents:
diff changeset
61 gaslist_show_type:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
62 movf gaslist_gas,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
63 lfsr FSR1,opt_gas_type ; Read opt_gas_type[WREG]
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
64 movff PLUSW1,lo ; lo holds gas type
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
65 STRCAT_TEXT tType
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
66 lfsr FSR1,tGasDisabled ; Base text number
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
67 btfsc ccr_diluent_setup ; In CCR setup?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
68 lfsr FSR1,tDilDisabled ; Base text number
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
69 movff lo,WREG ; 0-3
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
70 rlncf WREG ; x2
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
71 addwf FSR1L,F
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
72 movlw .0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
73 addwfc FSR1H,F
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
74 call strcat_text
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
75 return
0
heinrichsweikamp
parents:
diff changeset
76
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
77 global gaslist_toggle_type
0
heinrichsweikamp
parents:
diff changeset
78 gaslist_toggle_type:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
79 movf gaslist_gas,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
80 lfsr FSR1,opt_gas_type ; Read opt_gas_type[WREG]
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
81 movff PLUSW1,lo ; lo holds gas type
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
82 incf lo,F ; 0-3/0-2
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
83 btfsc ccr_diluent_setup ; In CCR setup?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
84 bra gaslist_toggle_type2 ; Yes
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
85 btfsc lo,2 ; >3?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
86 clrf lo ; Clear to zero
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
87 movff lo,PLUSW1 ; Copy back result
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
88 return
0
heinrichsweikamp
parents:
diff changeset
89 gaslist_toggle_type2:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
90 movlw .3
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
91 cpfslt lo ; >2?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
92 clrf lo ; Clear to zero
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
93 movf gaslist_gas,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
94 movff lo,PLUSW1 ; Copy back result
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
95 return
0
heinrichsweikamp
parents:
diff changeset
96
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
97 global gaslist_setSP
0
heinrichsweikamp
parents:
diff changeset
98 gaslist_setSP:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
99 movff PRODL,gaslist_gas ; 0-4
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
100 return
0
heinrichsweikamp
parents:
diff changeset
101
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
102
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
103 global gaslist_strcat_setpoint
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
104 global gaslist_strcat_setpoint_0
0
heinrichsweikamp
parents:
diff changeset
105 gaslist_strcat_setpoint:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
106 call gaslist_setSP
0
heinrichsweikamp
parents:
diff changeset
107 gaslist_strcat_setpoint_0:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
108 bsf leftbind
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
109 btfsc short_gas_decriptions ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
110 bra gaslist_strcat_setpoint2 ; Short version
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
111 STRCAT_TEXT tSP
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
112 incf gaslist_gas,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
113 movwf lo
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
114 output_8
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
115 bcf leftbind
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
116 PUTC ":"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
117 gaslist_strcat_setpoint2: ; Short version
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
118 btfsc divemode
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
119 bra gaslist_strcat_setpoint4 ; no "*" in divemode
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
120 movf gaslist_gas,W ; Number-1 into WREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
121 bnz gaslist_strcat_setpoint3 ; Not SP1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
122 PUTC "*"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
123 bra gaslist_strcat_setpoint4
0
heinrichsweikamp
parents:
diff changeset
124 gaslist_strcat_setpoint3:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
125 PUTC " "
0
heinrichsweikamp
parents:
diff changeset
126 gaslist_strcat_setpoint4:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
127 movf gaslist_gas,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
128 lfsr FSR1,char_I_setpoint_cbar
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
129 movf PLUSW1,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
130 movwf lo
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
131 clrf hi
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
132 bsf leftbind
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
133 output_16dp d'3'
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
134 btfsc divemode
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
135 bra gaslist_strcat_setpoint5 ; Skip text in divemode
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
136 STRCAT_TEXT tbar
0
heinrichsweikamp
parents:
diff changeset
137 gaslist_strcat_setpoint5:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
138 PUTC " "
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
139 ; Read switch depth
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
140 movf gaslist_gas,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
141 lfsr FSR1,char_I_setpoint_change
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
142 movff PLUSW1,lo
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
143
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
144 bsf ccr_diluent_setup ; inhibit output of "----" for depth
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
145 call gaslist_strcat_5
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
146 bcf ccr_diluent_setup
534
a7ac5d3fd046 Setpoint Change Depth Fix
heinrichsweikamp
parents: 532
diff changeset
147 return
0
heinrichsweikamp
parents:
diff changeset
148
heinrichsweikamp
parents:
diff changeset
149 ;----------------------------------------------------------------------------
heinrichsweikamp
parents:
diff changeset
150 ; Append gas description to current string.
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
151 ; Input: PRODL : gas number (0..4)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
152 ; FSR2 : Current string position.
0
heinrichsweikamp
parents:
diff changeset
153 ; Output: Text appended into buffer pointed by FSR2.
heinrichsweikamp
parents:
diff changeset
154 ;
heinrichsweikamp
parents:
diff changeset
155 ; NOTE: used in the menu-tree for the MENU_CALLBACK entry.
heinrichsweikamp
parents:
diff changeset
156
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
157 gaslist_strcat_gas_better: ; Yes, check if this is a "better gas"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
158 bcf win_invert
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
159 movff better_gas_number,WREG ; get better gas number into WREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
160 decf WREG,W ; better_gas_number = better_gas_number -1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
161 btfsc ccr_diluent_setup ; in CCR menus?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
162 addlw .5 ; Yes, offset to gases 5-9
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
163 cpfseq gaslist_gas ; 0-4 for OC/Bailout, 5-9 for Diluents
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
164 return
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
165 call TFT_attention_color ; show in yellow
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
166 bsf win_invert ; And invert
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
167 return
0
heinrichsweikamp
parents:
diff changeset
168
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
169 global gaslist_strcat_gas_mod
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
170 gaslist_strcat_gas_mod:
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
171 rcall gaslist_setgas ; Sets gaslist_gas (0-4 for OC/Bailout, 5-9 for Diluents)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
172 bsf space_gas_decriptions ; add a space in front for gas numbers < 10 for alignment
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
173 ;bra gaslist_gastitle
97
53a99a2dc6a1 CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents: 95
diff changeset
174
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
175 global gaslist_gastitle
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
176 gaslist_gastitle:
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
177 btfsc short_gas_decriptions ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
178 bra gaslist_gastitle1 ; Short version
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
179 STRCAT_TEXT tGas
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
180 incf gaslist_gas,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
181 movwf lo
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
182 btfss space_gas_decriptions ; add a space in front for gas numbers < 10 for alignment?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
183 bra gaslist_gastitle0 ; NO
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
184 bcf space_gas_decriptions ; YES - clear flag again
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
185 movlw .10 ; load a 10
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
186 cpfslt lo ; gas# < 10 ?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
187 bra gaslist_gastitle0 ; NO
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
188 PUTC " " ; YES - add a space
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
189 gaslist_gastitle0:
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
190 bsf leftbind
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
191 output_8
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
192 bcf leftbind
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
193 PUTC ":"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
194 gaslist_gastitle1:
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
195 lfsr FSR1,opt_gas_type
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
196 btfsc divemode
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
197 bra gaslist_gastitle3 ; no "*" in divemode
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
198 movf gaslist_gas,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
199 decf PLUSW1,W ; Type-1 into WREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
200 bnz gaslist_gastitle2 ; Not "First"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
201 PUTC "*"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
202 bra gaslist_gastitle3
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
203 gaslist_gastitle2:
540
9a17b1db095b Re-insert Rev. 530 changes into gaslist.asm
heinrichsweikamp
parents: 534
diff changeset
204 PUTC " "
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
205 gaslist_gastitle3:
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
206 call TFT_standard_color
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
207 btfsc divemode ; In divemode?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
208 rcall gaslist_strcat_gas_better ; Yes, check if this is a "better gas"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
209 movf gaslist_gas,W ; (0-4 for OC/Bailout, 5-9 for Diluents)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
210 movf PLUSW1,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
211 bnz gaslist_strcat_3
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
212 call TFT_disabled_color
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
213 bra gaslist_strcat_4 ; no MOD-check and red color for disabled gases
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
214 gaslist_strcat_3:
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
215 rcall gaslist_strcat_gas_0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
216 PUTC " "
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
217 ; Read switch depth
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
218 lfsr FSR1,char_I_dil_change-.5 ; Setup Diluents-5
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
219 movlw .4
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
220 cpfsgt gaslist_gas ; >4? (-> Diluents)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
221 lfsr FSR1,opt_OC_bail_gas_change ; Setup OC Gases
540
9a17b1db095b Re-insert Rev. 530 changes into gaslist.asm
heinrichsweikamp
parents: 534
diff changeset
222
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
223 movf gaslist_gas,W ; (0-4 for OC/Bailout, 5-9 for Diluents)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
224 movff PLUSW1,lo
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
225 rcall gaslist_calc_mod ; Compute MOD into WREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
226 cpfsgt lo ; within MOD range?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
227 bra gaslist_strcat_5 ; YES
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
228 call TFT_warnings_color ; NO - turn red
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
229 bra gaslist_strcat_5 ; skip gaslist_strcat_gas_0 here
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
230 gaslist_strcat_4:
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
231 rcall gaslist_strcat_gas_0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
232 PUTC " "
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
233 ; Dummy code, needs some cleanup someday...
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
234 ; Read switch depth
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
235 lfsr FSR1,char_I_dil_change-.5 ; Setup Diluents-5
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
236 movlw .4
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
237 cpfsgt gaslist_gas ; >4? (-> Diluents)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
238 lfsr FSR1,opt_OC_bail_gas_change ; Setup OC Gases
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
239 movf gaslist_gas,W ; (0-4 for OC/Bailout, 5-9 for Diluents)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
240 movff PLUSW1,lo
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
241 rcall gaslist_calc_mod ; Compute MOD into WREG
521
06e9370c6d75 CHANGE: Apply safety margin parameters to both models (GF and non-GF)
heinrichsweikamp
parents: 518
diff changeset
242 gaslist_strcat_5:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
243 PUTC " "
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
244 TSTOSS opt_units ; 0=Meter, 1=Feet
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
245 bra gaslist_strcat_3_metric
0
heinrichsweikamp
parents:
diff changeset
246 ;gaslist_strcat_3_imperial:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
247 btfsc ccr_diluent_setup ; =1: Setting up Diluents ("Gas6-10")
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
248 bra gaslist_imperial_non_travel
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
249 movf gaslist_gas,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
250 lfsr FSR1,opt_gas_type ; Read opt_gas_type[WREG]
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
251 movff PLUSW1,up ; up holds gas type
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
252 movlw .2 ; 2=Travel
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
253 cpfseq up ; compare gas type with type 2=Travel
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
254 bra gaslist_imperial_non_travel ; Non-Travel Gas
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
255 bra gaslist_strcat_depth_travel ; Show "---" instead of "0m"...
540
9a17b1db095b Re-insert Rev. 530 changes into gaslist.asm
heinrichsweikamp
parents: 534
diff changeset
256 gaslist_imperial_non_travel:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
257 movf lo,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
258 mullw .100 ; convert meters to mbar
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
259 movff PRODL,lo
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
260 movff PRODH,hi
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
261 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
262 bsf leftbind
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
263 output_16_3 ; limit to 999 and display only (0-999)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
264 STRCAT_TEXT tFeets ; "ft"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
265 return
0
heinrichsweikamp
parents:
diff changeset
266 gaslist_strcat_3_metric:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
267 btfsc ccr_diluent_setup ; =1: Setting up Diluents ("Gas6-10")
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
268 bra gaslist_metric_non_travel
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
269 movf gaslist_gas,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
270 lfsr FSR1,opt_gas_type ; Read opt_gas_type[WREG]
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
271 movff PLUSW1,up ; up holds gas type
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
272 movlw .2 ; 2=Travel
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
273 cpfseq up ; compare gas type with type 2=Travel
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
274 bra gaslist_metric_non_travel ; Non-Travel Gas
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
275 gaslist_strcat_depth_travel: ; Show "---" instead of "0m"...
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
276 STRCAT "---"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
277 return
540
9a17b1db095b Re-insert Rev. 530 changes into gaslist.asm
heinrichsweikamp
parents: 534
diff changeset
278 gaslist_metric_non_travel:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
279 output_99
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
280 STRCAT_TEXT tMeters ; "m"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
281 return
0
heinrichsweikamp
parents:
diff changeset
282
heinrichsweikamp
parents:
diff changeset
283 ;----------------------------------------------------------------------------
heinrichsweikamp
parents:
diff changeset
284 ; Store current menu item, and display gas description later.
heinrichsweikamp
parents:
diff changeset
285 ; Input: PRODL : gas number (0..4)
heinrichsweikamp
parents:
diff changeset
286 ; NOTE: used in the menu-tree for the MENU_CALLBACK entry.
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
287
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
288 global gaslist_setgas
0
heinrichsweikamp
parents:
diff changeset
289 gaslist_setgas:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
290 movff PRODL,gaslist_gas
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
291 movlw .5
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
292 btfsc ccr_diluent_setup ; in CCR menus?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
293 addwf gaslist_gas,F ; Yes, offset to gases 5-9
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
294 return
0
heinrichsweikamp
parents:
diff changeset
295
heinrichsweikamp
parents:
diff changeset
296
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
297 global gaslist_cleanup_list ; Takes care that only one gas can be first and first has 0m change depth
0
heinrichsweikamp
parents:
diff changeset
298 gaslist_cleanup_list:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
299 bcf ignore_last_edited_gas
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
300 movlw .0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
301 btfsc ccr_diluent_setup ; In CCR-Menu?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
302 addlw .5 ; Yes, adjust offset
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
303 subwf gaslist_gas,F
0
heinrichsweikamp
parents:
diff changeset
304 gaslist_cleanup_list1:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
305 clrf lo
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
306 lfsr FSR1,opt_gas_type ; Read opt_gas_type[WREG]
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
307 movlw .5 ; Check 5 gases
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
308 movwf hi
0
heinrichsweikamp
parents:
diff changeset
309 gaslist_cleanup_list2:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
310 decf hi,w ; 0-4
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
311 btfsc ccr_diluent_setup ; In CCR-Menu?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
312 addlw .5 ; Yes, adjust offset
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
313 movff PLUSW1,WREG ; read gas type
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
314 decfsz WREG ; is gas = first (ex 1)?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
315 bra gaslist_cleanup_list3 ; NO
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
316 incf lo,F ; YES - count "first gases"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
317 btfss ignore_last_edited_gas ; If we are not in the second-pass mode
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
318 bra gaslist_cleanup_list2b
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
319 decf hi,w ; 0-4
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
320 cpfseq gaslist_gas ; Do not disable last edited gas
0
heinrichsweikamp
parents:
diff changeset
321 gaslist_cleanup_list2b:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
322 movff hi,up ; Keep the last "first gas" found
0
heinrichsweikamp
parents:
diff changeset
323 gaslist_cleanup_list3:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
324 decfsz hi,F
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
325 bra gaslist_cleanup_list2 ; Loop
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
326 tstfsz lo ; No gas active?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
327 bra gaslist_cleanup_list4 ; No, at least one is active
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
328 btfsc ccr_diluent_setup ; In CCR-Menu?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
329 bra gaslist_cleanup_list3a ; Yes.
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
330 ; make gas1 first and zero
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
331 movlw .1 ; First
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
332 movwf up
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
333 movwf INDF1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
334 bra gaslist_cleanup_list5 ; Set change depth to zero
0
heinrichsweikamp
parents:
diff changeset
335 gaslist_cleanup_list3a:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
336 movlw .5
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
337 addwf FSR1L,F
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
338 movlw .0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
339 addwfc FSR1H,F ; Setup to Diluents
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
340 ; make dil1 first and zero
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
341 movlw .1 ; First
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
342 movwf up
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
343 movwf INDF1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
344 bra gaslist_cleanup_list5 ; Set change depth to zero
0
heinrichsweikamp
parents:
diff changeset
345 gaslist_cleanup_list4:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
346 movlw .1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
347 cpfsgt lo ; More then one "first gas"?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
348 bra gaslist_cleanup_list5 ; No, done.
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
349 ; More then one Gas is "first gas"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
350 ; Disable last found "first gas" but keep it's change depth
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
351 decf up,W ; 0-4
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
352 cpfseq gaslist_gas ; Do not disable last edited gas
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
353 bra gaslist_cleanup_list4b
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
354 ; Do not disable last edited gas
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
355 ; search again but ignore last edited gas
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
356 bsf ignore_last_edited_gas
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
357 bra gaslist_cleanup_list1 ; Loop until only one "first gas" is left
0
heinrichsweikamp
parents:
diff changeset
358 gaslist_cleanup_list4b:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
359 btfsc ccr_diluent_setup ; In CCR-Menu?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
360 addlw .5 ; Yes, adjust offset
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
361 clrf PLUSW1 ; Disable gas
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
362 bra gaslist_cleanup_list ; Loop until only one "first gas" is left
0
heinrichsweikamp
parents:
diff changeset
363 gaslist_cleanup_list5:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
364 ; Read switch depth
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
365 lfsr FSR1,char_I_dil_change-.5 ; Setup Diluents-5
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
366 btfss ccr_diluent_setup ; In CCR-Menu?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
367 lfsr FSR1,opt_OC_bail_gas_change ; No, setup OC Gases
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
368 decf up,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
369 btfsc ccr_diluent_setup ; In CCR-Menu?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
370 addlw .5 ; Yes, adjust offset
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
371 clrf PLUSW1 ; Set First gas to zero m
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
372 return
0
heinrichsweikamp
parents:
diff changeset
373
heinrichsweikamp
parents:
diff changeset
374 ;----------------------------------------------------------------------------
heinrichsweikamp
parents:
diff changeset
375 ; Increment/Decrement O2 ratio
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
376
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
377 global gaslist_pO2
0
heinrichsweikamp
parents:
diff changeset
378 gaslist_pO2:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
379 movf gaslist_gas,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
380 lfsr FSR1,opt_gas_He_ratio ; Read opt_gas_He_ratio[WREG]
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
381 movff PLUSW1,hi ; hi holds He ratio
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
382 lfsr FSR1,opt_gas_O2_ratio ; Read opt_gas_O2_ratio[WREG]
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
383 movff PLUSW1,lo ; lo holds O2 ratio
0
heinrichsweikamp
parents:
diff changeset
384
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
385 incf lo,F ; O2++
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
386 movf hi,W ; get He ratio into WREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
387 addwf lo,W ; add O2 ratio to WREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
388 movwf up ; move sum He + O2 to up
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
389 movlw .101 ;
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
390 cpfslt up ; O2 + He < 101?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
391 decf lo,F ; O2-- (revoke ++)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
392 movf gaslist_gas,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
393 movff lo,PLUSW1 ; write back O2 ratio to opt_gas_O2_ratio[WREG]
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
394 return
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
395
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
396 global gaslist_mO2
0
heinrichsweikamp
parents:
diff changeset
397 gaslist_mO2:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
398 movf gaslist_gas,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
399 lfsr FSR1,opt_gas_O2_ratio ; Read opt_gas_O2_ratio[WREG]
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
400 movff PLUSW1,lo ; lo holds O2 ratio
0
heinrichsweikamp
parents:
diff changeset
401
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
402 decf lo,F ; O2--
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
403 movlw gaslist_min_o2 ; get minimum allowed O2 ratio
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
404 cpfslt lo ; current O2 ratio below allowed minimum?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
405 bra gaslist_mO2_1 ; NO
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
406 movlw gaslist_min_o2 ; YES - load minimum
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
407 movwf lo ; write minimum to current O2 ratio
0
heinrichsweikamp
parents:
diff changeset
408 gaslist_mO2_1:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
409 movf gaslist_gas,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
410 movff lo,PLUSW1 ; write back O2 ratio to opt_gas_O2_ratio[WREG]
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
411 return
0
heinrichsweikamp
parents:
diff changeset
412
heinrichsweikamp
parents:
diff changeset
413 ;----------------------------------------------------------------------------
heinrichsweikamp
parents:
diff changeset
414 ; Increment/Decrement He ratio
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
415
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
416 global gaslist_pHe
0
heinrichsweikamp
parents:
diff changeset
417 gaslist_pHe:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
418 movf gaslist_gas,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
419 lfsr FSR1,opt_gas_O2_ratio ; Read opt_gas_O2_ratio[WREG]
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
420 movff PLUSW1,lo ; lo holds O2 ratio
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
421 lfsr FSR1,opt_gas_He_ratio ; Read opt_gas_He_ratio[WREG]
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
422 movff PLUSW1,hi ; hi holds He ratio
0
heinrichsweikamp
parents:
diff changeset
423
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
424 incf hi,F ; He++
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
425 movf hi,W ; get He ratio into WREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
426 addwf lo,W ; add O2 ratio to WREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
427 movwf up ; move sum He + O2 to up
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
428 movlw .101 ;
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
429 cpfslt up ; O2 + He < 101?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
430 decf hi,F ; He-- (revoke ++)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
431 movf gaslist_gas,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
432 movff hi,PLUSW1 ; write back He ratio to opt_gas_He_ratio[WREG]
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
433 return
0
heinrichsweikamp
parents:
diff changeset
434
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
435 global gaslist_mHe
0
heinrichsweikamp
parents:
diff changeset
436 gaslist_mHe:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
437 movf gaslist_gas,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
438 lfsr FSR1,opt_gas_He_ratio ; Read opt_gas_He_ratio[WREG]
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
439 movff PLUSW1,hi ; hi holds He ratio
0
heinrichsweikamp
parents:
diff changeset
440
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
441 decf hi,F ; He--
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
442 bnn gaslist_mHe_1 ; He ratio negative?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
443 clrf hi ; YES - set He to 0
0
heinrichsweikamp
parents:
diff changeset
444 gaslist_mHe_1:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
445 movf gaslist_gas,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
446 movff hi,PLUSW1 ; write back He ratio to opt_gas_He_ratio[WREG]
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
447 return
0
heinrichsweikamp
parents:
diff changeset
448
heinrichsweikamp
parents:
diff changeset
449 ;----------------------------------------------------------------------------
heinrichsweikamp
parents:
diff changeset
450 ; Increment/Decrement switch depth
heinrichsweikamp
parents:
diff changeset
451
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
452 global gaslist_pDepth
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
453 gaslist_pDepth:
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
454 lfsr FSR1,char_I_dil_change-.5 ; Setup Diluents-5
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
455 movlw .4
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
456 cpfsgt gaslist_gas ; >4? (-> Diluents)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
457 lfsr FSR1,opt_OC_bail_gas_change ; Setup OC Gases
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
458 movf gaslist_gas,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
459 movff PLUSW1,lo ; Read char_I_deco_gas_change[WREG]
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
460 incf lo,F
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
461 movlw gaslist_max_change_depth
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
462 cpfsgt lo
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
463 bra gaslist_pDepth_1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
464 movlw gaslist_max_change_depth
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
465 movwf lo
0
heinrichsweikamp
parents:
diff changeset
466 gaslist_pDepth_1:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
467 movf gaslist_gas,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
468 movff lo,PLUSW1 ; Write back to char_I_deco_gas_change[WREG]
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
469 return
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
470
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
471 global gaslist_mDepth
0
heinrichsweikamp
parents:
diff changeset
472 gaslist_mDepth:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
473 lfsr FSR1,char_I_dil_change-.5 ; Setup Diluents-5
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
474 movlw .4
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
475 cpfsgt gaslist_gas ; >4? (-> Diluents)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
476 lfsr FSR1,opt_OC_bail_gas_change ; Setup OC Gases
97
53a99a2dc6a1 CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents: 95
diff changeset
477
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
478 movf gaslist_gas,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
479 movff PLUSW1,lo ; Read char_I_deco_gas_change[WREG]
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
480
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
481 decf lo,F
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
482 btfsc STATUS,N
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
483 clrf lo
0
heinrichsweikamp
parents:
diff changeset
484
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
485 movf gaslist_gas,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
486 movff lo,PLUSW1 ; And write back to char_I_deco_gas_change[WREG]
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
487 return
0
heinrichsweikamp
parents:
diff changeset
488
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
489 global gaslist_spplus
0
heinrichsweikamp
parents:
diff changeset
490 gaslist_spplus:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
491 movf gaslist_gas,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
492 lfsr FSR1,char_I_setpoint_cbar
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
493 movff PLUSW1,lo ; Read char_I_setpoint_cbar[WREG]
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
494 movlw gaslist_sp_stepsize
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
495 addwf lo,F
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
496 movlw gaslist_sp_max
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
497 cpfsgt lo
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
498 bra gaslist_spplus2
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
499 movlw gaslist_sp_min
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
500 movwf lo
0
heinrichsweikamp
parents:
diff changeset
501 gaslist_spplus2:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
502 movf gaslist_gas,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
503 movff lo,PLUSW1 ; Write back to char_I_setpoint_cbar
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
504 return
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
505
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
506 global gaslist_spdepthplus
0
heinrichsweikamp
parents:
diff changeset
507 gaslist_spdepthplus:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
508 movf gaslist_gas,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
509 bz gaslist_spdepthplus3 ; Setpoint 1 is always 0m
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
510 lfsr FSR1,char_I_setpoint_change
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
511 movff PLUSW1,lo ; Read char_I_deco_gas_change[WREG]
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
512 incf lo,F
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
513 movlw gaslist_max_change_depth
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
514 cpfsgt lo
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
515 bra gaslist_spdepthplus_1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
516 movlw gaslist_max_change_depth
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
517 movwf lo
0
heinrichsweikamp
parents:
diff changeset
518 gaslist_spdepthplus_1:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
519 movf gaslist_gas,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
520 movff lo,PLUSW1 ; Write back to char_I_deco_gas_change[WREG]
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
521 return
0
heinrichsweikamp
parents:
diff changeset
522
heinrichsweikamp
parents:
diff changeset
523 gaslist_spdepthplus3:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
524 movlw .0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
525 movff WREG,char_I_setpoint_change+0 ; Reset to 0m
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
526 return
0
heinrichsweikamp
parents:
diff changeset
527
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
528 global gaslist_spdepthminus
0
heinrichsweikamp
parents:
diff changeset
529 gaslist_spdepthminus:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
530 movf gaslist_gas,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
531 bz gaslist_spdepthplus3 ; Setpoint 1 is always 0m
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
532 lfsr FSR1,char_I_setpoint_change
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
533 movff PLUSW1,lo ; Read char_I_deco_gas_change[WREG]
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
534 decf lo,F
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
535 btfsc STATUS,N
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
536 clrf lo
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
537 movf gaslist_gas,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
538 movff lo,PLUSW1 ; Write back to char_I_deco_gas_change[WREG]
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
539 return
0
heinrichsweikamp
parents:
diff changeset
540
heinrichsweikamp
parents:
diff changeset
541 ;----------------------------------------------------------------------------
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 540
diff changeset
542 ; Compute MOD from char_I_ppO2_max/char_I_ppO2_max_deco and current O2 Ratio.
0
heinrichsweikamp
parents:
diff changeset
543 ;
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
544 ; Input: gaslist_gas = current gas index.
0
heinrichsweikamp
parents:
diff changeset
545 ; opt_gas_O2_ratio[gaslist_gas] = current O2 ratio
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
546 ; Output: WREG = MOD [m]
0
heinrichsweikamp
parents:
diff changeset
547 ;
heinrichsweikamp
parents:
diff changeset
548 gaslist_calc_mod:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
549 movf gaslist_gas,W ; get gas number (0...5)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
550 lfsr FSR1,opt_gas_O2_ratio ; read opt_gas_O2_ratio[WREG]
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
551 movf PLUSW1,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
552
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
553 btfsc divemode ; in divemode?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
554 bra gaslist_calc_mod_divemode ; YES
0
heinrichsweikamp
parents:
diff changeset
555
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
556 ; Pamb max = ppO2 Max / O2 ratio
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
557 movwf xB+0
0
heinrichsweikamp
parents:
diff changeset
558
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
559 movf gaslist_gas,W ; get gas number (0...5)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
560 lfsr FSR1,opt_gas_type ; 0=Disabled, 1=First, 2=Travel, 3=Deco for OC gases and 0=Disabled, 1=First, 2=Normal for diluents
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
561 movff PLUSW1,xA+0 ; xA+0 used as temp here -> holds type
0
heinrichsweikamp
parents:
diff changeset
562
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
563 movff char_I_ppO2_max_deco,xB+1 ; xB+1 used as temp here
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
564 movlw .3
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
565 cpfseq xA+0 ; Deco?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
566 movff char_I_ppO2_max,xB+1 ; No, overwrite with travel/bottom max
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
567 movf xB+1,W ; Result in WREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
568
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
569 clrf xB+1 ; Clear for div16x16
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
570 mullw .10
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
571 movff PRODL,xA+0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
572 movff PRODH,xA+1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
573 call div16x16
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
574
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
575 ; Prof = Pamb - 1 bar
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
576 movf xC+0,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
577 addlw -.10
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
578 return
0
heinrichsweikamp
parents:
diff changeset
579
heinrichsweikamp
parents:
diff changeset
580 gaslist_calc_mod_divemode:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
581 movwf hi ; Copy O2%
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
582 call TFT_color_code_gaslist ; Color-code current row in Gaslist (%O2 in hi), char_I_ppO2_max/char_I_ppO2_max_deco as threshold
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
583 return
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
584
0
heinrichsweikamp
parents:
diff changeset
585 ;----------------------------------------------------------------------------
154
afa31c815f24 NEW: Show ppO2 for change depth during gas setup
heinrichsweikamp
parents: 97
diff changeset
586
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
587 global gaslist_ppo2
154
afa31c815f24 NEW: Show ppO2 for change depth during gas setup
heinrichsweikamp
parents: 97
diff changeset
588 gaslist_ppo2:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
589 STRCAT_TEXT tppO2 ; ppO2:
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
590 movf gaslist_gas,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
591 lfsr FSR1,char_I_dil_change-.5 ; Setup Diluents
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
592 btfss ccr_diluent_setup ; In CCR-Menu?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
593 lfsr FSR1,opt_OC_bail_gas_change ; No, setup OC/Bailout Gases
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
594 movf PLUSW1,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
595 mullw .10 ; PROD=Depth in mbar/10 (100 = 1.00 bar)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
596 movlw .100
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
597 addwf PRODL,F
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
598 movlw .0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
599 addwfc PRODH,F ; add 1bar
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
600 movff PRODL,xA+0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
601 movff PRODH,xA+1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
602 movf gaslist_gas,W ; Read current gas O2 ratio
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
603 lfsr FSR1,opt_dil_O2_ratio-.5 ; Read dil_gas_O2_ratio[WREG]
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
604 btfss ccr_diluent_setup ; In CCR-Menu?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
605 lfsr FSR1,opt_gas_O2_ratio ; No, read opt_gas_O2_ratio[WREG]
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
606 movff PLUSW1,xB+0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
607 clrf xB+1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
608 call mult16x16 ; char_I_O2_ratio * (p_amb/10)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
609 movff xC+0,xA+0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
610 movff xC+1,xA+1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
611 movlw d'100'
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
612 movwf xB+0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
613 clrf xB+1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
614 call div16x16 ; xC=(char_I_O2_ratio * p_amb/10)/100
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
615 ; Check very high ppO2 manually
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
616 tstfsz xC+2 ; char_I_O2_ratio * p_amb/10 > 65536, ppO2>6,55bar?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
617 bra gaslist_ppo2_2 ; Yes, display fixed Value!
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
618 movff xC+0,lo
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
619 movff xC+1,hi
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
620 bcf ignore_digit4
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
621 bsf leftbind
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
622 output_16dp d'3' ; x.xx
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
623 STRCAT_TEXT tbar ; bar
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
624 return
154
afa31c815f24 NEW: Show ppO2 for change depth during gas setup
heinrichsweikamp
parents: 97
diff changeset
625 gaslist_ppo2_2:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
626 STRCAT ">6.6"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
627 return
154
afa31c815f24 NEW: Show ppO2 for change depth during gas setup
heinrichsweikamp
parents: 97
diff changeset
628
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
629 global gaslist_MOD_END
0
heinrichsweikamp
parents:
diff changeset
630 gaslist_MOD_END:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
631 rcall gaslist_calc_mod ; Compute MOD into WREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
632 movwf lo ; Copy to lo
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
633 STRCAT_TEXT tMOD ; MOD:
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
634 TSTOSS opt_units ; 0=Meters, 1=Feets
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
635 bra gaslist_MOD_metric
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
636 ;gaslist_MOD_imperial:
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
637 movf lo,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
638 mullw .100 ; convert meters to mbar
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
639 movff PRODL,lo
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
640 movff PRODH,hi
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
641 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
642 bsf leftbind
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
643 output_16_3 ; limit to 999 and display only (0-999)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
644 STRCAT_TEXT tFeets ; "ft"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
645 bra gaslist_MOD_common
0
heinrichsweikamp
parents:
diff changeset
646 gaslist_MOD_metric:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
647 output_8
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
648 STRCAT_TEXT tMeters ; m
0
heinrichsweikamp
parents:
diff changeset
649 gaslist_MOD_common:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
650 PUTC "/"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
651 STRCAT_TEXT tEND ; END:
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
652 rcall gaslist_calc_mod ; Output: WREG = MOD [m]
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
653 addlw .10 ; MOD=MOD+10m
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
654 movwf xB+0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
655 clrf xB+1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
656 movlw d'100'
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
657 movwf xA+0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
658 movf gaslist_gas,W ; get gas number (0...5)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
659 lfsr FSR1,opt_gas_He_ratio ; read opt_gas_O2_ratio[WREG]
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
660 movf PLUSW1,W ; He value in %
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
661 subwf xA+0,F ; xA+0 = 100 - He Value in %
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
662 clrf xA+1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
663 call mult16x16 ; xA*xB=xC
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
664 movff xC+0,xA+0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
665 movff xC+1,xA+1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
666 movlw d'100'
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
667 movwf xB+0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
668 clrf xB+1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
669 call div16x16 ; xA/xB=xC with xA as remainder
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
670 ; ; xC:2 = ((MOD+10) * 100 - HE Value in %) / 100
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
671 movlw d'10'
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
672 subwf xC+0,F ; Subtract 10m...
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
673 movff xC+0,lo
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
674 ;; END 8Bit only
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
675 ;movlw d'0'
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
676 ;subwfb xC+1,F
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
677 ;movff xC+1,hi
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
678 TSTOSS opt_units ; 0=Meter, 1=Feet
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
679 bra gaslist_END_metric
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
680 ;gaslist_END_imperial:
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
681 movf lo,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
682 mullw .100 ; convert meters to mbar
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
683 movff PRODL,lo
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
684 movff PRODH,hi
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
685 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
686 bsf leftbind
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
687 output_16_3 ; limit to 999 and display only (0-999)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
688 STRCAT_TEXT tFeets ; "ft"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
689 return
0
heinrichsweikamp
parents:
diff changeset
690 gaslist_END_metric:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
691 output_8
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
692 STRCAT_TEXT tMeters ; m
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
693 return
0
heinrichsweikamp
parents:
diff changeset
694
heinrichsweikamp
parents:
diff changeset
695 ;----------------------------------------------------------------------------
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
696 global gaslist_reset_mod_title
0
heinrichsweikamp
parents:
diff changeset
697 gaslist_reset_mod_title:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
698 STRCAT_TEXT tDepthReset
0
heinrichsweikamp
parents:
diff changeset
699
heinrichsweikamp
parents:
diff changeset
700 gaslist_reset_mod_title2:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
701 rcall gaslist_calc_mod ; Compute MOD into WREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
702 movwf lo ; Copy to lo
0
heinrichsweikamp
parents:
diff changeset
703
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
704 movf gaslist_gas,W ; Compare to switch depth
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
705 lfsr FSR1,char_I_dil_change-.5 ; Setup Diluents
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
706 btfss ccr_diluent_setup ; In CCR-Menu?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
707 lfsr FSR1,opt_OC_bail_gas_change ; No, setup OC Gases
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
708 movf PLUSW1,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
709 cpfslt lo
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
710 bra gaslist_strcat_5 ; and return...
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
711 call TFT_warnings_color ; turn red if bigger !
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
712 bra gaslist_strcat_5 ; and return...
0
heinrichsweikamp
parents:
diff changeset
713
heinrichsweikamp
parents:
diff changeset
714 ;----------------------------------------------------------------------------
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
715 global gaslist_reset_mod
0
heinrichsweikamp
parents:
diff changeset
716 gaslist_reset_mod:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
717 rcall gaslist_calc_mod ; Compute MOD, it is returned in WREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
718 movwf lo ; buffer MOD to lo
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
719 movf gaslist_gas,W ; Read current gas O2 ratio
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
720 lfsr FSR1,char_I_dil_change-.5 ; Setup Diluents
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
721 btfss ccr_diluent_setup ; In CCR-Menu?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
722 lfsr FSR1,opt_OC_bail_gas_change ; NO - setup OC Gases
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
723 movff lo,PLUSW1 ; write back new change depth
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
724 return
0
heinrichsweikamp
parents:
diff changeset
725 ;----------------------------------------------------------------------------
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
726 END