annotate src/gaslist.asm @ 647:357341239438

Merge
author heinrichs weikamp
date Thu, 14 Oct 2021 12:04:12 +0200
parents 4050675965ea
children 75e90cd0c2c3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
heinrichsweikamp
parents:
diff changeset
1 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
2 ;
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
3 ; File gaslist.asm * combined next generation V3.09.5
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
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
12 #include "hwos.inc" ; mandatory header
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
13 #include "convert.inc"
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
14 #include "math.inc" ; div16x16 for MOD calculation
582
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"
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
19 #include "wait.inc"
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
20 #include "rx_ops.inc"
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
21 #include "colorschemes.inc"
0
heinrichsweikamp
parents:
diff changeset
22
heinrichsweikamp
parents:
diff changeset
23
heinrichsweikamp
parents:
diff changeset
24 ;=============================================================================
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
25 gaslist1 CODE
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
26 ;=============================================================================
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
27
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
28 ;-----------------------------------------------------------------------------
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
29 ; Append Mix ("Nxlo", "Txlo/hi", "Air" or "O2") to current String
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
30 ;
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
31 ; Input: PRODL : gas/dil number (0..4)
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
32 ; flag 'is_diluent_menu' for gas/dil selection
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
33 ;
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
34 global gaslist_strcat_mix_PRODL
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
35 gaslist_strcat_mix_PRODL:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
36 movff PRODL,gaslist_gas ; get current menu item (0-4)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
37 movlw .5 ; offset between gases and diluents
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
38 btfsc is_diluent_menu ; setting up diluents?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
39 addwf gaslist_gas,F ; YES - add the offset
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
40 movf gaslist_gas,W ; copy to WREG
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
41 ;bra gaslist_strcat_mix_WREG ; continue
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
42
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
43
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
44 ;-----------------------------------------------------------------------------
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
45 ; Append Mix ("Nxlo", "Txlo/hi", "Air" or "O2") to current String
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
46 ;
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
47 ; Input: WREG : gas/dil number (0..9)
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
48 ;
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
49 global gaslist_strcat_mix_WREG
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
50 gaslist_strcat_mix_WREG: ; entry point with gas/dil in WREG (0-9)
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
51 lfsr FSR1,opt_gas_O2_ratio ; load base address of opt_gas_O2_ratio
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
52 movff PLUSW1,lo ; read O2 ratio
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
53 lfsr FSR1,opt_gas_He_ratio ; load base address of opt_gas_He_ratio
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
54 movff PLUSW1,hi ; read He ratio
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
55 ;bra gaslist_strcat_mix ; put "Nxlo", "Txlo/hi", "Air" or "O2" into Postinc2, and RETURN
0
heinrichsweikamp
parents:
diff changeset
56
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
57
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
58 ;----------------------------------------------------------------------------
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
59 ; Append Mix ("Nxlo", "Txlo/hi", "Air" or "O2") to current String
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
60 ;
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
61 ; Input: lo O2%
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
62 ; hi He%
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
63 ;
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
64 ; Includes capability to show trimix gases to be able to properly decode data
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
65 ; from logbook in case trimix dives are stored on an OSTC running the sport FW
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
66 ;
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
67 global gaslist_strcat_mix
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
68 gaslist_strcat_mix:
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
69 tstfsz hi ; He=0?
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
70 bra gaslist_strcat_mix_5 ; NO - print a TX
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
71
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
72 gaslist_strcat_mix_1:
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
73 movlw .21 ; air is 21% O2
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
74 cpfseq lo ; Air ?
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
75 bra gaslist_strcat_mix_2 ; NO - try next
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
76 STRCAT_TEXT tSelectAir ; YES - print "Air"
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
77 bra gaslist_strcat_mix_4b ; - continue
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
78
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
79 gaslist_strcat_mix_2:
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
80 movlw .100 ; O2 is 100% O2
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
81 cpfseq lo ; O2 ?
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
82 bra gaslist_strcat_mix_3 ; NO - try next
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
83 STRCAT_TEXT tSelectO2 ; YES - print "O2"
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
84 bra gaslist_strcat_mix_4b ; - continue
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
85
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
86 gaslist_strcat_mix_3:
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
87 movlw .21 ; strange mix has no He and O2 < 21%
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
88 cpfslt lo ; < Nx21 ?
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
89 bra gaslist_strcat_mix_4 ; NO - try next
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
90 STRCAT_TEXT tGasErr ; YES - print "Err"
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
91 output_99 ; - print O2%
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
92 bra gaslist_strcat_mix_4c ; - continue
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
93
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
94 gaslist_strcat_mix_4:
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
95 STRCAT_TEXT tSelectNx ; print "Nx"
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
96 output_99 ; print O2%
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
97
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
98 gaslist_strcat_mix_4b:
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
99 STRCAT " " ; print a space
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
100
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
101 gaslist_strcat_mix_4c:
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
102 btfsc divemode ; in dive mode?
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
103 return ; YES - done
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
104 STRCAT " " ; NO - add two spaces
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
105 return ; - done
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
106
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
107 gaslist_strcat_mix_5:
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
108 btfsc divemode ; in dive mode?
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
109 bra gaslist_strcat_mix_6 ; YES - do short version
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
110 STRCAT_TEXT tSelectTx ; NO - print "Tx"
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
111
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
112 gaslist_strcat_mix_6:
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
113 output_99 ; print O2%
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
114 PUTC "/" ; print "/"
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
115 movff hi,lo ; move He% into lo
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
116 output_99 ; print He%
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
117 return ; done
0
heinrichsweikamp
parents:
diff changeset
118
heinrichsweikamp
parents:
diff changeset
119
heinrichsweikamp
parents:
diff changeset
120 ;----------------------------------------------------------------------------
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
121 ; Append full Gas Description to current String
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
122 ;
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
123 ; Prints gas number, * if first, = if deco gas, gas composition and change depth,
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
124 ; including fancy color-coding
0
heinrichsweikamp
parents:
diff changeset
125 ;
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
126 ; Input: PRODL gas number (0..4)
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
127 ; flag 'is_diluent_menu' for gas/dil selection
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
128 ;
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
129 ; NOTE: used in the menu-tree for the MENU_CALLBACK entry
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
130 ;
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
131 global gaslist_strcat_gas_PRODL
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
132 gaslist_strcat_gas_PRODL:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
133 movff PRODL,gaslist_gas ; get current menu item (0-4)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
134 movlw .5 ; offset between gases and diluents
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
135 btfsc is_diluent_menu ; dealing with diluents?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
136 addwf gaslist_gas,F ; YES - add the offset
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
137 ;bra gaslist_strcat_gas ; continue with gaslist_strcat_gas function
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
138
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
139
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
140 ;----------------------------------------------------------------------------
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
141 ; Append full Gas Description to current String
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
142 ;
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
143 ; Print gas number, * if first, = if deco gas, gas composition and change depth,
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
144 ; including fancy color-coding
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
145 ;
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
146 ; Input: gaslist_gas gas/dil number (0..9)
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
147 ;
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
148 ; NOTE: used in the menu-tree for the MENU_CALLBACK entry
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
149 ;
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
150 global gaslist_strcat_gas
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
151 gaslist_strcat_gas:
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
152 btfsc short_gas_descriptions ; shall use short versions of gaslist_strcat_gas_PRODL?
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
153 bra gaslist_gastitle_short ; YES - use short version
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
154 incf gaslist_gas,W ; NO - (0-9) -> (1-10) into WREG
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
155 movwf lo ; - copy gas index to lo
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
156 movlw .6 ; - diluents start with 6
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
157 cpfslt lo ; - gas number < 6 ?
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
158 bra gaslist_gastitle_dil ; NO - it's a diluent
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
159 ;bra gaslist_gastitle_gas ; YES - it's a gas
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
160
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
161 gaslist_gastitle_gas:
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
162 STRCAT_TEXT tGas ; it's a gas
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
163 bra gaslist_gastitle_gas_num ; continue
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
164
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
165 gaslist_gastitle_dil:
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
166 STRCAT_TEXT tDil ; it's a diluent
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
167 movlw .5 ; offset between gases and diluents
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
168 subwf lo,F ; subtract offset from diluent number (6-10) -> (1-5) again
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
169
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
170 gaslist_gastitle_gas_num:
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
171 output_9 ; print gas/dil number (1-5)
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
172 PUTC ":" ; print ":"
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
173
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
174 gaslist_gastitle_short:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
175 btfsc divemode ; in dive mode?
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
176 bra gaslist_gastitle_color_avail; YES - no "*" and "=" in front of gas composition, no highlighting for transmitters paired
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
177
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
178 IFDEF _rx_functions
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
179 btfss tr_functions_activated ; TR functions activated?
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
180 bra gaslist_gastitle_type_1 ; NO - continue with gas type
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
181 lfsr FSR1,opt_transmitter_id_1 ; YES - load base address of transmitter ID table
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
182 movf gaslist_gas,W ; - (0-4 for gases, 5-9 for diluents)
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
183 rlncf WREG,W ; - index x2 because IDs are 2 byte
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
184 tstfsz PLUSW1 ; - transmitter ID low byte <> 0 ?
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
185 bsf win_invert ; YES - flag transmitter paired by inverting output
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
186 incf WREG,W ; - increment index
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
187 tstfsz PLUSW1 ; - transmitter ID high byte <> 0 ?
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
188 bsf win_invert ; YES - flag transmitter paired by inverting output
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
189 ENDIF ; _rx_functions
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
190
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
191 gaslist_gastitle_type_1:
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
192 rcall gaslist_strcat_gas_type ; print type marking ("*", "=", "X", ...)
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
193
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
194 gaslist_gastitle_color_avail:
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
195 FONT_COLOR_MEMO ; default to standard color
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
196 btfsc divemode ; in dive mode?
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
197 rcall gaslist_strcat_gas_better ; YES - check if this is a "better gas", if yes switch to green and inverted output
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
198 lfsr FSR1,opt_gas_type ; load base address of gas types
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
199 movf gaslist_gas,W ; load index into WREG (0-4 for gases, 5-9 for diluents)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
200 movf PLUSW1,W ; read gas/dil type into WREG
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
201 btfsc WREG,gas_lost ; gas/dil lost?
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
202 bra gaslist_gastitle_not_avail ; YES - switch to disabled color and skip ppO2 check
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
203 btfsc WREG,gas_staged ; gas/dil staged?
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
204 bra gaslist_gastitle_not_avail ; YES - switch to disabled color and skip ppO2 check
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
205 bnz gaslist_gastitle_color_ppo2 ; type not disabled -> color code by ppO2
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
206 ;bz gaslist_gastitle_not_avail ; type disabled -> switch to disabled color and skip ppO2 check
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
207
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
208 gaslist_gastitle_not_avail:
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
209 FONT_COLOR_DISABLED ; switch to disabled color
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
210 bra gaslist_gastitle_mix ; skip ppO2 check for disabled gases
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
211
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
212 gaslist_gastitle_color_ppo2:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
213 btfss divemode ; in dive mode?
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
214 bra gaslist_gastitle_mix ; NO - no color-coding if not in dive mode
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
215 btfss color_code_gases ; YES - shall color-code the gases by ppO2 and current depth?
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
216 bra gaslist_gastitle_mix ; NO - skip color-coding
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
217 lfsr FSR1,opt_gas_O2_ratio ; YES - load base address of opt_gas_O2_ratio
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
218 movf gaslist_gas,W ; - load index into WREG (0-4 for gases, 5-9 for diluents)
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
219 movff PLUSW1,hi ; - read O2 ratio into hi
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
220 call TFT_color_code_gaslist ; - set color according to ppO2 limits
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
221
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
222 gaslist_gastitle_mix:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
223 movf gaslist_gas,W ; copy gas/dil index to WREG (0-9)
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
224 rcall gaslist_strcat_mix_WREG ; print gas composition
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
225 btfss divemode ; in dive mode?
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
226 bra gaslist_gastitle_no_type ; NO - print no type marking
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
227 ;bra gaslist_gastitle_type_2 ; YES - print type marking
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
228
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
229 gaslist_gastitle_type_2:
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
230 rcall gaslist_strcat_gas_type ; print type marking ("*", "=", "X", ...)
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
231 bra gaslist_gastitle_depth ; continue with change depth
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
232
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
233 gaslist_gastitle_no_type:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
234 PUTC " " ; print a space
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
235
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
236 gaslist_gastitle_depth:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
237 lfsr FSR1,opt_gas_change ; load base address of change depths
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
238 movf gaslist_gas,W ; load gas/dil index into WREG (0-9)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
239 movff PLUSW1,lo ; read change depth into lo
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
240 ;bra gaslist_strcat_depth ; print depth and return
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
241
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
242
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
243 ;-----------------------------------------------------------------------------
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
244 ; Helper Function - print Depths in Meters or Feet
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
245 ;
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
246 ; input: lo depth in meters
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
247 ;
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
248 gaslist_strcat_depth:
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
249 TSTOSS opt_units ; check depth units
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
250 bra gaslist_strcat_depth_meter ; 0 - use Meters
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
251 ;bra gaslist_strcat_depth_feet ; 1 - use Feet
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
252
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
253 gaslist_strcat_depth_feet:
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
254 call convert_meter_to_feet ; convert value in lo from [m] to [feet]
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
255 output_999 ; print depth (0-999)
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
256 STRCAT_TEXT tFeets ; append "ft" REMARK: still one char to long for space available in dive mode menu!
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
257 return ; done
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
258
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
259 gaslist_strcat_depth_meter:
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
260 output_256 ; print 0-256
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
261 STRCAT_TEXT tMeters ; append "m"
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
262 return ; done
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
263
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
264
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
265 ;-----------------------------------------------------------------------------
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
266 ; Helper Function - color-code Output if this is the best Gas/Diluent
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
267 ;
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
268 gaslist_strcat_gas_better:
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
269 btfss better_gas_hint ; shall better gas cues be given?
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
270 return ; NO - return
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
271 movf best_gas_number,W ; YES - get best gas number into WREG
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
272 IFDEF _ccr_pscr
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
273 btfsc is_diluent_menu ; - setting up diluents?
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
274 movf best_dil_number,W ; YES - replace with best diluent number
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
275 ENDIF ; _ccr_pscr
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
276 tstfsz WREG ; - is a best gas/dil available?
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
277 bra gaslist_strcat_gas_better1 ; YES - proceed
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
278 return ; NO - done
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
279
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
280 gaslist_strcat_gas_better1:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
281 decf WREG,W ; (1-5) -> (0-4)
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
282 btfsc is_diluent_menu ; setting up diluents?
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
283 addlw .5 ; YES - add offset between gases and diluents (0-4) -> (5-9) to better gas number
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
284 cpfseq gaslist_gas ; is the current gas/dil the best one?
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
285 return ; NO - done
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
286 bsf win_invert ; YES - print invert
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
287 FONT_COLOR color_green ; - select green color (gas is something "good")
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
288 return ; - done
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
289
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
290
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
291 ;-----------------------------------------------------------------------------
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
292 ; Helper Function - print "*" for first Gas/Dil
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
293 ; a down arrow for a Work Gas/Dil
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
294 ; "=" for a Deco Gas
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
295 ; " " for a disabled Gas/Dil
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
296 ; "X" for a lost Gas/Dil
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
297 ; "S" for a staged Gas/Dil
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
298 ;
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
299 gaslist_strcat_gas_type:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
300 lfsr FSR1,opt_gas_type ; load base address of gas types
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
301 movf gaslist_gas,W ; load index to WREG (0-4 for gases, 5-9 for diluents)
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
302 movf PLUSW1,W ; get gas/dil type into WREG
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
303 btfsc WREG,gas_lost ; gas set as lost?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
304 bra gaslist_strcat_gas_type_4 ; YES - print lost marking
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
305 IFDEF _cave_mode
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
306 btfsc WREG,gas_staged ; gas set as staged?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
307 bra gaslist_strcat_gas_type_5 ; YES - print staged marking
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
308 ENDIF ; _cave_mode
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
309 decf WREG,W ; decrement gas type (-1 for disabled, 0 for first, 1 for work/normal, 2 for deco)
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
310 bnz gaslist_strcat_gas_type_1 ; type = first? NO - continue with checking for work and deco gas
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
311 PUTC "*" ; YES - print "*" for first
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
312 return ; - done
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
313
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
314 gaslist_strcat_gas_type_1:
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
315 decf WREG,W ; decrement gas type (-2 for disabled, -1 for first, 0 for work/normal, 1 for deco)
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
316 bnz gaslist_strcat_gas_type_2 ; type = work? NO - continue with checking for deco gas
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
317 PUTC "\xb8" ; YES - print down-arrow for a work gas
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
318 return ; - done
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
319
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
320 gaslist_strcat_gas_type_2:
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
321 decf WREG,W ; decrement gas type (-3 for disabled, -2 for first, -1 for work/normal, 0 for deco)
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
322 bnz gaslist_strcat_gas_type_3 ; type = deco? NO - neither first nor deco
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
323 PUTC "=" ; YES - print "=" for a deco gas
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
324 return ; - done
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
325
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
326 gaslist_strcat_gas_type_3:
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
327 PUTC " " ; type = disabled, print a space
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
328 return ; done
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
329
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
330 gaslist_strcat_gas_type_4:
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
331 PUTC "x" ; print lost marking
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
332 return ; done
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
333
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
334 IFDEF _cave_mode
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
335 gaslist_strcat_gas_type_5:
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
336 PUTC "S" ; print staged marking
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
337 return ; done
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
338 ENDIF ; _cave_mode
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
339
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
340
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
341 ;----------------------------------------------------------------------------
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
342 ; Helper Function:
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
343 ; Compute MOD from O2 ratio and char_I_ppO2_max_work / char_I_ppO2_max_deco
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
344 ; Compute MOD from O2 ratio and char_I_ppO2_max_deco
0
heinrichsweikamp
parents:
diff changeset
345 ;
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
346 ; Input: gaslist_gas = current gas index
0
heinrichsweikamp
parents:
diff changeset
347 ; opt_gas_O2_ratio[gaslist_gas] = current O2 ratio
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
348 ; Output: WREG = MOD [m]
0
heinrichsweikamp
parents:
diff changeset
349 ;
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
350 global gaslist_calc_mod
0
heinrichsweikamp
parents:
diff changeset
351 gaslist_calc_mod:
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
352 lfsr FSR1,opt_gas_type ; load base address of opt_gas_type
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
353 movf gaslist_gas,W ; load index (0...9)
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
354 movff PLUSW1,xA+0 ; read gas/dil type into xA+0 (used as temp here)
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
355 movff char_I_ppO2_max_work,xB+1 ; get max ppO2 for deco into xB+1 (used as temp here)
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
356 movlw .3 ; type code for deco gases
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
357 cpfslt xA+0 ; is it a deco gas?
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
358 gaslist_calc_mod_deco:
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
359 movff char_I_ppO2_max_deco,xB+1 ; YES - overwrite/get ppO2 max with/for work
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
360 lfsr FSR1,opt_gas_O2_ratio ; load base address of opt_gas_O2_ratio
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
361 movf gaslist_gas,W ; load index (0...9)
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
362 movff PLUSW1,xB+0 ; read O2 ratio into xB+0
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
363 movf xB+1,W ; copy ppO2 [cbar] max into WREG
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
364 clrf xB+1 ; clear xB+1 for div16x16 operation
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
365 mullw .10 ; multiply ppO2 max value with 10
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
366 MOVII PROD,xA ; copy result to xA
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
367 call div16x16 ; xC = xA / xB with xA as remainder
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
368 movf xC+0,W ; copy low byte of the result to WREG
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
369 addlw -.10 ; subtract 10 m to remove the 1 bar surface pressure
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
370 return ; return with final result [in meters] in WREG
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
371
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
372
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
373 ;=============================================================================
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
374 gaslist2 CODE
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
375 ;=============================================================================
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
376
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
377 ;-----------------------------------------------------------------------------
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
378 ; Clean up the Gas/Diluent Settings so that there is only one FIRST Gas/Diluent
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
379 ;
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
380 ; Input: gaslist_gas last edited gas/dil (0-9)
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
381 ;
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
382 global gaslist_cleanup_list
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
383 gaslist_cleanup_list:
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
384 lfsr FSR1,opt_gas_type ; load base address of opt_gas_type
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
385
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
386 IFDEF _ccr_pscr
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
387 movlw .5 ; offset between gases and diluents
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
388 btfsc is_diluent_menu ; setting up diluents?
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
389 subwf gaslist_gas,F ; YES - subtract offset from gaslist_gas: (5-9) -> (0-4)
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
390 ENDIF ; _ccr_pscr
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
391
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
392 gaslist_cleanup_list_loop_1:
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
393 bcf ignore_last_edited_gas ; allow the last edited gas/dil to be found as a "first"
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
394
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
395 gaslist_cleanup_list_loop_2:
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
396 clrf lo ; clear number of "first" gases found
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
397 movlw .5 ; initialize hi as loop counter for checking 5 gases/diluents
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
398 movwf hi ; ...
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
399
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
400 gaslist_cleanup_list_loop_3:
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
401 decf hi,W ; WREG = current gas/dil to check (4..0)
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
402
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
403 IFDEF _ccr_pscr
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
404 btfsc is_diluent_menu ; setting up diluents?
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
405 addlw .5 ; YES - add offset from gases to diluents -> (9..5)
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
406 ENDIF ; _ccr_pscr
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
407
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
408 movff PLUSW1,WREG ; read type into WREG
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
409 decfsz WREG ; type = first ?
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
410 bra gaslist_cleanup_1 ; NO - done with this gas/dil
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
411 incf lo,F ; YES - increment number of "firsts" found
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
412 btfss ignore_last_edited_gas ; - shall the last edited gas/dil be skipped?
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
413 bra gaslist_cleanup_set_first ; NO - set the currently checked gas/dil as last "first" found
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
414 decf hi,W ; YES - get the currently checked gas/dil (0..4)
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
415 cpfseq gaslist_gas ; - is the currently checked gas/dil == the last edited gas/dil ?
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
416 gaslist_cleanup_set_first:
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
417 movff hi,up ; (NO) - set current gas/dil as the last "first" found (1..5)
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
418
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
419 gaslist_cleanup_1:
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
420 decfsz hi,F ; decrement loop counter, did loop counter became 0?
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
421 bra gaslist_cleanup_list_loop_3 ; NO - check next gas/dil
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
422 tstfsz lo ; YES - any first gas/dil at all?
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
423 bra gaslist_cleanup_list_2 ; YES - one or more "first" gas/dil found
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
424
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
425 IFDEF _ccr_pscr
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
426 btfsc is_diluent_menu ; NO - setting up diluents?
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
427 lfsr FSR1,opt_dil_type ; YES - load base address of opt_gas_type
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
428 ENDIF ; _ccr_pscr
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
429
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
430 movlw .1 ; - load coding for first gas
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
431 movwf INDF1 ; - make gas/dil 1 the first gas
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
432 bsf option_changed ; - flag that the EEPROM needs to be updated
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
433 return ; - done
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
434
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
435 gaslist_cleanup_list_2:
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
436 movlw .1 ; total number of "first" gas/dil allowed is 1
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
437 cpfsgt lo ; more than one "first" found?
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
438 return ; NO - done
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
439 decf up,W ; YES - get last found "first" (0-4)
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
440 cpfseq gaslist_gas ; - is last found "first" == last edited gas/dil ?
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
441 bra gaslist_cleanup_disable ; NO - disable it
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
442 bsf ignore_last_edited_gas ; YES - do not find the last edited gas/dil as "first" any more
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
443 bra gaslist_cleanup_list_loop_2 ; - loop until only one "first" is left over
154
afa31c815f24 NEW: Show ppO2 for change depth during gas setup
heinrichsweikamp
parents: 97
diff changeset
444
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
445 gaslist_cleanup_disable:
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
446 IFDEF _ccr_pscr
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
447 btfsc is_diluent_menu ; setting up diluents?
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
448 addlw .5 ; YES - adjust offset
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
449 ENDIF ; _ccr_pscr
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
450
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
451 clrf PLUSW1 ; disable the gas/dil
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
452 bsf option_changed ; flag that the EEPROM needs to be updated
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
453 bra gaslist_cleanup_list_loop_1 ; redo from start until only one "first" is left over
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
454
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
455
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
456 ;=============================================================================
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
457 gaslist3 CODE
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
458 ;=============================================================================
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
459
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
460 IFDEF _ccr_pscr
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
461
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
462 ;-----------------------------------------------------------------------------
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
463 ; Main Menu Item - print Setpoint by 'PRODL' (dynamic Title)
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
464 ;
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
465 global gaslist_strcat_setpoint_PRODL
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
466 gaslist_strcat_setpoint_PRODL:
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
467 movff PRODL,gaslist_gas ; get current menu item (0-4)
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
468 ;bra gaslist_strcat_setpoint ; continue
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
469
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
470
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
471 ;-----------------------------------------------------------------------------
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
472 ; Main Menu Item - print Setpoint by 'gaslist_gas' (dynamic Title)
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
473 ;
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
474 global gaslist_strcat_setpoint
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
475 gaslist_strcat_setpoint:
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
476 btfsc short_gas_descriptions ; shall use short version?
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
477 bra gaslist_strcat_setpoint2 ; YES - use short version
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
478 STRCAT_TEXT tSP ; "SP"
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
479 incf gaslist_gas,W ; (0-4) -> (1-5) into WREG
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
480 movwf lo ; copy to lo
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
481 output_9 ; print SP number (0-9)
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
482 PUTC ":" ; ":"
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
483
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
484 gaslist_strcat_setpoint2:
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
485 btfsc divemode ; in dive mode?
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
486 bra gaslist_strcat_setpoint4 ; YES - do not add the "*" in dive mode
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
487 movf gaslist_gas,W ; NO - (0-4) into WREG
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
488 bnz gaslist_strcat_setpoint3 ; - SP index = 0 ?
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
489 PUTC "*" ; YES - print *
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
490 bra gaslist_strcat_setpoint4 ; - continue with cbar value
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
491
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
492 gaslist_strcat_setpoint3:
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
493 PUTC " " ; print a space
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
494
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
495 gaslist_strcat_setpoint4:
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
496 movf gaslist_gas,W ; (0-4) into WREG
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
497 lfsr FSR1,opt_setpoint_cbar ; load base address of setpoint cbar values
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
498 movf PLUSW1,W ; read cbar value
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
499 movwf lo ; copy to lo
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
500 bsf decimal_digit2 ; place a decimal point in front of digit 2
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
501 output_256 ; print as x.xx
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
502 btfsc divemode ; in dive mode?
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
503 bra gaslist_strcat_setpoint5 ; YES - skip text in dive mode
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
504 STRCAT_TEXT tbar ; NO - print "bar"
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
505
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
506 gaslist_strcat_setpoint5:
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
507 PUTC " " ; print a space
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
508 movf gaslist_gas,W ; (0-4) into WREG
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
509 lfsr FSR1,opt_setpoint_change ; load base address of switch depths
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
510 movff PLUSW1,lo ; read switch depth into lo
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
511 goto gaslist_strcat_depth ; print depth (meters or ft)
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
512
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
513 ENDIF ; _ccr_pscr
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
514
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
515
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
516 ;=============================================================================
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
517 gaslist4 CODE
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
518 ;=============================================================================
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
519
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
520 ;----------------------------------------------------------------------------
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
521 ; Main Menu Item - print ppO2 at Change Depth (dynamic Title)
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
522 ;
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
523 global gaslist_ppo2
154
afa31c815f24 NEW: Show ppO2 for change depth during gas setup
heinrichsweikamp
parents: 97
diff changeset
524 gaslist_ppo2:
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
525 STRCAT_TEXT tppO2 ; print "ppO2:"
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
526 lfsr FSR1,opt_gas_change ; load base address of opt_gas_change
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
527 movf gaslist_gas,W ; load index (0-9)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
528 movf PLUSW1,W ; read change depth into WREG
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
529 mullw .10 ; PROD = depth in mbar/10 (100 = 1.00 bar)
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
530 ADDLI .100,PROD ; add 1 bar
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
531 MOVII PROD,xA ; copy result to xA
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
532 lfsr FSR1,opt_gas_O2_ratio ; load base address of opt_gas_O2_ratio
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
533 movf gaslist_gas,W ; load index (0-9)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
534 movff PLUSW1,xB+0 ; read O2 ratio into xB+0
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
535 clrf xB+1 ; clear xB+1
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
536 call mult16x16 ; calculate char_I_O2_ratio * (p_amb/10)
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
537 MOVII xC,xA ; copy result to xA
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
538 MOVLI .100,xB ; load 100 to xB
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
539 call div16x16 ; xC = xA / xB = (char_I_O2_ratio * p_amb/10)/100
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
540 ; check for very high ppO2
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
541 tstfsz xC+2 ; xC+2 remains from mult16x16, xC+2 > 0 (-> ppO2 is > 6.55 bar) ?
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
542 bra gaslist_ppo2_2 ; YES - display a fixed max value
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
543 PUTC " " ; NO - print a space
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
544 MOVII xC,mpr ; - copy result to hi:lo
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
545 bsf leftbind ; - print left-aligned
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
546 bsf decimal_digit2 ; - place a decimal point in front of digit 2
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
547 output_999 ; - print ppO2 (0.00-655.35)
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
548 gaslist_ppo2_1:
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
549 STRCAT_TEXT tbar ; - print "bar"
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
550 return ; - done
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
551
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
552 gaslist_ppo2_2:
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
553 STRCAT ">6.55" ; print ">6.55"
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
554 bra gaslist_ppo2_1 ; append unit and return
154
afa31c815f24 NEW: Show ppO2 for change depth during gas setup
heinrichsweikamp
parents: 97
diff changeset
555
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
556
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
557 ;-----------------------------------------------------------------------------
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
558 ; Main Menu Item - print MOD and END for a Gas (dynamic Title)
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
559 ;
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
560 global gaslist_MOD_END
0
heinrichsweikamp
parents:
diff changeset
561 gaslist_MOD_END:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
562 STRCAT_TEXT tMOD ; print "MOD:"
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
563 call gaslist_calc_mod ; compute MOD into WREG
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
564 movwf lo ; copy result to lo
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
565 movwf hi ; keep copy in hi
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
566 call gaslist_strcat_depth ; print depth in meters or feet as configured
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
567 PUTC "/" ; print "/"
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
568 STRCAT_TEXT tEND ; print "END:"
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
569 movf hi,W ; retrieve MOD
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
570 addlw .10 ; compute MOD = MOD + 10m
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
571 movwf xB+0 ; copy to xB
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
572 clrf xB+1 ; ...
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
573 MOVLI .100,xA ; load 100 to xA
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
574 lfsr FSR1,opt_gas_He_ratio ; load base address of opt_gas_He_ratio
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
575 movf gaslist_gas,W ; load index (0...9)
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
576 movf PLUSW1,W ; read He ratio into WREG
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
577 subwf xA+0,F ; xA = 100 - He ratio in %
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
578 call mult16x16 ; xC = xA * xB
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
579 MOVII xC,xA ; copy result to xA
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
580 MOVLI .100,xB ; load 100 to xB
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
581 call div16x16 ; xC = xA / xB with xA as remainder
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
582 ; ; xC:2 = ((MOD+10) * 100 - HE Value in %) / 100
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
583 movlw d'10' ; subtract 10 m
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
584 subwf xC+0,F ; ...
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
585 movff xC+0,lo ; copy result to lo
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
586 goto gaslist_strcat_depth ; print depth and return
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
587
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
588
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
589 ;-----------------------------------------------------------------------------
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
590 ; Main Menu Item - print 'reset to MOD' (dynamic Title)
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
591 ;
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
592 global gaslist_reset_mod_title
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
593 gaslist_reset_mod_title:
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
594 STRCAT_TEXT tDepthReset ; print "Reset to MOD:"
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
595 PUTC " " ; add a space char
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
596 lfsr FSR1,opt_gas_change ; load base address of opt_gas_change
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
597 movf gaslist_gas,W ; load index (0-9)
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
598 movff PLUSW1,hi ; read change depth into hi
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
599 call gaslist_calc_mod ; compute MOD for ppO2 max work/deco dependent on gas type into WREG
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
600 movwf lo ; copy (true) MOD to lo
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
601 movf hi,W ; copy change depth to WREG
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
602 cpfslt lo ; change depth > MOD ?
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
603 bra gaslist_reset_mod_title_exit; NO - print MOD from value in lo
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
604 FONT_COLOR_ATTENTION ; YES - use attention color
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
605 call gaslist_calc_mod_deco ; - compute MOD for ppO2 max deco into WREG
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
606 movwf up ; - copy result to up
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
607 movf hi,W ; - copy change depth to WREG again
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
608 cpfslt up ; - change depth > MOD deco ?
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
609 bra gaslist_reset_mod_title_exit; NO - print MOD from value in lo, keeping attention color
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
610 FONT_COLOR_WARNING ; YES - switch to warning color
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
611 ;bra gaslist_reset_mod_title_exit; - print MOD depth
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
612
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
613 gaslist_reset_mod_title_exit:
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 631
diff changeset
614 goto gaslist_strcat_depth ; print MOD depth and return
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
615
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
616 ;-----------------------------------------------------------------------------
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
617
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
618 END