comparison src/gaslist.asm @ 623:c40025d8e750

3.03 beta released
author heinrichsweikamp
date Mon, 03 Jun 2019 14:01:48 +0200
parents ca4556fb60b9
children cd58f7fc86db
comparison
equal deleted inserted replaced
622:02d1386429a6 623:c40025d8e750
1 ;============================================================================= 1 ;=============================================================================
2 ; 2 ;
3 ; File gaslist.asm REFACTORED VERSION V2.99e 3 ; File gaslist.asm combined next generation V3.03.2
4 ; 4 ;
5 ; Managing OSTC gas list 5 ; Managing OSTC gas list
6 ; 6 ;
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. 7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
8 ;============================================================================= 8 ;=============================================================================
9 ; HISTORY 9 ; HISTORY
10 ; 2011-08-11 : [jDG] Creation. 10 ; 2011-08-11 : [jDG] Creation.
11 11
12 #include "hwos.inc" ; mandatory header 12 #include "hwos.inc" ; mandatory header
13 #include "convert.inc" 13 #include "convert.inc"
14 #include "math.inc" ; div16x16 for MOD calculations 14 #include "math.inc" ; div16x16 for MOD calculation
15 #include "strings.inc" 15 #include "strings.inc"
16 #include "tft.inc" 16 #include "tft.inc"
17 #include "tft_outputs.inc" 17 #include "tft_outputs.inc"
18 #include "shared_definitions.h" 18 #include "shared_definitions.h"
19 #include "wait.inc" 19 #include "wait.inc"
20
21 IFDEF _rx_functions
22 #include "rx_ops.inc" 20 #include "rx_ops.inc"
23 ENDIF 21
24 22
25 extern convert_mbar_to_feet 23 extern convert_mbar_to_feet
26 extern customview_show_mix
27 extern tSetup_GasDepth 24 extern tSetup_GasDepth
28 extern tGasDisabled 25 extern tGasDisabled
29 extern tDilDisabled 26 extern tDilDisabled
30 extern tLiter 27 extern tLiter
31 extern tbar10 28 extern tbar10
32 extern tbar 29 extern tbar
33 30
34 gaslist CODE 31
32 gaslist CODE
33
34 ;-----------------------------------------------------------------------------
35 35
36 ;============================================================================= 36 ;=============================================================================
37 ; Helper Functions for divemenu_tree.asm 37 ; Helper Functions for divemenu_tree.asm
38 ; 38 ;
39 ; They need to be put in a different file than 39 ; They need to be put in a different file than
52 call TFT_disabled_color 52 call TFT_disabled_color
53 do_toggle_gf_label_2: 53 do_toggle_gf_label_2:
54 STRCAT_TEXT tDivemenu_ToggleGF 54 STRCAT_TEXT tDivemenu_ToggleGF
55 return 55 return
56 56
57 ;=============================================================================
57 58
58 IFDEF _cave_mode 59 IFDEF _cave_mode
60
59 global do_turn_dive_label 61 global do_turn_dive_label
60 do_turn_dive_label: 62 do_turn_dive_label:
61 btfss FLAG_cave_mode ; in cave mode? 63 btfss cave_mode ; cave mode switched on?
62 call TFT_disabled_color ; NO - print in disabled color 64 call TFT_disabled_color ; NO - print in disabled color
63 btfsc FLAG_dive_turned ; dive already turned? 65 btfsc dive_turned ; dive already turned?
64 call TFT_attention_color ; YES - print in attention color 66 call TFT_attention_color ; YES - print in attention color
65 STRCAT_TEXT tDivemenu_TurnDive ; output label 67 STRCAT_TEXT tDivemenu_TurnDive ; output label
66 return 68 return
69
67 ENDIF 70 ENDIF
68 71
72 ;=============================================================================
73
74 IFDEF _rx_functions
69 75
70 global do_toggle_max_pres_diff_label 76 global do_toggle_max_pres_diff_label
71 do_toggle_max_pres_diff_label: 77 do_toggle_max_pres_diff_label:
72 movff opt_TR_mode,WREG ; get TR mode 78 movff opt_TR_mode,WREG ; get TR mode
73 xorlw .2 ; compare with 2 (ind.double) 79 xorlw .2 ; compare with 2 (ind.double)
77 movff char_I_max_pres_diff,lo 83 movff char_I_max_pres_diff,lo
78 output_99 84 output_99
79 STRCAT_TEXT tbar ; " bar" 85 STRCAT_TEXT tbar ; " bar"
80 return 86 return
81 87
88 ENDIF
89
90 ;=============================================================================
91
92 IFDEF _ccr_pscr
93
82 global gaslist_copy_dil_to_oc 94 global gaslist_copy_dil_to_oc
83 gaslist_copy_dil_to_oc: 95 gaslist_copy_dil_to_oc:
84 ; 96 ;
85 ; Memory Map: 97 ; Memory Map:
86 ; ----------------------------------------- 98 ; -----------------------------------------
91 ; opt_gas_type res 5 103 ; opt_gas_type res 5
92 ; opt_dil_type res 5 104 ; opt_dil_type res 5
93 ; opt_gas_change res 5 105 ; opt_gas_change res 5
94 ; opt_dil_change res 5 106 ; opt_dil_change res 5
95 ; 107 ;
96 ; char_I_tank_size res 10 108 ; char_I_gas_avail_size res 10
97 ; char_I_tank_pres_fill res 10 109 ; char_I_gas_avail_pres res 10
98 ; 110 ;
99 bcf aux_flag ; clear aux_flag by default 111 bcf copying_dil ; default to copying a gas
100 movf gaslist_gas,W ; copy current gas or diluent number to WREG 112 movf gaslist_gas,W ; copy current gas or diluent number to WREG
101 btfss FLAG_diluent_setup ; in CCR menus? 113 btfss is_diluent_menu ; setting up diluents?
102 bra gaslist_copy_dil_to_oc_1 ; NO - gaslist_gas is already pointing to an OC gas 114 bra gaslist_copy_dil_to_oc_1 ; NO - gaslist_gas is already pointing to an OC gas
103 addlw -.5 ; YES - subtract offset between diluents and gases 115 addlw -.5 ; YES - subtract offset between diluents and gases
104 movwf gaslist_gas ; - let gaslist_gas point to the corresponding OC gas 116 movwf gaslist_gas ; - let gaslist_gas point to the corresponding OC gas
105 bsf aux_flag ; - remember we came from a CCR menu 117 bsf copying_dil ; - we are copying a diluent
106 bcf FLAG_diluent_setup ; - pretend we came from an OC gas menu 118 bcf is_diluent_menu ; - pretend we are setting up OC gases
107 gaslist_copy_dil_to_oc_1: 119 gaslist_copy_dil_to_oc_1:
108 lfsr FSR0,opt_dil_O2_ratio ; load base address of diluents settings, ASM variables 120 lfsr FSR0,opt_dil_O2_ratio ; load base address of diluents settings, ASM variables
109 lfsr FSR1,opt_gas_O2_ratio ; load base address of gas settings, ASM variables 121 lfsr FSR1,opt_gas_O2_ratio ; load base address of gas settings, ASM variables
110 movff PLUSW0,PLUSW1 ; copy O2 ratio 122 movff PLUSW0,PLUSW1 ; copy O2 ratio
111 addlw .10 ; add offset from O2 ratios to He ratios 123 addlw .10 ; add offset from O2 ratios to He ratios
113 addlw .10 ; add offset from He ratios to types 125 addlw .10 ; add offset from He ratios to types
114 movff PLUSW0,PLUSW1 ; copy type 126 movff PLUSW0,PLUSW1 ; copy type
115 addlw .10 ; add offset from type to change depth 127 addlw .10 ; add offset from type to change depth
116 movff PLUSW0,PLUSW1 ; copy change depth 128 movff PLUSW0,PLUSW1 ; copy change depth
117 addlw -.30 ; wind back to initial gas number 129 addlw -.30 ; wind back to initial gas number
118 lfsr FSR0,char_I_tank_size+5 ; load base address of diluents settings, shared variables 130 lfsr FSR0,char_I_gas_avail_size+5; load base address of diluents settings, shared variables
119 lfsr FSR1,char_I_tank_size+0 ; load base address of gas settings, shared variables 131 lfsr FSR1,char_I_gas_avail_size+0; load base address of gas settings, shared variables
120 movff PLUSW0,PLUSW1 ; copy tank size 132 movff PLUSW0,PLUSW1 ; copy tank size
121 addlw .10 ; add offset from tank sizes to pressure budget 133 addlw .10 ; add offset from tank sizes to pressure budget
122 movff PLUSW0,PLUSW1 ; copy pressure budget 134 movff PLUSW0,PLUSW1 ; copy pressure budget
123 call gaslist_cleanup_list ; make sure that there will be just one first gas 135 call gaslist_cleanup_list ; make sure that there will be just one first gas
124 btfss aux_flag ; did we came from a CCR menu? 136 btfss copying_dil ; are we copying a diluent?
125 return ; NO - done 137 return ; NO - done
126 bsf FLAG_diluent_setup ; YES - restore proper origin again 138 bsf is_diluent_menu ; YES - restore to be setting up diluents
127 movlw .5 ; - offset between OC gases and diluents 139 movlw .5 ; - offset between OC gases and diluents
128 addwf gaslist_gas,F ; - let gaslist_gas point to the diluent again 140 addwf gaslist_gas,F ; - let gaslist_gas point to the diluent again
129 WIN_BOX_BLACK .30,.239,.0,.159 ; - create some visual effect to show activity 141 WIN_BOX_BLACK .30,.239,.0,.159 ; - create some visual effect to show activity
130 WAITMS .200 ; - pause for 200 ms 142 WAITMS .200 ; - pause for 200 ms
131 return ; - done 143 return ; - done
132 144
145 ENDIF
146
147 ;=============================================================================
133 148
134 ;============================================================================= 149 ;=============================================================================
135 ; Append gas description to current string 150 ; Append gas description to current string
136 ; 151 ;
137 ; Input: PRODL : gas number (0..4) 152 ; Input: PRODL : gas number (0..4)
138 ; FSR2 : Current string position 153 ; FSR2 : Current string position
139 ; Output: Text appended into buffer pointed by FSR2 154 ; Output: Text appended into buffer pointed by FSR2
140 155
141 global gaslist_strcat_gas 156 global gaslist_strcat_gas
142 global gaslist_strcat_gas_WREG 157 global gaslist_strcat_gas_WREG
143 gaslist_strcat_gas: ; entry point with gas/dil in PRODL (0-4) and FLAG_diluent_setup 158 gaslist_strcat_gas: ; entry point with gas/dil in PRODL (0-4) and flag 'is_diluent_menu' set accordingly
144 movff PRODL,gaslist_gas ; get current menu item (0-4) 159 movff PRODL,gaslist_gas ; get current menu item (0-4)
145 movlw .5 ; offset between gases and diluents 160 movlw .5 ; offset between gases and diluents
146 btfsc FLAG_diluent_setup ; in CCR menus? 161 btfsc is_diluent_menu ; setting up diluents?
147 addwf gaslist_gas,F ; YES - add the offset 162 addwf gaslist_gas,F ; YES - add the offset
148 movf gaslist_gas,W ; copy to WREG 163 movf gaslist_gas,W ; copy to WREG
149 gaslist_strcat_gas_WREG: ; entry point with gas/dil in WREG (0-9) 164 gaslist_strcat_gas_WREG: ; entry point with gas/dil in WREG (0-9)
150 lfsr FSR1,opt_gas_O2_ratio ; load base address of opt_gas_O2_ratio 165 lfsr FSR1,opt_gas_O2_ratio ; load base address of opt_gas_O2_ratio
151 movff PLUSW1,lo ; read O2 ratio 166 movff PLUSW1,lo ; read O2 ratio
152 lfsr FSR1,opt_gas_He_ratio ; load base address of opt_gas_He_ratio 167 lfsr FSR1,opt_gas_He_ratio ; load base address of opt_gas_He_ratio
153 movff PLUSW1,hi ; read He ratio 168 movff PLUSW1,hi ; read He ratio
154 goto customview_show_mix ; put "Nxlo", "Txlo/hi", "Air" or "O2" into Postinc2, and RETURN 169 goto gaslist_show_mix ; put "Nxlo", "Txlo/hi", "Air" or "O2" into Postinc2, and RETURN
155 170
156 ;============================================================================= 171
157 ; Append current mix to current string (for divemode) 172 ;=============================================================================
173 ; Append current mix to current string (for dive mode)
158 ; 174 ;
159 ; Input: FSR2 : Current string position 175 ; Input: FSR2 : Current string position
160 ; Output: Text appended into buffer pointed by FSR2 176 ; Output: Text appended into buffer pointed by FSR2
161 177
162 global gaslist_strcat_gas6 178 global gaslist_strcat_gas6
163 gaslist_strcat_gas6: ; show current O2/He mix 179 gaslist_strcat_gas6: ; show current O2/He mix
164 STRCAT_TEXT tGas 180 STRCAT_TEXT tGas ; print "Gas"
165 STRCAT ": " 181 STRCAT ": " ; print ":"
166 movff gas6_O2_ratio,hi ; TFT_color_code_gaslist needs O2 ratio in hi 182 movff gas6_O2_ratio,hi ; TFT_color_code_gaslist needs O2 ratio in hi
167 call TFT_color_code_gaslist ; color-code according to O2 ratio and depth 183 call TFT_color_code_gaslist ; color-code according to O2 ratio and depth
168 movff gas6_O2_ratio,lo ; customview_show_mix needs O2 ratio in lo 184 movff gas6_O2_ratio,lo ; gaslist_show_mix needs O2 ratio in lo
169 movff gas6_He_ratio,hi ; ... and He ratio in hi 185 IFDEF _helium
170 goto customview_show_mix ; put "Nxlo", "Txlo/hi", "Air" or "O2" into Postinc2, and return 186 movff gas6_He_ratio,hi ; ... and He ratio in hi
187 ELSE
188 clrf hi ; ... and He ration will be zero
189 ENDIF
190 goto gaslist_show_mix ; put "Nxlo", "Txlo/hi", "Air" or "O2" into Postinc2, and return
191
192
171 ;============================================================================= 193 ;=============================================================================
172 ; Helper functions for menu_tree 194 ; Helper functions for menu_tree
173 195
174 global gaslist_GasDepth 196 global gaslist_GasDepth
175 gaslist_GasDepth: 197 gaslist_GasDepth:
182 call TFT_attention_color ; NO - print in attention color (yellow) 204 call TFT_attention_color ; NO - print in attention color (yellow)
183 gaslist_GasDepth_1: 205 gaslist_GasDepth_1:
184 STRCAT_TEXT tSetup_GasDepth 206 STRCAT_TEXT tSetup_GasDepth
185 return 207 return
186 208
209
187 global gaslist_show_type 210 global gaslist_show_type
188 gaslist_show_type: 211 gaslist_show_type:
189 movf gaslist_gas,W 212 movf gaslist_gas,W
190 lfsr FSR1,opt_gas_type ; load base address of opt_gas_type 213 lfsr FSR1,opt_gas_type ; load base address of opt_gas_type
191 movff PLUSW1,lo ; read gas type 214 movff PLUSW1,lo ; read gas type
192 STRCAT_TEXT tType 215 STRCAT_TEXT tType
193 lfsr FSR1,tGasDisabled ; load base address of gas type labels 216 lfsr FSR1,tGasDisabled ; load base address of gas type labels
194 btfsc FLAG_diluent_setup ; in CCR setup? 217 btfsc is_diluent_menu ; setting up diluents?
195 lfsr FSR1,tDilDisabled ; YES - load base address of diluent type labels 218 lfsr FSR1,tDilDisabled ; YES - load base address of diluent type labels
196 movff lo,WREG ; 0-3 219 movff lo,WREG ; 0-3
197 rlncf WREG ; x2 220 rlncf WREG ; x2
198 addwf FSR1L,F ; adjust address pointer to required text 221 addwf FSR1L,F ; adjust address pointer to required text
199 movlw .0 222 movlw .0
206 gaslist_toggle_type: 229 gaslist_toggle_type:
207 movf gaslist_gas,W 230 movf gaslist_gas,W
208 lfsr FSR1,opt_gas_type ; load base address of opt_gas_type 231 lfsr FSR1,opt_gas_type ; load base address of opt_gas_type
209 movff PLUSW1,lo ; read gas type 232 movff PLUSW1,lo ; read gas type
210 incf lo,F ; increment type 233 incf lo,F ; increment type
211 btfsc FLAG_diluent_setup ; in CCR setup? 234 btfsc is_diluent_menu ; setting up diluents?
212 bra gaslist_toggle_type2 ; YES - diluents 235 bra gaslist_toggle_type2 ; YES - diluents
213 btfsc lo,2 ; NO - gases, type index > 3 ? 236 btfsc lo,2 ; NO - gases, type index > 3 ?
214 clrf lo ; YES - clear to zero 237 clrf lo ; YES - clear to zero
215 movff lo,PLUSW1 ; - copy back result 238 movff lo,PLUSW1 ; - copy back result
216 return 239 return
220 clrf lo ; YES - clear to zero 243 clrf lo ; YES - clear to zero
221 movf gaslist_gas,W ; restore gaslist_gas in WREG 244 movf gaslist_gas,W ; restore gaslist_gas in WREG
222 movff lo,PLUSW1 ; copy back result 245 movff lo,PLUSW1 ; copy back result
223 return 246 return
224 247
248 ;=============================================================================
249
250 IFDEF _ccr_pscr
225 251
226 global gaslist_strcat_setpoint 252 global gaslist_strcat_setpoint
227 global gaslist_strcat_setpoint_0 253 global gaslist_strcat_setpoint_0
228 gaslist_strcat_setpoint: ; entry point with setpoint index in PRODL 254 gaslist_strcat_setpoint: ; entry point with setpoint index in PRODL
229 movff PRODL,gaslist_gas ; get current menu item (0-4) 255 movff PRODL,gaslist_gas ; get current menu item (0-4)
230 gaslist_strcat_setpoint_0: ; entry point with setpoint index in gaslist_gas 256 gaslist_strcat_setpoint_0: ; entry point with setpoint index in gaslist_gas
231 bsf leftbind 257 bsf leftbind
232 btfsc short_gas_decriptions ; shall use short versions of gaslist_strcat_setpoint? 258 btfsc short_gas_descriptions ; shall use short versions of gaslist_strcat_setpoint?
233 bra gaslist_strcat_setpoint2 ; YES - use short version 259 bra gaslist_strcat_setpoint2 ; YES - use short version
234 STRCAT_TEXT tSP ; "SP" 260 STRCAT_TEXT tSP ; "SP"
235 incf gaslist_gas,W ; (0-4) -> (1-5) into WREG 261 incf gaslist_gas,W ; (0-4) -> (1-5) into WREG
236 movwf lo 262 movwf lo
237 output_8 ; print SP number 263 output_8 ; print SP number
238 bcf leftbind 264 bcf leftbind
239 PUTC ":" 265 PUTC ":"
240 gaslist_strcat_setpoint2: ; short version 266 gaslist_strcat_setpoint2: ; short version
241 btfsc divemode 267 btfsc divemode
242 bra gaslist_strcat_setpoint4 ; no "*" in divemode 268 bra gaslist_strcat_setpoint4 ; no "*" in dive mode
243 movf gaslist_gas,W ; (0-4) into WREG 269 movf gaslist_gas,W ; (0-4) into WREG
244 bnz gaslist_strcat_setpoint3 ; SP index = 0 ? 270 bnz gaslist_strcat_setpoint3 ; SP index = 0 ?
245 PUTC "*" ; YES - print * 271 PUTC "*" ; YES - print *
246 bra gaslist_strcat_setpoint4 ; - continue with cbar value 272 bra gaslist_strcat_setpoint4 ; - continue with cbar value
247 gaslist_strcat_setpoint3: ; NO 273 gaslist_strcat_setpoint3: ; NO
248 PUTC " " ; - print a space 274 PUTC " " ; - print a space
249 gaslist_strcat_setpoint4: 275 gaslist_strcat_setpoint4:
250 movf gaslist_gas,W ; (0-4) into WREG 276 movf gaslist_gas,W ; (0-4) into WREG
251 lfsr FSR1,char_I_setpoint_cbar ; load base address of setpoint cbar values 277 lfsr FSR1,opt_setpoint_cbar ; load base address of setpoint cbar values
252 movf PLUSW1,W ; read cbar value 278 movf PLUSW1,W ; read cbar value
253 movwf lo 279 movwf lo
254 clrf hi 280 clrf hi
255 bsf leftbind 281 bsf leftbind
256 output_16dp d'3' ; print as X.XX 282 output_16dp d'3' ; print as X.XX
257 btfsc divemode ; in divemode? 283 btfsc divemode ; in dive mode?
258 bra gaslist_strcat_setpoint5 ; YES - skip text in divemode 284 bra gaslist_strcat_setpoint5 ; YES - skip text in dive mode
259 STRCAT_TEXT tbar ; NO - print "bar" 285 STRCAT_TEXT tbar ; NO - print "bar"
260 gaslist_strcat_setpoint5: 286 gaslist_strcat_setpoint5:
261 PUTC " " ; print a space 287 PUTC " " ; print a space
262 movf gaslist_gas,W ; (0-4) into WREG 288 movf gaslist_gas,W ; (0-4) into WREG
263 lfsr FSR1,char_I_setpoint_change ; load base address of switch depths 289 lfsr FSR1,opt_setpoint_change ; load base address of switch depths
264 movff PLUSW1,lo ; read switch depth into lo 290 movff PLUSW1,lo ; read switch depth into lo
265 bra gaslist_strcat_depth ; print depth in meters or ft 291 bra gaslist_strcat_depth ; print depth in meters or ft
266 292
293 ENDIF ; _ccr_pscr
267 294
268 ;---------------------------------------------------------------------------- 295 ;----------------------------------------------------------------------------
269 ; Append gas description to current string 296 ; Append gas description to current string
270 ; 297 ;
271 ; Prints gas number, * if first, = if deco gas, gas composition and change depth, 298 ; Prints gas number, * if first, = if deco gas, gas composition and change depth,
277 ; 304 ;
278 ; NOTE: used in the menu-tree for the MENU_CALLBACK entry 305 ; NOTE: used in the menu-tree for the MENU_CALLBACK entry
279 306
280 global gaslist_strcat_gas_cd 307 global gaslist_strcat_gas_cd
281 global gaslist_gastitle 308 global gaslist_gastitle
282 gaslist_strcat_gas_cd: ; entry point with gas in PRODL (0-4) and usage of FLAG_diluent_setup 309 gaslist_strcat_gas_cd: ; entry point with gas in PRODL (0-4) and flag 'is_diluent_menu' set accordingly
283 movff PRODL,gaslist_gas ; get current menu item (0-4) 310 movff PRODL,gaslist_gas ; get current menu item (0-4)
284 movlw .5 ; offset between gases and diluents 311 movlw .5 ; offset between gases and diluents
285 btfsc FLAG_diluent_setup ; in diluent menus? 312 btfsc is_diluent_menu ; setting up diluents?
286 addwf gaslist_gas,F ; YES - add the offset 313 addwf gaslist_gas,F ; YES - add the offset
287 gaslist_gastitle: ; entry point with gas/dil in gaslist_gas (0-4 for gases, 5-9 for diluents) 314 gaslist_gastitle: ; entry point with gas/dil in gaslist_gas (0-4 for gases, 5-9 for diluents)
288 bcf win_invert ; clear flag for inverted output by default 315 bcf win_invert ; clear flag for inverted output by default
289 btfsc short_gas_decriptions ; shall use short versions of gaslist_strcat_gas_cd? 316 btfsc short_gas_descriptions ; shall use short versions of gaslist_strcat_gas_cd?
290 bra gaslist_gastitle1 ; YES - use short version 317 bra gaslist_gastitle1 ; YES - use short version
291 incf gaslist_gas,W ; (0-9) -> (1-10) into WREG 318 incf gaslist_gas,W ; (0-9) -> (1-10) into WREG
292 movwf lo 319 movwf lo
293 movlw .6 ; diluents start with 6 320 movlw .6 ; diluents start with 6
294 cpfslt lo ; gas number < 6 ? 321 cpfslt lo ; gas number < 6 ?
303 bsf leftbind 330 bsf leftbind
304 output_8 ; print gas/dil number (1-5) 331 output_8 ; print gas/dil number (1-5)
305 bcf leftbind 332 bcf leftbind
306 PUTC ":" 333 PUTC ":"
307 gaslist_gastitle1: ; short version of gaslist_strcat_gas_cd 334 gaslist_gastitle1: ; short version of gaslist_strcat_gas_cd
308 btfsc divemode ; in divemode? 335 btfsc divemode ; in dive mode?
309 bra gaslist_gastitle3 ; YES - no "*" and "=" in front of gas composition, no highlighting for transmitters paired 336 bra gaslist_gastitle3 ; YES - no "*" and "=" in front of gas composition, no highlighting for transmitters paired
310 337
311 IFDEF _rx_functions 338 IFDEF _rx_functions
312 btfss FLAG_tr_enabled ; NO - TR functions enabled? 339 btfss tr_functions_activated ; NO - TR functions activated?
313 bra gaslist_gastitle2 ; NO - continue with gas type 340 bra gaslist_gastitle2 ; NO - continue with gas type
314 lfsr FSR1,opt_transmitter_id_1 ; YES - load base address of transmitter ID table 341 lfsr FSR1,opt_transmitter_id_1 ; YES - load base address of transmitter ID table
315 movf gaslist_gas,W ; - (0-4 for OC/Bailout, 5-9 for Diluents) 342 movf gaslist_gas,W ; - (0-4 for OC/Bailout, 5-9 for Diluents)
316 rlncf WREG,W ; - index x2 because IDs are 2 byte 343 rlncf WREG,W ; - index x2 because IDs are 2 byte
317 tstfsz PLUSW1 ; - transmitter ID low byte <> 0 ? 344 tstfsz PLUSW1 ; - transmitter ID low byte <> 0 ?
323 350
324 gaslist_gastitle2: 351 gaslist_gastitle2:
325 rcall gaslist_strcat_gas_type ; print "*" for first gas/dil, "=" for a deco gas or " " else 352 rcall gaslist_strcat_gas_type ; print "*" for first gas/dil, "=" for a deco gas or " " else
326 gaslist_gastitle3: 353 gaslist_gastitle3:
327 call TFT_standard_color 354 call TFT_standard_color
328 btfsc divemode ; in divemode? 355 btfsc divemode ; in dive mode?
329 rcall gaslist_strcat_gas_better ; YES - check if this is a "better gas" 356 rcall gaslist_strcat_gas_better ; YES - check if this is a "better gas"
330 lfsr FSR1,opt_gas_type ; load base address of gas types 357 lfsr FSR1,opt_gas_type ; load base address of gas types
331 movf gaslist_gas,W ; load index into WREG (0-4 for gases, 5-9 for diluents) 358 movf gaslist_gas,W ; load index into WREG (0-4 for gases, 5-9 for diluents)
332 movf PLUSW1,W ; read gas/dil type into WREG 359 movf PLUSW1,W ; read gas/dil type into WREG
333 bnz gaslist_gastitle4 ; type = disabled? NO - keep color 360 bnz gaslist_gastitle4 ; type = disabled? NO - keep color
334 call TFT_disabled_color ; YES - switch color to disabled 361 call TFT_disabled_color ; YES - switch color to disabled
335 bra gaslist_gastitle5 ; - skip ppO2 check for disabled gases 362 bra gaslist_gastitle5 ; - skip ppO2 check for disabled gases
336 gaslist_gastitle4: 363 gaslist_gastitle4:
337 btfss divemode ; in divemode? 364 btfss divemode ; in dive mode?
338 bra gaslist_gastitle5 ; NO - no ppO2 check if not in divemode 365 bra gaslist_gastitle5 ; NO - no ppO2 check if not in dive mode
339 lfsr FSR1,opt_gas_O2_ratio ; YES - load base address of opt_gas_O2_ratio 366 lfsr FSR1,opt_gas_O2_ratio ; YES - load base address of opt_gas_O2_ratio
340 movf gaslist_gas,W ; - load index into WREG (0-4 for gases, 5-9 for diluents) 367 movf gaslist_gas,W ; - load index into WREG (0-4 for gases, 5-9 for diluents)
341 movff PLUSW1,hi ; - read O2 ratio into hi 368 movff PLUSW1,hi ; - read O2 ratio into hi
342 call TFT_color_code_gaslist ; - set color according to ppO2 limits 369 call TFT_color_code_gaslist ; - set color according to ppO2 limits
343 gaslist_gastitle5: 370 gaslist_gastitle5:
344 movf gaslist_gas,W ; copy gas/dil index to WREG (0-9) 371 movf gaslist_gas,W ; copy gas/dil index to WREG (0-9)
345 rcall gaslist_strcat_gas_WREG ; print gas composition 372 rcall gaslist_strcat_gas_WREG ; print gas composition
346 btfss divemode ; in divemode? 373 btfss divemode ; in dive mode?
347 bra gaslist_gastitle6 ; NO - continue printing a space 374 bra gaslist_gastitle6 ; NO - continue printing a space
348 rcall gaslist_strcat_gas_type ; YES - print "*" for first gas/dil, "=" for a deco gas, or a space else 375 rcall gaslist_strcat_gas_type ; YES - print "*" for first gas/dil, "=" for a deco gas, or a space else
349 bra gaslist_gastitle7 ; - continue with change depth 376 bra gaslist_gastitle7 ; - continue with change depth
350 gaslist_gastitle6: 377 gaslist_gastitle6:
351 PUTC " " ; print a space 378 PUTC " " ; print a space
360 movf lo,W 387 movf lo,W
361 mullw .100 ; convert meters to mbar 388 mullw .100 ; convert meters to mbar
362 movff PRODL,lo 389 movff PRODL,lo
363 movff PRODH,hi 390 movff PRODH,hi
364 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet 391 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet
365 ;bsf leftbind
366 output_16_3 ; limit to 999 and display only 0-999 392 output_16_3 ; limit to 999 and display only 0-999
367 STRCAT_TEXT tFeets ; append "ft" REMARK: still one char to long for space available in divemode menu! 393 STRCAT_TEXT tFeets ; append "ft" REMARK: still one char to long for space available in dive mode menu!
368 return 394 return
369 gaslist_strcat_depth_metric: 395 gaslist_strcat_depth_metric:
370 PUTC " " ; print a space 396 ; PUTC " " ; print a space
371 output_99 397 ; output_99
398 output_8
372 STRCAT_TEXT tMeters ; "m" 399 STRCAT_TEXT tMeters ; "m"
373 return 400 return
374 401
402
403 ; check for better gas
404 ;
375 gaslist_strcat_gas_better: ; color-code output if this is the best gas/diluent 405 gaslist_strcat_gas_better: ; color-code output if this is the best gas/diluent
376 btfss better_gas_hint ; shall better gas hints be given? 406 btfss better_gas_hint ; shall better gas hints be given?
377 return ; NO - return 407 return ; NO - return
378 movf best_gas_number,W ; get best gas number into WREG 408 movf best_gas_number,W ; get best gas number into WREG
379 btfsc FLAG_diluent_setup ; in CCR (pSCR) menus? 409 IFDEF _ccr_pscr
410 btfsc is_diluent_menu ; setting up diluents?
380 movf best_dil_number,W ; YES - overwrite with best diluent number 411 movf best_dil_number,W ; YES - overwrite with best diluent number
412 ENDIF
381 tstfsz WREG ; is a best gas/dil available? 413 tstfsz WREG ; is a best gas/dil available?
382 bra gaslist_strcat_gas_better1 ; YES - proceed 414 bra gaslist_strcat_gas_better1 ; YES - proceed
383 return ; NO - return 415 return ; NO - return
384 gaslist_strcat_gas_better1: 416 gaslist_strcat_gas_better1:
385 decf WREG,W ; (1-5) -> (0-4) 417 decf WREG,W ; (1-5) -> (0-4)
386 btfsc FLAG_diluent_setup ; in diluent menus? 418 btfsc is_diluent_menu ; setting up diluents?
387 addlw .5 ; YES - add offset between gases and diluents (0-4) -> (5-9) 419 addlw .5 ; YES - add offset between gases and diluents (0-4) -> (5-9)
388 cpfseq gaslist_gas ; compare with given gas/dil (0-4 for OC bailout gases, 5-9 for diluents) 420 cpfseq gaslist_gas ; compare with given gas/dil (0-4 for OC bailout gases, 5-9 for diluents)
389 return ; not equal - return 421 return ; not equal - return
390 bsf win_invert ; equal - invert 422 bsf win_invert ; equal - invert
391 movlw color_green ; - select green color (gas is something "good") 423 movlw color_green ; - select green color (gas is something "good")
392 goto TFT_set_color ; - activate color and return 424 goto TFT_set_color ; - activate color and return
425
393 426
394 gaslist_strcat_gas_type: 427 gaslist_strcat_gas_type:
395 lfsr FSR1,opt_gas_type ; load base address of gas types 428 lfsr FSR1,opt_gas_type ; load base address of gas types
396 movf gaslist_gas,W ; load index to WREG (0-4 for gases, 5-9 for diluents) 429 movf gaslist_gas,W ; load index to WREG (0-4 for gases, 5-9 for diluents)
397 decf PLUSW1,W ; read gas/dil type into WREG and... 430 decf PLUSW1,W ; read gas/dil type into WREG and...
407 return ; - done 440 return ; - done
408 gaslist_strcat_gas_type_2: 441 gaslist_strcat_gas_type_2:
409 PUTC " " ; neither first nor deco, print a space 442 PUTC " " ; neither first nor deco, print a space
410 return 443 return
411 444
445
412 ;---------------------------------------------------------------------------- 446 ;----------------------------------------------------------------------------
413 ; Housekeeping for the gas/dil settings, e.g. making sure there is one FIRST only 447 ; Housekeeping for the gas/dil settings, e.g. making sure there is one FIRST only
414 ; 448 ;
415 ; Input: gaslist_gas last edited gas/dil (0-9) 449 ; Input: gaslist_gas last edited gas/dil (0-9)
416 450
417 global gaslist_cleanup_list 451 global gaslist_cleanup_list
418 gaslist_cleanup_list: 452 gaslist_cleanup_list:
419 lfsr FSR1,opt_gas_type ; load base address of opt_gas_type 453 lfsr FSR1,opt_gas_type ; load base address of opt_gas_type
454 IFDEF _ccr_pscr
420 movlw .5 ; offset between gases and diluents 455 movlw .5 ; offset between gases and diluents
421 btfsc FLAG_diluent_setup ; in CCR-Menu? 456 btfsc is_diluent_menu ; setting up diluents?
422 subwf gaslist_gas,F ; YES - subtract offset from gaslist_gas: (5-9) -> (0-4) 457 subwf gaslist_gas,F ; YES - subtract offset from gaslist_gas: (5-9) -> (0-4)
458 ENDIF
423 gaslist_cleanup_list0: 459 gaslist_cleanup_list0:
424 bcf ignore_last_edited_gas 460 bcf ignore_last_edited_gas
425 gaslist_cleanup_list1: 461 gaslist_cleanup_list1:
426 clrf lo ; counter for number of "firsts" found 462 clrf lo ; counter for number of "firsts" found
427 movlw .5 ; initialize hi as loop counter for checking 5 gases/diluents 463 movlw .5 ; initialize hi as loop counter for checking 5 gases/diluents
428 movwf hi 464 movwf hi
429 gaslist_cleanup_list2: ; loop body 465 gaslist_cleanup_list2: ; loop body
430 decf hi,W ; WREG = current gas/dil (0-4) 466 decf hi,W ; WREG = current gas/dil (0-4)
431 btfsc FLAG_diluent_setup ; in CCR-Menu? 467 IFDEF _ccr_pscr
468 btfsc is_diluent_menu ; setting up diluents?
432 addlw .5 ; YES - add offset from gases to diluents -> (5-9) 469 addlw .5 ; YES - add offset from gases to diluents -> (5-9)
470 ENDIF
433 movff PLUSW1,WREG ; read type into WREG 471 movff PLUSW1,WREG ; read type into WREG
434 decfsz WREG ; is type = first (ex type code 1)? 472 decfsz WREG ; is type = first (ex type code 1)?
435 bra gaslist_cleanup_list3 ; NO - done with this gas/dil 473 bra gaslist_cleanup_list3 ; NO - done with this gas/dil
436 incf lo,F ; YES - increment number of "firsts" found 474 incf lo,F ; YES - increment number of "firsts" found
437 btfss ignore_last_edited_gas ; - shall we ignore the last edited gas/dil? 475 btfss ignore_last_edited_gas ; - shall we ignore the last edited gas/dil?
439 decf hi,W ; YES - get the current gas/dil as (0-4) 477 decf hi,W ; YES - get the current gas/dil as (0-4)
440 cpfseq gaslist_gas ; - is this the last edited gas/dil? 478 cpfseq gaslist_gas ; - is this the last edited gas/dil?
441 gaslist_cleanup_list2b: 479 gaslist_cleanup_list2b:
442 movff hi,up ; (NO) - remember the last "first gas" found 480 movff hi,up ; (NO) - remember the last "first gas" found
443 gaslist_cleanup_list3: 481 gaslist_cleanup_list3:
444 decfsz hi,F ; decrement loop counter 482 decfsz hi,F ; decrement loop counter, did loop counter became 0?
445 bra gaslist_cleanup_list2 ; loop counter became 0 ? NO - loop 483 bra gaslist_cleanup_list2 ; NO - loop
446 tstfsz lo ; YES - any first gas/dil at all? 484 tstfsz lo ; YES - any first gas/dil at all?
447 bra gaslist_cleanup_list4 ; YES - at least one first gas/dil existing 485 bra gaslist_cleanup_list4 ; YES - at least one first gas/dil existing
448 btfsc FLAG_diluent_setup ; NO - in CCR-Menu? 486 IFDEF _ccr_pscr
449 lfsr FSR1,opt_dil_type ; YES - load base address of opt_gas_type 487 btfsc is_diluent_menu ; NO - setting up diluents?
450 movlw .1 ; - load coding for first gas 488 lfsr FSR1,opt_dil_type ; YES - load base address of opt_gas_type
451 movwf INDF1 ; - make gas/dil 1 the first gas 489 ENDIF
452 return ; - done 490 movlw .1 ; - load coding for first gas
491 movwf INDF1 ; - make gas/dil 1 the first gas
492 bsf option_repaired ; - flag that an option was repaired
493 return ; - done
453 gaslist_cleanup_list4: 494 gaslist_cleanup_list4:
454 movlw .1 495 movlw .1 ; total number of Firsts that should exist is 1
455 cpfsgt lo ; more then one "first gas" found? 496 cpfsgt lo ; more then one "first gas" found?
456 return ; NO - done 497 return ; NO - done
457 decf up,W ; YES - WREG = last found "first gas" - 1 (0-4) 498 decf up,W ; YES - WREG = last found "first gas" - 1 (0-4)
458 cpfseq gaslist_gas ; - is this the last edited gas/dil? 499 cpfseq gaslist_gas ; - is this the last edited gas/dil?
459 bra gaslist_cleanup_list4b ; NO - disable it 500 bra gaslist_cleanup_list4b ; NO - disable it
460 bsf ignore_last_edited_gas ; YES - do not disable last edited gas, search again but ignore the last edited gas 501 bsf ignore_last_edited_gas ; YES - do not disable last edited gas, search again but ignore the last edited gas
461 bra gaslist_cleanup_list1 ; - loop until only one "first" is left over 502 bra gaslist_cleanup_list1 ; - loop until only one "first" is left over
462 gaslist_cleanup_list4b: 503 gaslist_cleanup_list4b:
463 btfsc FLAG_diluent_setup ; in CCR-Menu? 504 IFDEF _ccr_pscr
505 btfsc is_diluent_menu ; setting up diluents?
464 addlw .5 ; YES - adjust offset 506 addlw .5 ; YES - adjust offset
507 ENDIF
465 clrf PLUSW1 ; disable gas 508 clrf PLUSW1 ; disable gas
509 bsf option_repaired ; flag that an option was repaired
466 bra gaslist_cleanup_list0 ; redo from start until only one "first" is left over 510 bra gaslist_cleanup_list0 ; redo from start until only one "first" is left over
467 return 511 return
512
468 513
469 ;---------------------------------------------------------------------------- 514 ;----------------------------------------------------------------------------
470 ; Tank Settings 515 ; Tank Settings
471 ; 516 ;
472 ; Inputs: char_I_tank_size size of the tank, using unit text tLiter ("l") 517 ; Input: char_I_gas_avail_size size of the tank in liters
473 ; char_I_tank_pres_fill fill pressure in multiples of 10 bar, using unit text tbar10 ("0 bar") 518 ; char_I_gas_avail_pres available pressure in multiples of 10 bar
474 519
475 global gaslist_tank_size_pres 520 global gaslist_tank_size_pres
476 gaslist_tank_size_pres: ; dynamic title: xx l, xx0 bar 521 gaslist_tank_size_pres: ; dynamic title: xx l, xx0 bar
477 lfsr FSR1,char_I_tank_size ; load base address of char_I_tank_size 522 lfsr FSR1,char_I_gas_avail_size ; load base address of char_I_gas_avail_size
478 movf gaslist_gas,W ; load index (0-9) 523 movf gaslist_gas,W ; load index (0-9)
479 movff PLUSW1,lo ; read char_I_tank_size[WREG] into lo 524 movff PLUSW1,lo ; read char_I_gas_avail_size[WREG] into lo
480 lfsr FSR1,char_I_tank_pres_fill ; load base address of char_I_tank_pres_fill 525 lfsr FSR1,char_I_gas_avail_pres ; load base address of char_I_gas_avail_pres
481 movff PLUSW1,hi ; read char_I_tank_pres_fill[WREG] into hi 526 movff PLUSW1,hi ; read char_I_gas_avail_pres[WREG] into hi
482 STRCAT " " ; print 5 leading spaces for alignment 527 STRCAT " " ; print 5 leading spaces for alignment
483 output_8 ; print tank size 528 output_8 ; print tank size
484 STRCAT_TEXT tLiter ; print unit (" l") 529 STRCAT_TEXT tLiter ; print unit (" l")
485 movff hi,lo ; copy fill pressure into lo 530 movff hi,lo ; copy fill pressure into lo
486 output_8 ; print fill pressure (it is stored in multiples of 10 bar) 531 output_8 ; print fill pressure (it is stored in multiples of 10 bar)
487 STRCAT_TEXT tbar10 ; print unit ("0 bar") 532 STRCAT_TEXT tbar10 ; print unit ("0 bar")
488 return 533 return
489 534
535
490 global gaslist_tank_size 536 global gaslist_tank_size
491 gaslist_tank_size: ; adjust char_I_tank_size between min_tank_size and max_tank_size 537 gaslist_tank_size: ; adjust char_I_gas_avail_size between min_tank_size and max_tank_size
492 lfsr FSR1,char_I_tank_size ; load base address of char_I_tank_size 538 lfsr FSR1,char_I_gas_avail_size ; load base address of char_I_gas_avail_size
493 movf gaslist_gas,W ; load index (0-9) 539 movf gaslist_gas,W ; load index (0-9)
494 movff PLUSW1,lo ; read char_I_tank_size[WREG] into lo 540 movff PLUSW1,lo ; read char_I_gas_avail_size[WREG] into lo
495 incf lo,F ; increment tank size by 1 liter 541 incf lo,F ; increment tank size by 1 liter
496 movlw max_tank_size ; load max. allowed value into WREG 542 movlw max_tank_size ; load max. allowed value into WREG
497 cpfsgt lo ; tank size <= max value? 543 cpfsgt lo ; tank size <= max value?
498 bra gaslist_tank_size_1 ; YES - new value can be used 544 bra gaslist_tank_size_1 ; YES - new value can be used
499 movlw min_tank_size ; NO - wrap-around to min value 545 movlw min_tank_size ; NO - wrap-around to min value
500 movwf lo ; - and write to lo 546 movwf lo ; - and write to lo
501 gaslist_tank_size_1: 547 gaslist_tank_size_1:
502 movf gaslist_gas,W ; re-load index 548 movf gaslist_gas,W ; re-load index
503 movff lo,PLUSW1 ; write back tank size to char_I_tank_size[WREG] 549 movff lo,PLUSW1 ; write back tank size to char_I_gas_avail_size[WREG]
504 return 550 return
551
505 552
506 global gaslist_tank_pres 553 global gaslist_tank_pres
507 gaslist_tank_pres: ; adjust char_I_tank_pres_fill between 5(0) and 29(0) bar 554 gaslist_tank_pres: ; adjust char_I_gas_avail_pres between 5(0) and 29(0) bar
508 lfsr FSR1,char_I_tank_pres_fill ; load base address of char_I_tank_pres_fill 555 lfsr FSR1,char_I_gas_avail_pres ; load base address of char_I_gas_avail_pres
509 movf gaslist_gas,W ; load index (0-9) 556 movf gaslist_gas,W ; load index (0-9)
510 movff PLUSW1,lo ; read char_I_tank_pres_fill[WREG] into lo 557 movff PLUSW1,lo ; read char_I_gas_avail_pres[WREG] into lo
511 incf lo,F ; increment fill press by by 1(0) bar 558 incf lo,F ; increment fill press by by 1(0) bar
512 movlw max_fill_press ; load max. allowed value into WREG 559 movlw max_fill_press ; load max. allowed value into WREG
513 cpfsgt lo ; press <= max value? 560 cpfsgt lo ; press <= max value?
514 bra gaslist_tank_pres_1 ; YES - new value can be used 561 bra gaslist_tank_pres_1 ; YES - new value can be used
515 movlw min_fill_press ; NO - wrap-around to min value 562 movlw min_fill_press ; NO - wrap-around to min value
516 movwf lo ; - and write to lo 563 movwf lo ; - and write to lo
517 gaslist_tank_pres_1: 564 gaslist_tank_pres_1:
518 movf gaslist_gas,W ; re-load index 565 movf gaslist_gas,W ; re-load index
519 movff lo,PLUSW1 ; write back tank size to char_I_tank_pres_fill[WREG] 566 movff lo,PLUSW1 ; write back tank size to char_I_gas_avail_pres[WREG]
520 return 567 return
521 568
522 ;---------------------------------------------------------------------------- 569
523 ; Transmitter functions 570 ;=============================================================================
524 571
525 IFDEF _rx_functions 572 IFDEF _rx_functions
526 573
574 ; Transmitter functions - ID
575 ;
527 global gaslist_tank_id_pres 576 global gaslist_tank_id_pres
528 gaslist_tank_id_pres: ; dynamic title: shows ID and pressure from transmitter with ID opt_transmitter_id[gaslist_gas] 577 gaslist_tank_id_pres: ; dynamic title: shows ID and pressure from transmitter with ID opt_transmitter_id[gaslist_gas]
529 ; When changing layout, adapt output position TFT_menu_tank_pres! 578 ; When changing layout, adapt output position TFT_menu_tank_pres!
530 STRCAT " ID: " ; print header 579 STRCAT " ID: " ; print header
531 ; get ID ; 580 ; get ID ;
538 ; check if a transmitter is paired to this tank 587 ; check if a transmitter is paired to this tank
539 tstfsz hi ; high byte of ID <> 0 ? 588 tstfsz hi ; high byte of ID <> 0 ?
540 bra gaslist_tank_id_pres_1 ; YES - a transmitter is paired to the tank 589 bra gaslist_tank_id_pres_1 ; YES - a transmitter is paired to the tank
541 tstfsz lo ; low byte of ID <> 0 ? 590 tstfsz lo ; low byte of ID <> 0 ?
542 bra gaslist_tank_id_pres_1 ; YES - a transmitter is paired to the tank 591 bra gaslist_tank_id_pres_1 ; YES - a transmitter is paired to the tank
543 ; no transmitter paired 592 STRCAT "----" ; NO - no transmitter paired
544 STRCAT "----" ; 593 bcf imprint_xmitter_pres ; - stop imprinting of transmitter pressure data
545 bcf menu_update_tank_pres ; stop imprinting of tank pressure updates 594 return ; - done
546 return 595 gaslist_tank_id_pres_1: ; YES - show ID
547 gaslist_tank_id_pres_1: 596 movf hi,W ; - copy high byte of ID to WREG
548 ; show ID 597 output_hex ; - print it
549 movf hi,W ; copy high byte of ID to WREG 598 movf lo,W ; - copy low byte of ID to WREG
550 output_hex ; print it 599 output_hex ; - print it
551 movf lo,W ; copy low byte of ID to WREG 600 bsf imprint_xmitter_pres ; - start imprinting of transmitter pressure data
552 output_hex ; print it 601 return ; - done
553 bsf menu_update_tank_pres ; start imprinting of tank pressure updates 602
554 return 603
555 604 ; Transmitter functions - Pairing
556 605 ;
557 global gaslist_tank_pairing 606 global gaslist_tank_pairing
558 gaslist_tank_pairing: 607 gaslist_tank_pairing:
559 incf pairing_slot,F ; goto next RX data slot 608 incf pairing_slot,F ; goto next RX data slot
560 btfsc pairing_slot,3 ; slot = 8? 609 btfsc pairing_slot,3 ; slot = 8?
561 bra gaslist_tank_pairing_none ; YES - offer unpairing 610 bra gaslist_tank_pairing_none ; YES - offer unpairing
580 clrf lo ; adjust "no transmitter" ID 629 clrf lo ; adjust "no transmitter" ID
581 bra gaslist_tank_pairing_common ; continue with common part 630 bra gaslist_tank_pairing_common ; continue with common part
582 631
583 ENDIF 632 ENDIF
584 633
634 ;=============================================================================
635
585 ;---------------------------------------------------------------------------- 636 ;----------------------------------------------------------------------------
586 ; Increment/Decrement O2 ratio 637 ; Helper Functions for Menu Operations
587 638
639
640 ; Increment O2 ratio
641 ;
588 global gaslist_pO2 642 global gaslist_pO2
589 gaslist_pO2: 643 gaslist_pO2:
590 movf gaslist_gas,W ; load index (0-9) 644 movf gaslist_gas,W ; load index (0-9)
591 lfsr FSR1,opt_gas_He_ratio ; load base address of opt_gas_He_ratio 645 lfsr FSR1,opt_gas_He_ratio ; load base address of opt_gas_He_ratio
592 movff PLUSW1,hi ; read He ratio into hi 646 movff PLUSW1,hi ; read He ratio into hi
593 lfsr FSR1,opt_gas_O2_ratio ; load base address of opt_gas_O2_ratio 647 lfsr FSR1,opt_gas_O2_ratio ; load base address of opt_gas_O2_ratio
594 movff PLUSW1,lo ; read O2 ratio into lo 648 movff PLUSW1,lo ; read O2 ratio into lo
595 649
596 incf lo,F ; O2++ 650 incf lo,F ; O2++
597 movf hi,W ; get He ratio into WREG 651 movf hi,W ; get He ratio into WREG
598 addwf lo,W ; add O2 ratio to WREG 652 addwf lo,W ; add O2 ratio to WREG
599 movwf up ; move sum He + O2 to up 653 movwf up ; move sum He + O2 to up
600 movlw .101 ; 654 movlw .101 ;
601 cpfslt up ; O2 + He < 101? 655 cpfslt up ; O2 + He < 101?
602 decf lo,F ; O2-- (revoke ++) 656 decf lo,F ; O2-- (revoke ++)
603 movf gaslist_gas,W ; re-load index 657 movf gaslist_gas,W ; re-load index
604 movff lo,PLUSW1 ; write back O2 ratio to opt_gas_O2_ratio[WREG] 658 movff lo,PLUSW1 ; write back O2 ratio to opt_gas_O2_ratio[WREG]
605 return 659 return
606 660
661
662 ; Decrement O2 ratio
663 ;
607 global gaslist_mO2 664 global gaslist_mO2
608 gaslist_mO2: 665 gaslist_mO2:
609 movf gaslist_gas,W ; load index (0-9) 666 movf gaslist_gas,W ; load index (0-9)
610 lfsr FSR1,opt_gas_O2_ratio ; load base address of opt_gas_O2_ratio 667 lfsr FSR1,opt_gas_O2_ratio ; load base address of opt_gas_O2_ratio
611 movff PLUSW1,lo ; read O2 ratio into lo 668 movff PLUSW1,lo ; read O2 ratio into lo
618 gaslist_mO2_1: 675 gaslist_mO2_1:
619 movf gaslist_gas,W ; re-load index 676 movf gaslist_gas,W ; re-load index
620 movff lo,PLUSW1 ; write back O2 ratio to opt_gas_O2_ratio[WREG] 677 movff lo,PLUSW1 ; write back O2 ratio to opt_gas_O2_ratio[WREG]
621 return 678 return
622 679
623 ;---------------------------------------------------------------------------- 680 ;=============================================================================
624 ; Increment/Decrement He ratio 681
625 682 IFDEF _helium
683
684 ; Increment He ratio
685 ;
626 global gaslist_pHe 686 global gaslist_pHe
627 gaslist_pHe: 687 gaslist_pHe:
628 movf gaslist_gas,W ; load index (0-9) 688 movf gaslist_gas,W ; load index (0-9)
629 lfsr FSR1,opt_gas_O2_ratio ; load base address of opt_gas_O2_ratio 689 lfsr FSR1,opt_gas_O2_ratio ; load base address of opt_gas_O2_ratio
630 movff PLUSW1,lo ; read O2 ratio into lo 690 movff PLUSW1,lo ; read O2 ratio into lo
640 decf hi,F ; He-- (revoke ++) 700 decf hi,F ; He-- (revoke ++)
641 movf gaslist_gas,W ; re-load index 701 movf gaslist_gas,W ; re-load index
642 movff hi,PLUSW1 ; write back He ratio to opt_gas_He_ratio[WREG] 702 movff hi,PLUSW1 ; write back He ratio to opt_gas_He_ratio[WREG]
643 return 703 return
644 704
705 ; Decrement He ratio
706 ;
645 global gaslist_mHe 707 global gaslist_mHe
646 gaslist_mHe: 708 gaslist_mHe:
647 movf gaslist_gas,W ; load index (0-9) 709 movf gaslist_gas,W ; load index (0-9)
648 lfsr FSR1,opt_gas_He_ratio ; load base address of opt_gas_He_ratio 710 lfsr FSR1,opt_gas_He_ratio ; load base address of opt_gas_He_ratio
649 movff PLUSW1,hi ; read He ratio into hi 711 movff PLUSW1,hi ; read He ratio into hi
654 gaslist_mHe_1: 716 gaslist_mHe_1:
655 movf gaslist_gas,W ; re-load index 717 movf gaslist_gas,W ; re-load index
656 movff hi,PLUSW1 ; write back He ratio to opt_gas_He_ratio[WREG] 718 movff hi,PLUSW1 ; write back He ratio to opt_gas_He_ratio[WREG]
657 return 719 return
658 720
659 ;---------------------------------------------------------------------------- 721 ENDIF ; _helium
660 ; Increment/Decrement switch depth 722
661 723 ;=============================================================================
724
725 ; Increment switch depth
726 ;
662 global gaslist_pDepth 727 global gaslist_pDepth
663 gaslist_pDepth: 728 gaslist_pDepth:
664 lfsr FSR1,opt_gas_change ; load base address of opt_gas_change 729 lfsr FSR1,opt_gas_change ; load base address of opt_gas_change
665 movf gaslist_gas,W ; load index (0-4) 730 movf gaslist_gas,W ; load index (0-4)
666 movff PLUSW1,lo ; read switch depth into lo 731 movff PLUSW1,lo ; read switch depth into lo
672 gaslist_pDepth_1: 737 gaslist_pDepth_1:
673 movf gaslist_gas,W ; re-load index 738 movf gaslist_gas,W ; re-load index
674 movff lo,PLUSW1 ; write back switch depth 739 movff lo,PLUSW1 ; write back switch depth
675 return 740 return
676 741
742
743 ; Decrement switch depth
744 ;
677 global gaslist_mDepth 745 global gaslist_mDepth
678 gaslist_mDepth: 746 gaslist_mDepth:
679 lfsr FSR1,opt_gas_change ; load base address of opt_gas_change 747 lfsr FSR1,opt_gas_change ; load base address of opt_gas_change
680 movf gaslist_gas,W ; load index (0-4) 748 movf gaslist_gas,W ; load index (0-4)
681 movff PLUSW1,lo ; read switch depth into lo 749 movff PLUSW1,lo ; read switch depth into lo
683 btfsc STATUS,N ; did depth became negative? 751 btfsc STATUS,N ; did depth became negative?
684 clrf lo ; YES - reset to zero 752 clrf lo ; YES - reset to zero
685 movff lo,PLUSW1 ; write back switch depth 753 movff lo,PLUSW1 ; write back switch depth
686 return 754 return
687 755
756 ;=============================================================================
757
758 IFDEF _ccr_pscr
759
760 ; Increment setpoint
761 ;
688 global gaslist_spplus 762 global gaslist_spplus
689 gaslist_spplus: 763 gaslist_spplus:
690 movf gaslist_gas,W 764 movf gaslist_gas,W
691 lfsr FSR1,char_I_setpoint_cbar 765 lfsr FSR1,opt_setpoint_cbar
692 movff PLUSW1,lo ; read setpoint 766 movff PLUSW1,lo ; read setpoint
693 movlw gaslist_sp_stepsize 767 movlw gaslist_sp_stepsize
694 addwf lo,F 768 addwf lo,F
695 movlw gaslist_sp_max 769 movlw gaslist_sp_max
696 cpfsgt lo 770 cpfsgt lo
700 gaslist_spplus2: 774 gaslist_spplus2:
701 movf gaslist_gas,W 775 movf gaslist_gas,W
702 movff lo,PLUSW1 ; write back setpoint 776 movff lo,PLUSW1 ; write back setpoint
703 return 777 return
704 778
779
780 ; Increment setpoint switch depth
781 ;
705 global gaslist_spdepthplus 782 global gaslist_spdepthplus
706 gaslist_spdepthplus: 783 gaslist_spdepthplus:
707 movf gaslist_gas,W ; get setpoint number (0-4) 784 movf gaslist_gas,W ; get setpoint number (0-4)
708 bz gaslist_spdepthplus2 ; setpoint number = 0? YES - force depth to always be 0m 785 bz gaslist_spdepthplus2 ; setpoint number = 0? YES - force depth to always be 0m
709 lfsr FSR1,char_I_setpoint_change ; load base address of char_I_setpoint_change 786 lfsr FSR1,opt_setpoint_change ; load base address of opt_setpoint_change
710 movff PLUSW1,lo ; read setpoint depth into lo 787 movff PLUSW1,lo ; read setpoint depth into lo
711 incf lo,F ; increment depth 788 incf lo,F ; increment depth
712 movlw gaslist_max_change_depth ; get max. depth 789 movlw gaslist_max_change_depth ; get max. depth
713 cpfsgt lo ; switch depth > max. depth? 790 cpfsgt lo ; switch depth > max. depth?
714 bra gaslist_spdepthplus_1 ; NO 791 bra gaslist_spdepthplus_1 ; NO
716 gaslist_spdepthplus_1: 793 gaslist_spdepthplus_1:
717 movf gaslist_gas,W ; re-load index 794 movf gaslist_gas,W ; re-load index
718 movff lo,PLUSW1 ; write back setpoint depth 795 movff lo,PLUSW1 ; write back setpoint depth
719 return 796 return
720 797
798
799 ; Decrement set point switch depth
800 ;
721 global gaslist_spdepthminus 801 global gaslist_spdepthminus
722 gaslist_spdepthminus: 802 gaslist_spdepthminus:
723 movf gaslist_gas,W ; get setpoint number (0-4) 803 movf gaslist_gas,W ; get setpoint number (0-4)
724 bz gaslist_spdepthminus2 ; setpoint number = 0? YES - force depth to always be 0m 804 bz gaslist_spdepthminus2 ; setpoint number = 0? YES - force depth to always be 0m
725 lfsr FSR1,char_I_setpoint_change ; load base address of char_I_setpoint_change 805 lfsr FSR1,opt_setpoint_change ; load base address of opt_setpoint_change
726 movff PLUSW1,lo ; read setpoint depth into lo 806 movff PLUSW1,lo ; read setpoint depth into lo
727 decf lo,F ; decrement switch depth 807 decf lo,F ; decrement switch depth
728 btfsc STATUS,N ; did depth became negative? 808 btfsc STATUS,N ; did depth became negative?
729 clrf lo ; YES - reset to zero 809 clrf lo ; YES - reset to zero
730 movff lo,PLUSW1 ; write back setpoint depth 810 movff lo,PLUSW1 ; write back setpoint depth
731 return 811 return
732 812
813
814 ; helper for increment/decrement setpoint switch depth
815 ;
733 gaslist_spdepthplus2: 816 gaslist_spdepthplus2:
734 gaslist_spdepthminus2: 817 gaslist_spdepthminus2:
735 movlw .0 818 movlw .0
736 movff WREG,char_I_setpoint_change+0 ; hard reset to 0m 819 movff WREG,opt_setpoint_change+0; hard reset to 0m
737 return 820 return
821
822 ENDIF ; _ccr_pscr
823
824 ;=============================================================================
738 825
739 826
740 ;---------------------------------------------------------------------------- 827 ;----------------------------------------------------------------------------
741 ; Compute MOD from char_I_ppO2_max/char_I_ppO2_max_deco and current O2 ratio 828 ; Compute MOD from char_I_ppO2_max_work/char_I_ppO2_max_deco and current O2 ratio
742 ; 829 ;
743 ; Input: gaslist_gas = current gas index. 830 ; Input: gaslist_gas = current gas index.
744 ; opt_gas_O2_ratio[gaslist_gas] = current O2 ratio 831 ; opt_gas_O2_ratio[gaslist_gas] = current O2 ratio
745 ; Output: WREG = MOD [m] 832 ; Output: WREG = MOD [m]
746 ; 833 ;
747 gaslist_calc_mod: 834 gaslist_calc_mod:
748 movf gaslist_gas,W ; load index (0...9) 835 movf gaslist_gas,W ; load index (0...9)
749 lfsr FSR1,opt_gas_O2_ratio ; load base address of opt_gas_O2_ratio 836 lfsr FSR1,opt_gas_O2_ratio ; load base address of opt_gas_O2_ratio
750 movff PLUSW1,xB+0 ; read O2 ratio into xB+0 837 movff PLUSW1,xB+0 ; read O2 ratio into xB+0
751 lfsr FSR1,opt_gas_type ; load base address of opt_gas_type 838 lfsr FSR1,opt_gas_type ; load base address of opt_gas_type
752 movff PLUSW1,xA+0 ; read gas/dil type into xA+0 (used as temp here) 839 movff PLUSW1,xA+0 ; read gas/dil type into xA+0 (used as temp here)
753 movff char_I_ppO2_max_deco,xB+1 ; get max ppO2 for deco into xB+1 (used as temp here) 840 movff char_I_ppO2_max_deco,xB+1 ; get max ppO2 for deco into xB+1 (used as temp here)
754 movlw .3 ; type code for deco gases 841 movlw .3 ; type code for deco gases
755 cpfseq xA+0 ; is it a deco gas? 842 cpfseq xA+0 ; is it a deco gas?
756 movff char_I_ppO2_max,xB+1 ; NO - overwrite ppO2 max with none-deco max 843 movff char_I_ppO2_max_work,xB+1 ; NO - overwrite ppO2 max with working phase max
757 movf xB+1,W ; copy resulting ppO2 max into WREG 844 movf xB+1,W ; copy resulting ppO2 max into WREG
758 clrf xB+1 ; clear xB+1 for div16x16 operation 845 clrf xB+1 ; clear xB+1 for div16x16 operation
759 mullw .10 ; multiply ppO2 max value with 10 846 mullw .10 ; multiply ppO2 max value with 10
760 movff PRODL,xA+0 ; copy result to xA 847 MOVII PROD,xA ; copy result to xA
761 movff PRODH,xA+1
762 call div16x16 ; xC = xA / xB with xA as remainder 848 call div16x16 ; xC = xA / xB with xA as remainder
763 movf xC+0,W ; copy result to WREG 849 movf xC+0,W ; copy low byte of the result to WREG
764 addlw -.10 ; subtract 10 cbar 850 addlw -.10 ; subtract 10 cbar
765 return ; return with final result in WREG 851 return ; return with final result [in meters] in WREG
766 852
767 ;---------------------------------------------------------------------------- 853 ;----------------------------------------------------------------------------
768 854
855 ; print ppO2 as x.xx for gas/diluent in gaslist_gas (0-9)
856 ;
769 global gaslist_ppo2 857 global gaslist_ppo2
770 gaslist_ppo2: 858 gaslist_ppo2:
771 STRCAT_TEXT tppO2 ; ppO2: 859 STRCAT_TEXT tppO2 ; ppO2:
772 lfsr FSR1,opt_gas_change ; load base address of opt_gas_change 860 lfsr FSR1,opt_gas_change ; load base address of opt_gas_change
773 movf gaslist_gas,W ; load index (0-9) 861 movf gaslist_gas,W ; load index (0-9)
774 movf PLUSW1,W ; read change depth into WREG 862 movf PLUSW1,W ; read change depth into WREG
775 mullw .10 ; PROD = depth in mbar/10 (100 = 1.00 bar) 863 mullw .10 ; PROD = depth in mbar/10 (100 = 1.00 bar)
776 movlw .100 ; add 1 bar 864 ADDLI .100,PROD ; add 1 bar
777 addwf PRODL,F 865 MOVII PROD,xA ; copy result to xA
778 movlw .0
779 addwfc PRODH,F
780 movff PRODL,xA+0 ; copy result to xA
781 movff PRODH,xA+1
782 lfsr FSR1,opt_gas_O2_ratio ; load base address of opt_gas_O2_ratio 866 lfsr FSR1,opt_gas_O2_ratio ; load base address of opt_gas_O2_ratio
783 movf gaslist_gas,W ; load index (0-9) 867 movf gaslist_gas,W ; load index (0-9)
784 movff PLUSW1,xB+0 ; read O2 ratio into xB+0 868 movff PLUSW1,xB+0 ; read O2 ratio into xB+0
785 clrf xB+1 ; clear xB+1 869 clrf xB+1 ; clear xB+1
786 call mult16x16 ; calculate char_I_O2_ratio * (p_amb/10) 870 call mult16x16 ; calculate char_I_O2_ratio * (p_amb/10)
787 movff xC+0,xA+0 ; copy result to xA 871 MOVII xC,xA ; copy result to xA
788 movff xC+1,xA+1
789 movlw d'100' ; load 100 to xB 872 movlw d'100' ; load 100 to xB
790 movwf xB+0 873 movwf xB+0
791 clrf xB+1 874 clrf xB+1
792 call div16x16 ; xC = xA / xB = (char_I_O2_ratio * p_amb/10)/100 875 call div16x16 ; xC = xA / xB = (char_I_O2_ratio * p_amb/10)/100
793 ; check for very high ppO2 876 ; check for very high ppO2
794 tstfsz xC+2 ; xC+2 remains from mult16x16, xC+2 > 0 (-> ppO2 is > 6.55 bar) ? 877 tstfsz xC+2 ; xC+2 remains from mult16x16, xC+2 > 0 (-> ppO2 is > 6.55 bar) ?
795 bra gaslist_ppo2_1 ; YES - display a fixed max value 878 bra gaslist_ppo2_1 ; YES - display a fixed max value
796 movff xC+0,lo ; copy result to lo, hi 879 MOVII xC,mpr ; copy result to hi:lo
797 movff xC+1,hi
798 bcf ignore_digit4 880 bcf ignore_digit4
799 bsf leftbind 881 bsf leftbind
800 output_16dp d'3' ; print ppO2 as x.xx 882 output_16dp d'3' ; print ppO2 as x.xx
801 STRCAT_TEXT tbar ; print "bar" 883 STRCAT_TEXT tbar ; print "bar"
802 return 884 return
803 gaslist_ppo2_1: 885 gaslist_ppo2_1:
804 STRCAT ">6.6" 886 STRCAT ">6.6"
805 return 887 return
806 888
889
890 ; print MOD and END for gas in gaslist_gas (0-9)
891 ;
807 global gaslist_MOD_END 892 global gaslist_MOD_END
808 gaslist_MOD_END: 893 gaslist_MOD_END:
809 STRCAT_TEXT tMOD ; print "MOD:" 894 STRCAT_TEXT tMOD ; print "MOD:"
810 rcall gaslist_calc_mod ; compute MOD into WREG 895 rcall gaslist_calc_mod ; compute MOD into WREG
811 movwf lo ; copy result to lo 896 movwf lo ; copy result to lo
822 movf gaslist_gas,W ; load index (0...9) 907 movf gaslist_gas,W ; load index (0...9)
823 movf PLUSW1,W ; read He ration into WREG 908 movf PLUSW1,W ; read He ration into WREG
824 subwf xA+0,F ; xA+0 = 100 - He ratio in % 909 subwf xA+0,F ; xA+0 = 100 - He ratio in %
825 clrf xA+1 910 clrf xA+1
826 call mult16x16 ; xA*xB=xC 911 call mult16x16 ; xA*xB=xC
827 movff xC+0,xA+0 912 MOVII xC,xA
828 movff xC+1,xA+1
829 movlw d'100' 913 movlw d'100'
830 movwf xB+0 914 movwf xB+0
831 clrf xB+1 915 clrf xB+1
832 call div16x16 ; xC = xA / xB with xA as remainder 916 call div16x16 ; xC = xA / xB with xA as remainder
833 ; ; xC:2 = ((MOD+10) * 100 - HE Value in %) / 100 917 ; ; xC:2 = ((MOD+10) * 100 - HE Value in %) / 100
835 subwf xC+0,F ; ... 919 subwf xC+0,F ; ...
836 movff xC+0,lo ; copy result to lo 920 movff xC+0,lo ; copy result to lo
837 bra gaslist_strcat_depth ; print depth in meters or feet as configured and return 921 bra gaslist_strcat_depth ; print depth in meters or feet as configured and return
838 922
839 923
924 ; print change depth of gas in gaslist_gas (0-9), use warning color if > MOD
925 ;
840 global gaslist_reset_mod_title 926 global gaslist_reset_mod_title
841 gaslist_reset_mod_title: 927 gaslist_reset_mod_title:
842 STRCAT_TEXT tDepthReset 928 STRCAT_TEXT tDepthReset
843 rcall gaslist_calc_mod ; compute MOD into WREG 929 rcall gaslist_calc_mod ; compute MOD into WREG
844 movwf lo ; copy result to lo 930 movwf lo ; copy result to lo
845 lfsr FSR1,opt_gas_change ; load base address of opt_gas_change 931 lfsr FSR1,opt_gas_change ; load base address of opt_gas_change
846 movf gaslist_gas,W ; load index (0-9) 932 movf gaslist_gas,W ; load index (0-9)
847 movf PLUSW1,W ; read change depth into WREG 933 movf PLUSW1,W ; read change depth into WREG
848 cpfslt lo ; change depth > MOD ? 934 cpfslt lo ; change depth > MOD ?
849 bra gaslist_strcat_depth ; NO - return 935 bra gaslist_strcat_depth ; NO - return
850 call TFT_warnings_color ; YES - use red color 936 call TFT_warning_color ; YES - use red color
851 bra gaslist_strcat_depth ; - return 937 bra gaslist_strcat_depth ; - return
852 938
853 939
940 ; set change depth of gas in gaslist_gas (0-9) to its MOD
941 ;
854 global gaslist_reset_mod 942 global gaslist_reset_mod
855 gaslist_reset_mod: 943 gaslist_reset_mod:
856 rcall gaslist_calc_mod ; compute MOD into WREG 944 rcall gaslist_calc_mod ; compute MOD into WREG
857 movwf lo ; copy result to lo 945 movwf lo ; copy result to lo
858 lfsr FSR1,opt_gas_change ; load base address of opt_gas_change 946 lfsr FSR1,opt_gas_change ; load base address of opt_gas_change
859 movf gaslist_gas,W ; load index (0-9) 947 movf gaslist_gas,W ; load index (0-9)
860 movff lo,PLUSW1 ; write back new change depth 948 movff lo,PLUSW1 ; write back new change depth
861 return 949 return
862 950
863 ;---------------------------------------------------------------------------- 951 ;----------------------------------------------------------------------------
952 ; put "Nxlo", "Txlo/hi", "Air" or "O2" into postinc2
953 ;
954 ; Includes capability to show trimix gases to be able to properly decode data
955 ; from logbook in case trimix dives are stored on an OSTC running the sport FW.
956
957 global gaslist_show_mix
958 gaslist_show_mix:
959 tstfsz hi ; He=0?
960 bra gaslist_show_mix5 ; NO - show a TX
961 movlw .21
962 cpfseq lo ; Air?
963 bra gaslist_show_mix2 ; NO
964 STRCAT_TEXT tSelectAir ; YES - show "Air"
965 bra gaslist_show_mix4b
966 gaslist_show_mix2:
967 movlw .100
968 cpfseq lo ; O2?
969 bra gaslist_show_mix3 ; NO
970 STRCAT_TEXT tSelectO2 ; YES - show "O2"
971 bra gaslist_show_mix4b
972 gaslist_show_mix3:
973 movlw .21
974 cpfslt lo ; < Nx21?
975 bra gaslist_show_mix4 ; NO
976 STRCAT_TEXT tGasErr ; YES - show "Err"
977 output_99 ; O2 ratio is still in "lo"
978 bra gaslist_show_mix4c
979 gaslist_show_mix4:
980 STRCAT_TEXT tSelectNx ; show "Nx"
981 output_99 ; O2 ratio is still in "lo"
982 gaslist_show_mix4b:
983 STRCAT " "
984 gaslist_show_mix4c:
985 btfsc divemode ; in dive mode?
986 return ; YES
987 STRCAT " "
988 return
989 gaslist_show_mix5:
990 btfsc divemode
991 bra gaslist_show_mix6
992 STRCAT_TEXT tSelectTx ; show "Tx"
993 gaslist_show_mix6:
994 output_99 ; O2 ratio is still in "lo"
995 PUTC "/"
996 movff hi,lo
997 output_99 ; He ratio
998 return
999
1000 ;-----------------------------------------------------------------------------
1001
864 END 1002 END