annotate src/simulator.asm @ 295:7027d735ac62

NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
author jDG
date Sun, 31 May 2015 02:14:09 +0200
parents f97e439d711c
children af13a18a233b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
heinrichsweikamp
parents:
diff changeset
1 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
2 ;
heinrichsweikamp
parents:
diff changeset
3 ; File simulator.asm
heinrichsweikamp
parents:
diff changeset
4 ;
heinrichsweikamp
parents:
diff changeset
5 ; Decoplan interface to C model code.
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-07-09 : [jDG] Creation...
heinrichsweikamp
parents:
diff changeset
11
275
653a3ab08062 rename into hwOS
heinrichsweikamp
parents: 255
diff changeset
12 #include "hwos.inc" ; Mandatory include.
0
heinrichsweikamp
parents:
diff changeset
13 #include "convert.inc" ; output_*
heinrichsweikamp
parents:
diff changeset
14 #include "shared_definitions.h" ; Mailbox from/to p2_deco.c
heinrichsweikamp
parents:
diff changeset
15 #include "strings.inc" ; STRCPY,...
heinrichsweikamp
parents:
diff changeset
16 #include "tft.inc" ; WIN_LEFT,...
heinrichsweikamp
parents:
diff changeset
17 #include "wait.inc" ; speed_*
heinrichsweikamp
parents:
diff changeset
18 #include "start.inc"
heinrichsweikamp
parents:
diff changeset
19 #include "divemode.inc"
heinrichsweikamp
parents:
diff changeset
20 #include "math.inc"
heinrichsweikamp
parents:
diff changeset
21 #include "eeprom_rs232.inc"
50
ec4d8503ec45 NEW: user-selectable color schemes
heinrichsweikamp
parents: 46
diff changeset
22 #include "tft_outputs.inc"
0
heinrichsweikamp
parents:
diff changeset
23
heinrichsweikamp
parents:
diff changeset
24 gui CODE
heinrichsweikamp
parents:
diff changeset
25
heinrichsweikamp
parents:
diff changeset
26 extern deco_clear_tissue
heinrichsweikamp
parents:
diff changeset
27 extern deco_push_tissues_to_vault
heinrichsweikamp
parents:
diff changeset
28 extern deco_calc_dive_interval
heinrichsweikamp
parents:
diff changeset
29 extern deco_calc_hauptroutine
heinrichsweikamp
parents:
diff changeset
30 extern deco_calc_tissue
heinrichsweikamp
parents:
diff changeset
31 extern deco_calc_CNS_fraction
heinrichsweikamp
parents:
diff changeset
32 extern deco_calc_CNS_planning
heinrichsweikamp
parents:
diff changeset
33 extern deco_pull_tissues_from_vault
208
53771bd3d567 NEW: Show plan parameters in decoplan result page
heinrichsweikamp
parents: 197
diff changeset
34 extern TFT_display_decotype_surface1
0
heinrichsweikamp
parents:
diff changeset
35
heinrichsweikamp
parents:
diff changeset
36 extern log_screendump_and_onesecond, logbook_preloop_tasks
208
53771bd3d567 NEW: Show plan parameters in decoplan result page
heinrichsweikamp
parents: 197
diff changeset
37 extern do_planner_menu
0
heinrichsweikamp
parents:
diff changeset
38
heinrichsweikamp
parents:
diff changeset
39 ;---- Private temp variables -------------------------------------------------
heinrichsweikamp
parents:
diff changeset
40 CBLOCK tmp+0x10 ; Reserved space for wordprocessor and convert
heinrichsweikamp
parents:
diff changeset
41 decoplan_index ; within each page
heinrichsweikamp
parents:
diff changeset
42 decoplan_gindex ; global index
heinrichsweikamp
parents:
diff changeset
43 decoplan_last ; Depth of last stop (CF#29)
heinrichsweikamp
parents:
diff changeset
44 decoplan_flags ; Various private flags.
heinrichsweikamp
parents:
diff changeset
45 decoplan_CNS:2 ; Backup CNS before vault restore
255
ad62dff7739a add bearing option to compass
heinrichsweikamp
parents: 225
diff changeset
46 decoplan_page ; page number
ad62dff7739a add bearing option to compass
heinrichsweikamp
parents: 225
diff changeset
47 ; Reserved to tmp+0x16...
0
heinrichsweikamp
parents:
diff changeset
48 ENDC
heinrichsweikamp
parents:
diff changeset
49 #define decoplan_last_ceiling_shown decoplan_flags,0
heinrichsweikamp
parents:
diff changeset
50
heinrichsweikamp
parents:
diff changeset
51 ;---- Demo decoplanner -------------------------------------------------------
heinrichsweikamp
parents:
diff changeset
52 global do_demo_planner
heinrichsweikamp
parents:
diff changeset
53
heinrichsweikamp
parents:
diff changeset
54 do_demo_planner:
208
53771bd3d567 NEW: Show plan parameters in decoplan result page
heinrichsweikamp
parents: 197
diff changeset
55 btfsc FLAG_gauge_mode ; =1: In Gauge mode
53771bd3d567 NEW: Show plan parameters in decoplan result page
heinrichsweikamp
parents: 197
diff changeset
56 goto do_planner_menu
53771bd3d567 NEW: Show plan parameters in decoplan result page
heinrichsweikamp
parents: 197
diff changeset
57 btfsc FLAG_apnoe_mode ; =1: In Apnea mode
53771bd3d567 NEW: Show plan parameters in decoplan result page
heinrichsweikamp
parents: 197
diff changeset
58 goto do_planner_menu
0
heinrichsweikamp
parents:
diff changeset
59 ; call deco_reset ; TODO: remove reset all Decodata
208
53771bd3d567 NEW: Show plan parameters in decoplan result page
heinrichsweikamp
parents: 197
diff changeset
60 rcall deco_planer
53771bd3d567 NEW: Show plan parameters in decoplan result page
heinrichsweikamp
parents: 197
diff changeset
61 rcall deco_show_plan
0
heinrichsweikamp
parents:
diff changeset
62 goto do_planner_menu
heinrichsweikamp
parents:
diff changeset
63
heinrichsweikamp
parents:
diff changeset
64 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
65 ; Pass all parameters to the C code
heinrichsweikamp
parents:
diff changeset
66 ;
heinrichsweikamp
parents:
diff changeset
67
heinrichsweikamp
parents:
diff changeset
68 global get_first_dil_to_WREG
heinrichsweikamp
parents:
diff changeset
69 get_first_dil_to_WREG: ; Gets first dil (0-4) into WREG
heinrichsweikamp
parents:
diff changeset
70 lfsr FSR1,opt_dil_type ; Point to dil types
heinrichsweikamp
parents:
diff changeset
71 clrf lo ; start with Gas0
81
8e13866b5496 add some extra safety checks when settings were altered from the PC software
mh@mh-THINK.localdomain
parents: 50
diff changeset
72 get_first_dil_to_WREG2:
8e13866b5496 add some extra safety checks when settings were altered from the PC software
mh@mh-THINK.localdomain
parents: 50
diff changeset
73 movf lo,W ;
8e13866b5496 add some extra safety checks when settings were altered from the PC software
mh@mh-THINK.localdomain
parents: 50
diff changeset
74 movf PLUSW1,W ; Get Type of Dil #lo
8e13866b5496 add some extra safety checks when settings were altered from the PC software
mh@mh-THINK.localdomain
parents: 50
diff changeset
75 sublw .1 ; it is = 1 (First Dil)
8e13866b5496 add some extra safety checks when settings were altered from the PC software
mh@mh-THINK.localdomain
parents: 50
diff changeset
76 bz get_first_dil_to_WREG3 ; Found the first dil!
8e13866b5496 add some extra safety checks when settings were altered from the PC software
mh@mh-THINK.localdomain
parents: 50
diff changeset
77 incf lo,F ; ++
8e13866b5496 add some extra safety checks when settings were altered from the PC software
mh@mh-THINK.localdomain
parents: 50
diff changeset
78 movlw NUM_GAS+1
8e13866b5496 add some extra safety checks when settings were altered from the PC software
mh@mh-THINK.localdomain
parents: 50
diff changeset
79 cpfseq lo ; All done?
8e13866b5496 add some extra safety checks when settings were altered from the PC software
mh@mh-THINK.localdomain
parents: 50
diff changeset
80 bra get_first_dil_to_WREG2 ; Not yet
8e13866b5496 add some extra safety checks when settings were altered from the PC software
mh@mh-THINK.localdomain
parents: 50
diff changeset
81 ; No first dil found, use #1
8e13866b5496 add some extra safety checks when settings were altered from the PC software
mh@mh-THINK.localdomain
parents: 50
diff changeset
82 movlw .1
8e13866b5496 add some extra safety checks when settings were altered from the PC software
mh@mh-THINK.localdomain
parents: 50
diff changeset
83 movff WREG,opt_dil_type+0 ; Set Dil1 to First
8e13866b5496 add some extra safety checks when settings were altered from the PC software
mh@mh-THINK.localdomain
parents: 50
diff changeset
84 return
8e13866b5496 add some extra safety checks when settings were altered from the PC software
mh@mh-THINK.localdomain
parents: 50
diff changeset
85 get_first_dil_to_WREG3:
8e13866b5496 add some extra safety checks when settings were altered from the PC software
mh@mh-THINK.localdomain
parents: 50
diff changeset
86 movf lo,W ; Put into Wreg
8e13866b5496 add some extra safety checks when settings were altered from the PC software
mh@mh-THINK.localdomain
parents: 50
diff changeset
87 return ; Done
0
heinrichsweikamp
parents:
diff changeset
88
heinrichsweikamp
parents:
diff changeset
89 global get_first_gas_to_WREG
heinrichsweikamp
parents:
diff changeset
90 get_first_gas_to_WREG: ; Gets first gas (0-4) into WREG
heinrichsweikamp
parents:
diff changeset
91 lfsr FSR1,opt_gas_type ; Point to gas types
heinrichsweikamp
parents:
diff changeset
92 clrf lo ; start with Gas0
heinrichsweikamp
parents:
diff changeset
93 get_first_gas_to_WREG2:
heinrichsweikamp
parents:
diff changeset
94 movf lo,W ;
heinrichsweikamp
parents:
diff changeset
95 movf PLUSW1,W ; Get Type of Gas #lo
heinrichsweikamp
parents:
diff changeset
96 sublw .1 ; it is = 1 (First Gas)
heinrichsweikamp
parents:
diff changeset
97 bz get_first_gas_to_WREG3 ; Found the first gas!
heinrichsweikamp
parents:
diff changeset
98 incf lo,F ; ++
heinrichsweikamp
parents:
diff changeset
99 movlw NUM_GAS+1
heinrichsweikamp
parents:
diff changeset
100 cpfseq lo ; All done?
heinrichsweikamp
parents:
diff changeset
101 bra get_first_gas_to_WREG2 ; Not yet
81
8e13866b5496 add some extra safety checks when settings were altered from the PC software
mh@mh-THINK.localdomain
parents: 50
diff changeset
102 ; No first gas found, use #1
8e13866b5496 add some extra safety checks when settings were altered from the PC software
mh@mh-THINK.localdomain
parents: 50
diff changeset
103 movlw .1
8e13866b5496 add some extra safety checks when settings were altered from the PC software
mh@mh-THINK.localdomain
parents: 50
diff changeset
104 movff WREG,opt_gas_type+0 ; Set Gas1 to First
8e13866b5496 add some extra safety checks when settings were altered from the PC software
mh@mh-THINK.localdomain
parents: 50
diff changeset
105 return
0
heinrichsweikamp
parents:
diff changeset
106 get_first_gas_to_WREG3:
heinrichsweikamp
parents:
diff changeset
107 movf lo,W ; Put into Wreg
heinrichsweikamp
parents:
diff changeset
108 return ; Done
heinrichsweikamp
parents:
diff changeset
109
heinrichsweikamp
parents:
diff changeset
110 deco_setup:
heinrichsweikamp
parents:
diff changeset
111 banksel char_I_step_is_1min ; Select the right bank...
heinrichsweikamp
parents:
diff changeset
112 clrf char_I_step_is_1min ; Default to 2sec steps.
46
05227510cae0 Bugfix: deco gas init in OC planner
heinrichsweikamp
parents: 40
diff changeset
113 clrf char_I_const_ppO2 ; Clear for OC, will be set for CC later
0
heinrichsweikamp
parents:
diff changeset
114
heinrichsweikamp
parents:
diff changeset
115 ; Fixed ambient surface pressure to 1bar.
heinrichsweikamp
parents:
diff changeset
116 movlw LOW(.1000)
heinrichsweikamp
parents:
diff changeset
117 movwf int_I_pres_surface+0
heinrichsweikamp
parents:
diff changeset
118 movwf int_I_pres_respiration+0
heinrichsweikamp
parents:
diff changeset
119 movlw HIGH(.1000)
heinrichsweikamp
parents:
diff changeset
120 movwf int_I_pres_surface+1
heinrichsweikamp
parents:
diff changeset
121 movwf int_I_pres_respiration+1
heinrichsweikamp
parents:
diff changeset
122
46
05227510cae0 Bugfix: deco gas init in OC planner
heinrichsweikamp
parents: 40
diff changeset
123 clrf int_I_divemins+0 ; Dive start
0
heinrichsweikamp
parents:
diff changeset
124 clrf int_I_divemins+1
46
05227510cae0 Bugfix: deco gas init in OC planner
heinrichsweikamp
parents: 40
diff changeset
125 banksel common ; Bank1
05227510cae0 Bugfix: deco gas init in OC planner
heinrichsweikamp
parents: 40
diff changeset
126 bcf use_agf ; =1: Use aGF
05227510cae0 Bugfix: deco gas init in OC planner
heinrichsweikamp
parents: 40
diff changeset
127
40
1e2d2b0bca5b Bugfix: Simulator in CC mode
mh@mh-THINK.fritz.box
parents: 9
diff changeset
128 rcall deco_setup_dive
0
heinrichsweikamp
parents:
diff changeset
129
46
05227510cae0 Bugfix: deco gas init in OC planner
heinrichsweikamp
parents: 40
diff changeset
130 ; Setup char_I_const_ppO2 for CC modes
05227510cae0 Bugfix: deco gas init in OC planner
heinrichsweikamp
parents: 40
diff changeset
131 btfsc FLAG_ccr_mode ; =1: CCR mode (Fixed ppO2 or Sensor) active
40
1e2d2b0bca5b Bugfix: Simulator in CC mode
mh@mh-THINK.fritz.box
parents: 9
diff changeset
132 movff char_I_setpoint_cbar+0,char_I_const_ppO2 ; Setup fixed Setpoint (Always start with SP1)
1e2d2b0bca5b Bugfix: Simulator in CC mode
mh@mh-THINK.fritz.box
parents: 9
diff changeset
133
1e2d2b0bca5b Bugfix: Simulator in CC mode
mh@mh-THINK.fritz.box
parents: 9
diff changeset
134 rcall get_first_gas_to_WREG ; Gets first gas (0-4) into WREG
0
heinrichsweikamp
parents:
diff changeset
135 movff WREG,char_I_first_gas ; Copy for compatibility
197
3bbfac29ba3e cleanup
heinrichsweikamp
parents: 189
diff changeset
136 banksel char_I_first_gas
3bbfac29ba3e cleanup
heinrichsweikamp
parents: 189
diff changeset
137 incf char_I_first_gas,F ; 0-4 -> 1-5
3bbfac29ba3e cleanup
heinrichsweikamp
parents: 189
diff changeset
138 banksel common
0
heinrichsweikamp
parents:
diff changeset
139 extern setup_gas_registers
heinrichsweikamp
parents:
diff changeset
140 call setup_gas_registers ; With WREG=Gas 0-4, set current N2/He/O2 ratios.
heinrichsweikamp
parents:
diff changeset
141 extern set_actual_ppo2
heinrichsweikamp
parents:
diff changeset
142 call set_actual_ppo2 ; Then configure char_I_actual_ppO2 (For CNS)
40
1e2d2b0bca5b Bugfix: Simulator in CC mode
mh@mh-THINK.fritz.box
parents: 9
diff changeset
143 return
0
heinrichsweikamp
parents:
diff changeset
144
heinrichsweikamp
parents:
diff changeset
145 global deco_setup_dive
heinrichsweikamp
parents:
diff changeset
146 deco_setup_dive: ; Called from divemode
heinrichsweikamp
parents:
diff changeset
147 banksel common ; Bank1
heinrichsweikamp
parents:
diff changeset
148
97
53a99a2dc6a1 CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents: 94
diff changeset
149 btfsc FLAG_ccr_mode ; =1: CCR mode (Fixed ppO2 or Sensor) active
53a99a2dc6a1 CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents: 94
diff changeset
150 rcall deco_setup_cc_diluents ; Setup CC Diluents
0
heinrichsweikamp
parents:
diff changeset
151 btfss FLAG_ccr_mode ; =1: CCR mode (Fixed ppO2 or Sensor) active
heinrichsweikamp
parents:
diff changeset
152 rcall deco_setup_oc_gases ; Setup OC Gases
heinrichsweikamp
parents:
diff changeset
153 btfsc is_bailout ; =1: Bailout
heinrichsweikamp
parents:
diff changeset
154 rcall deco_setup_oc_gases ; Setup OC/Bailout Gases
heinrichsweikamp
parents:
diff changeset
155
178
39f6c07ce2f6 BUGFIX: Average depth computation
heinrichsweikamp
parents: 174
diff changeset
156 movff divemins+0,int_I_divemins+0 ; Current dive time.
39f6c07ce2f6 BUGFIX: Average depth computation
heinrichsweikamp
parents: 174
diff changeset
157 movff divemins+1,int_I_divemins+1
39f6c07ce2f6 BUGFIX: Average depth computation
heinrichsweikamp
parents: 174
diff changeset
158
0
heinrichsweikamp
parents:
diff changeset
159 movlw deco_distance
heinrichsweikamp
parents:
diff changeset
160 movff WREG,char_I_deco_distance
heinrichsweikamp
parents:
diff changeset
161 movff opt_last_stop,char_I_depth_last_deco
heinrichsweikamp
parents:
diff changeset
162 movff opt_GF_low,char_I_GF_Low_percentage
heinrichsweikamp
parents:
diff changeset
163 movff opt_GF_high,char_I_GF_High_percentage
heinrichsweikamp
parents:
diff changeset
164 ;Overwrite GF if aGF is wanted
heinrichsweikamp
parents:
diff changeset
165 btfsc use_agf ; =1: Use aGF
heinrichsweikamp
parents:
diff changeset
166 movff opt_aGF_low,char_I_GF_Low_percentage
heinrichsweikamp
parents:
diff changeset
167 btfsc use_agf ; =1: Use aGF
heinrichsweikamp
parents:
diff changeset
168 movff opt_aGF_high,char_I_GF_High_percentage
heinrichsweikamp
parents:
diff changeset
169 return
heinrichsweikamp
parents:
diff changeset
170
heinrichsweikamp
parents:
diff changeset
171 deco_setup_cc_diluents:
heinrichsweikamp
parents:
diff changeset
172 movff opt_dil_He_ratio+0,char_I_deco_He_ratio+0
heinrichsweikamp
parents:
diff changeset
173 movff char_I_deco_He_ratio+0,lo
heinrichsweikamp
parents:
diff changeset
174 movff opt_dil_O2_ratio+0,WREG
heinrichsweikamp
parents:
diff changeset
175 addwf lo,W ; O2 + He -> WREG
heinrichsweikamp
parents:
diff changeset
176 sublw .100 ; 100 - (O2 + He) -> WREG
heinrichsweikamp
parents:
diff changeset
177 movff WREG,char_I_deco_N2_ratio+0
heinrichsweikamp
parents:
diff changeset
178 movff opt_dil_type+0,WREG ; 0=Disabled, 1=First, 2=Normal
heinrichsweikamp
parents:
diff changeset
179 tstfsz WREG ; Disabled?
heinrichsweikamp
parents:
diff changeset
180 bra $+4 ; No
97
53a99a2dc6a1 CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents: 94
diff changeset
181 movff WREG,char_I_dil_change+0 ; Yes, clear char_I_deco_gas_change
0
heinrichsweikamp
parents:
diff changeset
182
heinrichsweikamp
parents:
diff changeset
183 movff opt_dil_He_ratio+1,char_I_deco_He_ratio+1
heinrichsweikamp
parents:
diff changeset
184 movff char_I_deco_He_ratio+1,lo
heinrichsweikamp
parents:
diff changeset
185 movff opt_dil_O2_ratio+1,WREG
heinrichsweikamp
parents:
diff changeset
186 addwf lo,W ; O2 + He -> WREG
heinrichsweikamp
parents:
diff changeset
187 sublw .100 ; 100 - (O2 + He) -> WREG
heinrichsweikamp
parents:
diff changeset
188 movff WREG,char_I_deco_N2_ratio+1
heinrichsweikamp
parents:
diff changeset
189 movff opt_dil_type+1,WREG ; 0=Disabled, 1=First, 2=Normal
heinrichsweikamp
parents:
diff changeset
190 tstfsz WREG ; Disabled?
heinrichsweikamp
parents:
diff changeset
191 bra $+4 ; No
97
53a99a2dc6a1 CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents: 94
diff changeset
192 movff WREG,char_I_dil_change+1 ; Yes, clear char_I_dil_change
0
heinrichsweikamp
parents:
diff changeset
193
heinrichsweikamp
parents:
diff changeset
194 movff opt_dil_He_ratio+2,char_I_deco_He_ratio+2
heinrichsweikamp
parents:
diff changeset
195 movff char_I_deco_He_ratio+2,lo
heinrichsweikamp
parents:
diff changeset
196 movff opt_dil_O2_ratio+2,WREG
heinrichsweikamp
parents:
diff changeset
197 addwf lo,W ; O2 + He -> WREG
heinrichsweikamp
parents:
diff changeset
198 sublw .100 ; 100 - (O2 + He) -> WREG
heinrichsweikamp
parents:
diff changeset
199 movff WREG,char_I_deco_N2_ratio+2
heinrichsweikamp
parents:
diff changeset
200 movff opt_dil_type+2,WREG ; 0=Disabled, 1=First, 2=Normal
heinrichsweikamp
parents:
diff changeset
201 tstfsz WREG ; Disabled?
heinrichsweikamp
parents:
diff changeset
202 bra $+4 ; No
97
53a99a2dc6a1 CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents: 94
diff changeset
203 movff WREG,char_I_dil_change+2 ; Yes, clear char_I_dil_change
0
heinrichsweikamp
parents:
diff changeset
204
heinrichsweikamp
parents:
diff changeset
205 movff opt_dil_He_ratio+3,char_I_deco_He_ratio+3
heinrichsweikamp
parents:
diff changeset
206 movff char_I_deco_He_ratio+3,lo
heinrichsweikamp
parents:
diff changeset
207 movff opt_dil_O2_ratio+3,WREG
heinrichsweikamp
parents:
diff changeset
208 addwf lo,W ; O2 + He -> WREG
heinrichsweikamp
parents:
diff changeset
209 sublw .100 ; 100 - (O2 + He) -> WREG
heinrichsweikamp
parents:
diff changeset
210 movff WREG,char_I_deco_N2_ratio+3
heinrichsweikamp
parents:
diff changeset
211 movff opt_dil_type+3,WREG ; 0=Disabled, 1=First, 2=Normal
heinrichsweikamp
parents:
diff changeset
212 tstfsz WREG ; Disabled?
heinrichsweikamp
parents:
diff changeset
213 bra $+4 ; No
97
53a99a2dc6a1 CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents: 94
diff changeset
214 movff WREG,char_I_dil_change+3 ; Yes, clear char_I_dil_change
0
heinrichsweikamp
parents:
diff changeset
215
heinrichsweikamp
parents:
diff changeset
216 movff opt_dil_He_ratio+4,char_I_deco_He_ratio+4
heinrichsweikamp
parents:
diff changeset
217 movff char_I_deco_He_ratio+4,lo
heinrichsweikamp
parents:
diff changeset
218 movff opt_dil_O2_ratio+4,WREG
heinrichsweikamp
parents:
diff changeset
219 addwf lo,W ; O2 + He -> WREG
heinrichsweikamp
parents:
diff changeset
220 sublw .100 ; 100 - (O2 + He) -> WREG
heinrichsweikamp
parents:
diff changeset
221 movff WREG,char_I_deco_N2_ratio+4
heinrichsweikamp
parents:
diff changeset
222 movff opt_dil_type+4,WREG ; 0=Disabled, 1=First, 2=Normal
heinrichsweikamp
parents:
diff changeset
223 tstfsz WREG ; Disabled?
heinrichsweikamp
parents:
diff changeset
224 bra $+4 ; No
97
53a99a2dc6a1 CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents: 94
diff changeset
225 movff WREG,char_I_dil_change+4 ; Yes, clear char_I_dil_change
53a99a2dc6a1 CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents: 94
diff changeset
226
53a99a2dc6a1 CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents: 94
diff changeset
227 ; Setup char_I_deco_gas_change array
53a99a2dc6a1 CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents: 94
diff changeset
228 movff char_I_dil_change+0, char_I_deco_gas_change+0
53a99a2dc6a1 CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents: 94
diff changeset
229 movff char_I_dil_change+1, char_I_deco_gas_change+1
53a99a2dc6a1 CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents: 94
diff changeset
230 movff char_I_dil_change+2, char_I_deco_gas_change+2
53a99a2dc6a1 CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents: 94
diff changeset
231 movff char_I_dil_change+3, char_I_deco_gas_change+3
53a99a2dc6a1 CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents: 94
diff changeset
232 movff char_I_dil_change+4, char_I_deco_gas_change+4
0
heinrichsweikamp
parents:
diff changeset
233 return
heinrichsweikamp
parents:
diff changeset
234
heinrichsweikamp
parents:
diff changeset
235 deco_setup_oc_gases:
heinrichsweikamp
parents:
diff changeset
236 movff opt_gas_He_ratio+0,char_I_deco_He_ratio+0
heinrichsweikamp
parents:
diff changeset
237 movff char_I_deco_He_ratio+0,lo
heinrichsweikamp
parents:
diff changeset
238 movff opt_gas_O2_ratio+0,WREG
heinrichsweikamp
parents:
diff changeset
239 addwf lo,W ; O2 + He -> WREG
heinrichsweikamp
parents:
diff changeset
240 sublw .100 ; 100 - (O2 + He) -> WREG
heinrichsweikamp
parents:
diff changeset
241 movff WREG,char_I_deco_N2_ratio+0
174
932e91074bdb CHANGE: Clarify Travel Gases with "---" as change depth
heinrichsweikamp
parents: 148
diff changeset
242 banksel opt_gas_type+0
932e91074bdb CHANGE: Clarify Travel Gases with "---" as change depth
heinrichsweikamp
parents: 148
diff changeset
243 movlw .3 ; 3=Deco
932e91074bdb CHANGE: Clarify Travel Gases with "---" as change depth
heinrichsweikamp
parents: 148
diff changeset
244 cpfseq opt_gas_type+0 ; Gas is deco type?
932e91074bdb CHANGE: Clarify Travel Gases with "---" as change depth
heinrichsweikamp
parents: 148
diff changeset
245 clrf opt_OC_bail_gas_change+0 ; No, clear depth for 0=Disabled, 1=First and 2=Travel
932e91074bdb CHANGE: Clarify Travel Gases with "---" as change depth
heinrichsweikamp
parents: 148
diff changeset
246 banksel common
0
heinrichsweikamp
parents:
diff changeset
247
heinrichsweikamp
parents:
diff changeset
248 movff opt_gas_He_ratio+1,char_I_deco_He_ratio+1
heinrichsweikamp
parents:
diff changeset
249 movff char_I_deco_He_ratio+1,lo
heinrichsweikamp
parents:
diff changeset
250 movff opt_gas_O2_ratio+1,WREG
heinrichsweikamp
parents:
diff changeset
251 addwf lo,W ; O2 + He -> WREG
heinrichsweikamp
parents:
diff changeset
252 sublw .100 ; 100 - (O2 + He) -> WREG
heinrichsweikamp
parents:
diff changeset
253 movff WREG,char_I_deco_N2_ratio+1
174
932e91074bdb CHANGE: Clarify Travel Gases with "---" as change depth
heinrichsweikamp
parents: 148
diff changeset
254 banksel opt_gas_type+1
932e91074bdb CHANGE: Clarify Travel Gases with "---" as change depth
heinrichsweikamp
parents: 148
diff changeset
255 movlw .3 ; 3=Deco
932e91074bdb CHANGE: Clarify Travel Gases with "---" as change depth
heinrichsweikamp
parents: 148
diff changeset
256 cpfseq opt_gas_type+1 ; Gas is deco type?
932e91074bdb CHANGE: Clarify Travel Gases with "---" as change depth
heinrichsweikamp
parents: 148
diff changeset
257 clrf opt_OC_bail_gas_change+1 ; No, clear depth for 0=Disabled, 1=First and 2=Travel
932e91074bdb CHANGE: Clarify Travel Gases with "---" as change depth
heinrichsweikamp
parents: 148
diff changeset
258 banksel common
0
heinrichsweikamp
parents:
diff changeset
259
heinrichsweikamp
parents:
diff changeset
260 movff opt_gas_He_ratio+2,char_I_deco_He_ratio+2
heinrichsweikamp
parents:
diff changeset
261 movff char_I_deco_He_ratio+2,lo
heinrichsweikamp
parents:
diff changeset
262 movff opt_gas_O2_ratio+2,WREG
heinrichsweikamp
parents:
diff changeset
263 addwf lo,W ; O2 + He -> WREG
heinrichsweikamp
parents:
diff changeset
264 sublw .100 ; 100 - (O2 + He) -> WREG
heinrichsweikamp
parents:
diff changeset
265 movff WREG,char_I_deco_N2_ratio+2
174
932e91074bdb CHANGE: Clarify Travel Gases with "---" as change depth
heinrichsweikamp
parents: 148
diff changeset
266 banksel opt_gas_type+2
932e91074bdb CHANGE: Clarify Travel Gases with "---" as change depth
heinrichsweikamp
parents: 148
diff changeset
267 movlw .3 ; 3=Deco
932e91074bdb CHANGE: Clarify Travel Gases with "---" as change depth
heinrichsweikamp
parents: 148
diff changeset
268 cpfseq opt_gas_type+2 ; Gas is deco type?
932e91074bdb CHANGE: Clarify Travel Gases with "---" as change depth
heinrichsweikamp
parents: 148
diff changeset
269 clrf opt_OC_bail_gas_change+2 ; No, clear depth for 0=Disabled, 1=First and 2=Travel
932e91074bdb CHANGE: Clarify Travel Gases with "---" as change depth
heinrichsweikamp
parents: 148
diff changeset
270 banksel common
0
heinrichsweikamp
parents:
diff changeset
271
heinrichsweikamp
parents:
diff changeset
272 movff opt_gas_He_ratio+3,char_I_deco_He_ratio+3
heinrichsweikamp
parents:
diff changeset
273 movff char_I_deco_He_ratio+3,lo
heinrichsweikamp
parents:
diff changeset
274 movff opt_gas_O2_ratio+3,WREG
heinrichsweikamp
parents:
diff changeset
275 addwf lo,W ; O2 + He -> WREG
heinrichsweikamp
parents:
diff changeset
276 sublw .100 ; 100 - (O2 + He) -> WREG
heinrichsweikamp
parents:
diff changeset
277 movff WREG,char_I_deco_N2_ratio+3
174
932e91074bdb CHANGE: Clarify Travel Gases with "---" as change depth
heinrichsweikamp
parents: 148
diff changeset
278 banksel opt_gas_type+3
932e91074bdb CHANGE: Clarify Travel Gases with "---" as change depth
heinrichsweikamp
parents: 148
diff changeset
279 movlw .3 ; 3=Deco
932e91074bdb CHANGE: Clarify Travel Gases with "---" as change depth
heinrichsweikamp
parents: 148
diff changeset
280 cpfseq opt_gas_type+3 ; Gas is deco type?
932e91074bdb CHANGE: Clarify Travel Gases with "---" as change depth
heinrichsweikamp
parents: 148
diff changeset
281 clrf opt_OC_bail_gas_change+3 ; No, clear depth for 0=Disabled, 1=First and 2=Travel
932e91074bdb CHANGE: Clarify Travel Gases with "---" as change depth
heinrichsweikamp
parents: 148
diff changeset
282 banksel common
0
heinrichsweikamp
parents:
diff changeset
283
heinrichsweikamp
parents:
diff changeset
284 movff opt_gas_He_ratio+4,char_I_deco_He_ratio+4
heinrichsweikamp
parents:
diff changeset
285 movff char_I_deco_He_ratio+4,lo
heinrichsweikamp
parents:
diff changeset
286 movff opt_gas_O2_ratio+4,WREG
heinrichsweikamp
parents:
diff changeset
287 addwf lo,W ; O2 + He -> WREG
heinrichsweikamp
parents:
diff changeset
288 sublw .100 ; 100 - (O2 + He) -> WREG
heinrichsweikamp
parents:
diff changeset
289 movff WREG,char_I_deco_N2_ratio+4
174
932e91074bdb CHANGE: Clarify Travel Gases with "---" as change depth
heinrichsweikamp
parents: 148
diff changeset
290 banksel opt_gas_type+4
932e91074bdb CHANGE: Clarify Travel Gases with "---" as change depth
heinrichsweikamp
parents: 148
diff changeset
291 movlw .3 ; 3=Deco
932e91074bdb CHANGE: Clarify Travel Gases with "---" as change depth
heinrichsweikamp
parents: 148
diff changeset
292 cpfseq opt_gas_type+4 ; Gas is deco type?
932e91074bdb CHANGE: Clarify Travel Gases with "---" as change depth
heinrichsweikamp
parents: 148
diff changeset
293 clrf opt_OC_bail_gas_change+4 ; No, clear depth for 0=Disabled, 1=First and 2=Travel
932e91074bdb CHANGE: Clarify Travel Gases with "---" as change depth
heinrichsweikamp
parents: 148
diff changeset
294 banksel common
94
f2201aa374db BUGFIX: compass calibration does now timeout automatically after 60s
heinrichsweikamp
parents: 81
diff changeset
295
f2201aa374db BUGFIX: compass calibration does now timeout automatically after 60s
heinrichsweikamp
parents: 81
diff changeset
296 movlw .0
f2201aa374db BUGFIX: compass calibration does now timeout automatically after 60s
heinrichsweikamp
parents: 81
diff changeset
297 movff WREG,char_I_const_ppO2 ; Clear constant ppO2 for OC/bailout
97
53a99a2dc6a1 CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents: 94
diff changeset
298
53a99a2dc6a1 CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents: 94
diff changeset
299 ; Setup char_I_deco_gas_change array
53a99a2dc6a1 CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents: 94
diff changeset
300 movff opt_OC_bail_gas_change+0, char_I_deco_gas_change+0
53a99a2dc6a1 CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents: 94
diff changeset
301 movff opt_OC_bail_gas_change+1, char_I_deco_gas_change+1
53a99a2dc6a1 CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents: 94
diff changeset
302 movff opt_OC_bail_gas_change+2, char_I_deco_gas_change+2
53a99a2dc6a1 CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents: 94
diff changeset
303 movff opt_OC_bail_gas_change+3, char_I_deco_gas_change+3
53a99a2dc6a1 CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents: 94
diff changeset
304 movff opt_OC_bail_gas_change+4, char_I_deco_gas_change+4
0
heinrichsweikamp
parents:
diff changeset
305 return
heinrichsweikamp
parents:
diff changeset
306
heinrichsweikamp
parents:
diff changeset
307 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
308 ; Reset decompression tissues
heinrichsweikamp
parents:
diff changeset
309 ;
heinrichsweikamp
parents:
diff changeset
310 global deco_reset
heinrichsweikamp
parents:
diff changeset
311 deco_reset:
heinrichsweikamp
parents:
diff changeset
312 rcall deco_setup ; Setup all model parameters.
heinrichsweikamp
parents:
diff changeset
313 call deco_clear_tissue ; Set all tissues to Pamb * N2_ratio
heinrichsweikamp
parents:
diff changeset
314 call deco_clear_CNS_fraction ; Reset CNS value.
heinrichsweikamp
parents:
diff changeset
315 banksel common ; Bank1
heinrichsweikamp
parents:
diff changeset
316 return
heinrichsweikamp
parents:
diff changeset
317
heinrichsweikamp
parents:
diff changeset
318 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
319 ; Launch decoplanning
heinrichsweikamp
parents:
diff changeset
320 ;
heinrichsweikamp
parents:
diff changeset
321 global deco_planer
heinrichsweikamp
parents:
diff changeset
322 deco_planer:
heinrichsweikamp
parents:
diff changeset
323 call speed_fastest ; Quick !
heinrichsweikamp
parents:
diff changeset
324 rcall deco_setup ; Setup all model parameters.
heinrichsweikamp
parents:
diff changeset
325 call deco_push_tissues_to_vault
heinrichsweikamp
parents:
diff changeset
326 banksel common ; Bank1
heinrichsweikamp
parents:
diff changeset
327
heinrichsweikamp
parents:
diff changeset
328 ;---- Specific settings ------------------------------------------------------
295
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 294
diff changeset
329 deco_planer_redo:
0
heinrichsweikamp
parents:
diff changeset
330 banksel char_O_deco_status ; Bank 2
heinrichsweikamp
parents:
diff changeset
331 movlw .3 ; Start in surface state.
heinrichsweikamp
parents:
diff changeset
332 movwf char_O_deco_status
heinrichsweikamp
parents:
diff changeset
333
heinrichsweikamp
parents:
diff changeset
334 banksel char_I_step_is_1min ; Bank 3
heinrichsweikamp
parents:
diff changeset
335 movlw 1
heinrichsweikamp
parents:
diff changeset
336 movwf char_I_step_is_1min ; Set 1min steps
heinrichsweikamp
parents:
diff changeset
337
heinrichsweikamp
parents:
diff changeset
338 ;---- Add delay at surface, if needed ----------------------------------------
heinrichsweikamp
parents:
diff changeset
339 tstfsz char_I_dive_interval
heinrichsweikamp
parents:
diff changeset
340 call deco_calc_dive_interval
heinrichsweikamp
parents:
diff changeset
341
heinrichsweikamp
parents:
diff changeset
342 ;---- Dive loop --------------------------------------------------------------
heinrichsweikamp
parents:
diff changeset
343
heinrichsweikamp
parents:
diff changeset
344 ; Compute dive ambiant conditions
heinrichsweikamp
parents:
diff changeset
345 banksel char_I_bottom_depth
heinrichsweikamp
parents:
diff changeset
346 movf char_I_bottom_depth,W
heinrichsweikamp
parents:
diff changeset
347 mullw .100
heinrichsweikamp
parents:
diff changeset
348 movlw LOW(.1000)
heinrichsweikamp
parents:
diff changeset
349 addwf PRODL,W
heinrichsweikamp
parents:
diff changeset
350 movwf int_I_pres_respiration+0
heinrichsweikamp
parents:
diff changeset
351 movlw HIGH(.1000)
heinrichsweikamp
parents:
diff changeset
352 addwfc PRODH,W
heinrichsweikamp
parents:
diff changeset
353 movwf int_I_pres_respiration+1
heinrichsweikamp
parents:
diff changeset
354
heinrichsweikamp
parents:
diff changeset
355 banksel int_I_divemins ; Bank 4
heinrichsweikamp
parents:
diff changeset
356 clrf int_I_divemins+0 ; Clear dive time
heinrichsweikamp
parents:
diff changeset
357 clrf int_I_divemins+1
heinrichsweikamp
parents:
diff changeset
358
heinrichsweikamp
parents:
diff changeset
359 clrf TMR5L
heinrichsweikamp
parents:
diff changeset
360 clrf TMR5H ; 30,51757813µs/bit in TMR5L:TMR5H
heinrichsweikamp
parents:
diff changeset
361 call deco_calc_hauptroutine ; Reset + simulate first min.
heinrichsweikamp
parents:
diff changeset
362
heinrichsweikamp
parents:
diff changeset
363 deco_planer_loop:
heinrichsweikamp
parents:
diff changeset
364 banksel int_I_divemins ; Bank 3
heinrichsweikamp
parents:
diff changeset
365 incf int_I_divemins,F ; Done 1 min.
heinrichsweikamp
parents:
diff changeset
366 btg LEDg
heinrichsweikamp
parents:
diff changeset
367
heinrichsweikamp
parents:
diff changeset
368 movf char_I_bottom_time,W ; Finished ?
heinrichsweikamp
parents:
diff changeset
369 xorwf int_I_divemins,W
heinrichsweikamp
parents:
diff changeset
370 bz deco_planer_endloop ; YES
111
c61b7a4e317c Bugfix: CNS in planner
heinrichsweikamp
parents: 97
diff changeset
371
0
heinrichsweikamp
parents:
diff changeset
372 call deco_calc_tissue ; JUST calc tissue (faster).
heinrichsweikamp
parents:
diff changeset
373 call deco_calc_CNS_fraction ; Also calculate CNS (in 1min loop)
heinrichsweikamp
parents:
diff changeset
374 bra deco_planer_loop
heinrichsweikamp
parents:
diff changeset
375
heinrichsweikamp
parents:
diff changeset
376 deco_planer_endloop:
heinrichsweikamp
parents:
diff changeset
377 banksel char_I_step_is_1min
heinrichsweikamp
parents:
diff changeset
378 clrf char_I_step_is_1min ; Back to 2sec loops
heinrichsweikamp
parents:
diff changeset
379
heinrichsweikamp
parents:
diff changeset
380 ;---- Wait until status reach zero -------------------------------------------
heinrichsweikamp
parents:
diff changeset
381 deco_planer_finishing:
heinrichsweikamp
parents:
diff changeset
382 btg LEDg
295
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 294
diff changeset
383 ; clrf TMR5L
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 294
diff changeset
384 ; clrf TMR5H ; 30,51757813µs/bit in TMR5L:TMR5H
0
heinrichsweikamp
parents:
diff changeset
385 call deco_calc_hauptroutine ; Simulate 2sec more
heinrichsweikamp
parents:
diff changeset
386
heinrichsweikamp
parents:
diff changeset
387 banksel char_O_deco_status ; Bank 2
heinrichsweikamp
parents:
diff changeset
388 movf char_O_deco_status,W
295
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 294
diff changeset
389 bnz deco_planer_finishing
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 294
diff changeset
390
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 294
diff changeset
391 ;---- Optional extra cycle to recompute stops in bailout mode ---------------
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 294
diff changeset
392 banksel common
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 294
diff changeset
393 btfss is_bailout ; Doing a bailout decoplan ?
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 294
diff changeset
394 bra deco_planer_finished ; NO: so we are done.
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 294
diff changeset
395
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 294
diff changeset
396 rcall deco_setup_oc_gases ; Switch to OC gas and no const_ppO2
0
heinrichsweikamp
parents:
diff changeset
397
295
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 294
diff changeset
398 movlw .3 ; restart 2sec cycles.
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 294
diff changeset
399 movff WREG,char_O_deco_status
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 294
diff changeset
400 call deco_calc_hauptroutine ; Reset + simulate first 2secs.
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 294
diff changeset
401
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 294
diff changeset
402 deco_planer_bail_loop:
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 294
diff changeset
403 btg LEDg
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 294
diff changeset
404 ; clrf TMR5L
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 294
diff changeset
405 ; clrf TMR5H ; 30,51757813µs/bit in TMR5L:TMR5H
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 294
diff changeset
406 call deco_calc_hauptroutine ; Simulate 2sec more
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 294
diff changeset
407
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 294
diff changeset
408 banksel char_O_deco_status ; Bank 2
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 294
diff changeset
409 movf char_O_deco_status,W
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 294
diff changeset
410 bnz deco_planer_bail_loop
0
heinrichsweikamp
parents:
diff changeset
411
heinrichsweikamp
parents:
diff changeset
412 deco_planer_finished:
heinrichsweikamp
parents:
diff changeset
413 call deco_calc_CNS_planning
heinrichsweikamp
parents:
diff changeset
414 movff int_O_CNS_fraction+0,decoplan_CNS+0
heinrichsweikamp
parents:
diff changeset
415 movff int_O_CNS_fraction+1,decoplan_CNS+1
heinrichsweikamp
parents:
diff changeset
416 call deco_pull_tissues_from_vault
heinrichsweikamp
parents:
diff changeset
417 bcf LEDg
heinrichsweikamp
parents:
diff changeset
418 banksel common ; Bank1
heinrichsweikamp
parents:
diff changeset
419 movlw b'00111000' ; 1:8 Prescaler -> 65,536ms@16MHz
heinrichsweikamp
parents:
diff changeset
420 movwf T3CON
heinrichsweikamp
parents:
diff changeset
421 call speed_normal
heinrichsweikamp
parents:
diff changeset
422 return
heinrichsweikamp
parents:
diff changeset
423
heinrichsweikamp
parents:
diff changeset
424 ;-----------------------------------------------------------------------------
heinrichsweikamp
parents:
diff changeset
425 ; Draw a stop of the deco plan (simulator or dive).
heinrichsweikamp
parents:
diff changeset
426 ; Inputs: lo = depth. Range 3m...93m
heinrichsweikamp
parents:
diff changeset
427 ; + 80 if this is a switch-gas stop.
heinrichsweikamp
parents:
diff changeset
428 ; up = minutes. range 1'..240'.
heinrichsweikamp
parents:
diff changeset
429 ; win_top = line to draw on screen.
heinrichsweikamp
parents:
diff changeset
430 ; Trashed: up, lo, win_height, win_leftx2, win_width, win_color*,
heinrichsweikamp
parents:
diff changeset
431 ; WREG, PROD, TBLPTR TABLAT.
heinrichsweikamp
parents:
diff changeset
432 ;
heinrichsweikamp
parents:
diff changeset
433 deco_plan_show_stop:
heinrichsweikamp
parents:
diff changeset
434 ;---- Print depth ----------------------------------------------------
heinrichsweikamp
parents:
diff changeset
435 btfss lo,7 ; Bit set ?
heinrichsweikamp
parents:
diff changeset
436 bra deco_plan_show_std_stop ; No : Just an usual stop.
heinrichsweikamp
parents:
diff changeset
437
50
ec4d8503ec45 NEW: user-selectable color schemes
heinrichsweikamp
parents: 46
diff changeset
438 call TFT_attention_color
0
heinrichsweikamp
parents:
diff changeset
439 bcf lo,7 ; and cleanup depth.
heinrichsweikamp
parents:
diff changeset
440 bra deco_plan_show_nstd_stop
heinrichsweikamp
parents:
diff changeset
441
heinrichsweikamp
parents:
diff changeset
442 deco_plan_show_std_stop:
50
ec4d8503ec45 NEW: user-selectable color schemes
heinrichsweikamp
parents: 46
diff changeset
443 call TFT_standard_color
0
heinrichsweikamp
parents:
diff changeset
444
heinrichsweikamp
parents:
diff changeset
445 deco_plan_show_nstd_stop:
heinrichsweikamp
parents:
diff changeset
446 lfsr FSR2,buffer
heinrichsweikamp
parents:
diff changeset
447
heinrichsweikamp
parents:
diff changeset
448 TSTOSS opt_units ; 0=Meters, 1=Feets
heinrichsweikamp
parents:
diff changeset
449 bra deco_plan_show_nstd_stop_metric
heinrichsweikamp
parents:
diff changeset
450
heinrichsweikamp
parents:
diff changeset
451 WIN_LEFT .85
heinrichsweikamp
parents:
diff changeset
452 movf lo,W ; lo = m
heinrichsweikamp
parents:
diff changeset
453 mullw .100 ; PRODL:PRODH = mbar
heinrichsweikamp
parents:
diff changeset
454 movff PRODL,lo
heinrichsweikamp
parents:
diff changeset
455 movff PRODH,hi
heinrichsweikamp
parents:
diff changeset
456 ; Convert with 334feet/100m to have 10ft, 20ft, 30ft stops...
heinrichsweikamp
parents:
diff changeset
457 movff lo,xA+0
heinrichsweikamp
parents:
diff changeset
458 movff hi,xA+1
heinrichsweikamp
parents:
diff changeset
459 movlw LOW d'334' ; 334feet/100m
heinrichsweikamp
parents:
diff changeset
460 movwf xB+0
heinrichsweikamp
parents:
diff changeset
461 movlw HIGH d'334'
heinrichsweikamp
parents:
diff changeset
462 movwf xB+1
heinrichsweikamp
parents:
diff changeset
463 call mult16x16 ; xA*xB=xC (lo:hi * 328)
heinrichsweikamp
parents:
diff changeset
464 movlw d'50' ; round up
heinrichsweikamp
parents:
diff changeset
465 addwf xC+0,F
heinrichsweikamp
parents:
diff changeset
466 movlw 0
heinrichsweikamp
parents:
diff changeset
467 addwfc xC+1,F
heinrichsweikamp
parents:
diff changeset
468 addwfc xC+2,F
heinrichsweikamp
parents:
diff changeset
469 addwfc xC+3,F
heinrichsweikamp
parents:
diff changeset
470 movlw d'100'
heinrichsweikamp
parents:
diff changeset
471 movwf xB+0
heinrichsweikamp
parents:
diff changeset
472 clrf xB+1
heinrichsweikamp
parents:
diff changeset
473 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder
heinrichsweikamp
parents:
diff changeset
474 movff xC+0,lo
heinrichsweikamp
parents:
diff changeset
475 movff xC+1,hi ; restore lo and hi with updated value
heinrichsweikamp
parents:
diff changeset
476 bsf leftbind
heinrichsweikamp
parents:
diff changeset
477 bsf ignore_digit4 ; Only full feet
heinrichsweikamp
parents:
diff changeset
478 output_16
heinrichsweikamp
parents:
diff changeset
479 STRCAT_PRINT "ft "
heinrichsweikamp
parents:
diff changeset
480 bra deco_plan_show_nstd_stop_common
heinrichsweikamp
parents:
diff changeset
481
heinrichsweikamp
parents:
diff changeset
482 deco_plan_show_nstd_stop_metric:
heinrichsweikamp
parents:
diff changeset
483 WIN_LEFT .90
heinrichsweikamp
parents:
diff changeset
484 bsf leftbind
heinrichsweikamp
parents:
diff changeset
485 output_8 ; outputs into Postinc2!
heinrichsweikamp
parents:
diff changeset
486 STRCAT_PRINT "m "
heinrichsweikamp
parents:
diff changeset
487 deco_plan_show_nstd_stop_common:
heinrichsweikamp
parents:
diff changeset
488 ;---- Print duration -------------------------------------------------
heinrichsweikamp
parents:
diff changeset
489 WIN_LEFT .135
heinrichsweikamp
parents:
diff changeset
490 lfsr FSR2,buffer
heinrichsweikamp
parents:
diff changeset
491
heinrichsweikamp
parents:
diff changeset
492 movf lo,W ; Swap up & lo
heinrichsweikamp
parents:
diff changeset
493 movff up,lo
heinrichsweikamp
parents:
diff changeset
494 movwf up
heinrichsweikamp
parents:
diff changeset
495
heinrichsweikamp
parents:
diff changeset
496 output_8 ; Allow up to 240'
heinrichsweikamp
parents:
diff changeset
497 STRCAT_PRINT "' " ; 1 to 3 chars for depth.
heinrichsweikamp
parents:
diff changeset
498
heinrichsweikamp
parents:
diff changeset
499 movf lo,W ; Swap back up & lo
heinrichsweikamp
parents:
diff changeset
500 movff up,lo
heinrichsweikamp
parents:
diff changeset
501 movwf up
heinrichsweikamp
parents:
diff changeset
502
heinrichsweikamp
parents:
diff changeset
503 ;---------------------------------------------------------------------
heinrichsweikamp
parents:
diff changeset
504 ; Draw the bar graph used for deco stops (decoplan in simulator or dive).
heinrichsweikamp
parents:
diff changeset
505 incf win_top,F
heinrichsweikamp
parents:
diff changeset
506 movlw .19
heinrichsweikamp
parents:
diff changeset
507 movwf win_height
heinrichsweikamp
parents:
diff changeset
508 movlw .118
heinrichsweikamp
parents:
diff changeset
509 movwf win_leftx2 ; column left (0-159)
heinrichsweikamp
parents:
diff changeset
510 movlw .16
heinrichsweikamp
parents:
diff changeset
511 movwf win_width ; column max width.
heinrichsweikamp
parents:
diff changeset
512
heinrichsweikamp
parents:
diff changeset
513 ; Draw used area (up = minutes):
heinrichsweikamp
parents:
diff changeset
514 movlw .16 ; Limit length (16min)
heinrichsweikamp
parents:
diff changeset
515 cpfslt up
heinrichsweikamp
parents:
diff changeset
516 movwf up
heinrichsweikamp
parents:
diff changeset
517 movff up,win_bargraph ; Active width, the rest is cleared.
heinrichsweikamp
parents:
diff changeset
518 call TFT_box
heinrichsweikamp
parents:
diff changeset
519
heinrichsweikamp
parents:
diff changeset
520 ; Restore win_top
50
ec4d8503ec45 NEW: user-selectable color schemes
heinrichsweikamp
parents: 46
diff changeset
521 call TFT_standard_color
0
heinrichsweikamp
parents:
diff changeset
522 decf win_top,F ; Restore win_top
heinrichsweikamp
parents:
diff changeset
523 return
heinrichsweikamp
parents:
diff changeset
524
heinrichsweikamp
parents:
diff changeset
525 ;-----------------------------------------------------------------------------
heinrichsweikamp
parents:
diff changeset
526 ; Clear unused area belw last stop
heinrichsweikamp
parents:
diff changeset
527 ; Inputs: win_top : last used area...
heinrichsweikamp
parents:
diff changeset
528 deco_plan_show_clear_bottom:
heinrichsweikamp
parents:
diff changeset
529 movf win_top,W ; Get back from bank0
heinrichsweikamp
parents:
diff changeset
530 btfsc divemode ; In dive mode ?
heinrichsweikamp
parents:
diff changeset
531 sublw .168 ; Yes: bottom row in divemode
heinrichsweikamp
parents:
diff changeset
532 btfss divemode ; In dive mode ?
heinrichsweikamp
parents:
diff changeset
533 sublw .240 ; No: bottom row in planning
heinrichsweikamp
parents:
diff changeset
534 movwf win_height
heinrichsweikamp
parents:
diff changeset
535
heinrichsweikamp
parents:
diff changeset
536 WIN_LEFT .85 ; Full divemenu width
heinrichsweikamp
parents:
diff changeset
537 movlw .160-.85+1
heinrichsweikamp
parents:
diff changeset
538 movwf win_width
heinrichsweikamp
parents:
diff changeset
539
heinrichsweikamp
parents:
diff changeset
540 clrf win_color1 ; Fill with black
heinrichsweikamp
parents:
diff changeset
541 clrf win_color2
heinrichsweikamp
parents:
diff changeset
542
heinrichsweikamp
parents:
diff changeset
543 goto TFT_box
heinrichsweikamp
parents:
diff changeset
544
heinrichsweikamp
parents:
diff changeset
545 ;-----------------------------------------------------------------------------
heinrichsweikamp
parents:
diff changeset
546 ; Display the decoplan (simulator or divemode).
heinrichsweikamp
parents:
diff changeset
547 ; Inputs: char_O_deco_table (array of stop times, in minutes)
heinrichsweikamp
parents:
diff changeset
548 ; decoplan_page = page number.
heinrichsweikamp
parents:
diff changeset
549 ;
heinrichsweikamp
parents:
diff changeset
550 deco_show_plan_page:
189
e79bc535ef9e ignore un-calibrated sensors even if they become valid
heinrichsweikamp
parents: 178
diff changeset
551 bcf win_invert ; Reset invert flag
0
heinrichsweikamp
parents:
diff changeset
552
heinrichsweikamp
parents:
diff changeset
553 ;---- Is there deco stops ? ------------------------------------------
heinrichsweikamp
parents:
diff changeset
554 movff char_O_first_deco_depth,WREG
heinrichsweikamp
parents:
diff changeset
555 iorwf WREG
heinrichsweikamp
parents:
diff changeset
556 bnz deco_plan_show_1
heinrichsweikamp
parents:
diff changeset
557
heinrichsweikamp
parents:
diff changeset
558 ;---- No Deco --------------------------------------------------------
50
ec4d8503ec45 NEW: user-selectable color schemes
heinrichsweikamp
parents: 46
diff changeset
559 call TFT_standard_color
0
heinrichsweikamp
parents:
diff changeset
560 TEXT_SMALL .80, .0, tNoDeco
heinrichsweikamp
parents:
diff changeset
561 bsf decoplan_last_ceiling_shown
heinrichsweikamp
parents:
diff changeset
562 return
heinrichsweikamp
parents:
diff changeset
563
heinrichsweikamp
parents:
diff changeset
564 deco_plan_show_1:
heinrichsweikamp
parents:
diff changeset
565 lfsr FSR0,char_O_deco_depth ; Initialize indexed addressing.
heinrichsweikamp
parents:
diff changeset
566 lfsr FSR1,char_O_deco_time
heinrichsweikamp
parents:
diff changeset
567
heinrichsweikamp
parents:
diff changeset
568 clrf decoplan_index ; Start with index = 0
heinrichsweikamp
parents:
diff changeset
569 clrf win_top ; and row = 0
heinrichsweikamp
parents:
diff changeset
570
heinrichsweikamp
parents:
diff changeset
571 ; Read stop parameters, indexed by decoplan_index and decoplan_page
heinrichsweikamp
parents:
diff changeset
572 movf decoplan_page,W ; decoplan_gindex = 6*decoplan_page + decoplan_index
148
022b886eddaf some cleanup
heinrichsweikamp
parents: 136
diff changeset
573 mullw .8 ; 8 lines/page in decoplan
0
heinrichsweikamp
parents:
diff changeset
574 movf decoplan_index,W
heinrichsweikamp
parents:
diff changeset
575 addwf PRODL,W
heinrichsweikamp
parents:
diff changeset
576 movwf decoplan_gindex ; --> decoplan_gindex
heinrichsweikamp
parents:
diff changeset
577
heinrichsweikamp
parents:
diff changeset
578 bcf decoplan_last_ceiling_shown ; Not finished yet...
heinrichsweikamp
parents:
diff changeset
579
heinrichsweikamp
parents:
diff changeset
580 deco_plan_show_2:
heinrichsweikamp
parents:
diff changeset
581 btfsc decoplan_gindex,5 ; Reached table length (32) ?
heinrichsweikamp
parents:
diff changeset
582 bra deco_plan_show_99 ; YES: finished...
heinrichsweikamp
parents:
diff changeset
583
heinrichsweikamp
parents:
diff changeset
584 ; Read stop parameters, indexed by decoplan_index
heinrichsweikamp
parents:
diff changeset
585 movf decoplan_gindex,W ; index
heinrichsweikamp
parents:
diff changeset
586 movff PLUSW1,up ; char_O_deco_time [gindex] --> up
heinrichsweikamp
parents:
diff changeset
587 movff PLUSW0,lo ; char_O_deco_depth[gindex]
heinrichsweikamp
parents:
diff changeset
588 movf lo,W
heinrichsweikamp
parents:
diff changeset
589 bz deco_plan_show_99 ; depth == 0 : finished.
heinrichsweikamp
parents:
diff changeset
590
heinrichsweikamp
parents:
diff changeset
591 ; Display the stop line
heinrichsweikamp
parents:
diff changeset
592 rcall deco_plan_show_stop
heinrichsweikamp
parents:
diff changeset
593
heinrichsweikamp
parents:
diff changeset
594 ; Next
heinrichsweikamp
parents:
diff changeset
595 movlw .24
heinrichsweikamp
parents:
diff changeset
596 addwf win_top,F ; row: += 24
heinrichsweikamp
parents:
diff changeset
597 incf decoplan_index,F ; local index += 1
heinrichsweikamp
parents:
diff changeset
598 incf decoplan_gindex,F ; global index += 1
heinrichsweikamp
parents:
diff changeset
599
heinrichsweikamp
parents:
diff changeset
600 ; Max number of lines/page reached ?
148
022b886eddaf some cleanup
heinrichsweikamp
parents: 136
diff changeset
601 movlw .8 ; 8 lines/page in decoplan
0
heinrichsweikamp
parents:
diff changeset
602 cpfseq decoplan_index
heinrichsweikamp
parents:
diff changeset
603 bra deco_plan_show_2 ; NO: loop
heinrichsweikamp
parents:
diff changeset
604
heinrichsweikamp
parents:
diff changeset
605 ; Check if next stop if end-of-list ?
heinrichsweikamp
parents:
diff changeset
606 movf decoplan_gindex,W
heinrichsweikamp
parents:
diff changeset
607 movf PLUSW0,W ; char_O_deco_depth[gindex]
heinrichsweikamp
parents:
diff changeset
608 bz deco_plan_show_99 ; End of list...
heinrichsweikamp
parents:
diff changeset
609
heinrichsweikamp
parents:
diff changeset
610 ; Display the message "more..."
heinrichsweikamp
parents:
diff changeset
611 rcall deco_plan_show_clear_bottom ; Clear from next line
heinrichsweikamp
parents:
diff changeset
612
50
ec4d8503ec45 NEW: user-selectable color schemes
heinrichsweikamp
parents: 46
diff changeset
613 call TFT_standard_color
208
53771bd3d567 NEW: Show plan parameters in decoplan result page
heinrichsweikamp
parents: 197
diff changeset
614 TEXT_SMALL .88, .220, tMore
0
heinrichsweikamp
parents:
diff changeset
615 return
heinrichsweikamp
parents:
diff changeset
616
heinrichsweikamp
parents:
diff changeset
617 deco_plan_show_99:
heinrichsweikamp
parents:
diff changeset
618 bsf decoplan_last_ceiling_shown ; Nothing more in table to display.
heinrichsweikamp
parents:
diff changeset
619 rcall deco_plan_show_clear_bottom ; Clear from next line
heinrichsweikamp
parents:
diff changeset
620 return
heinrichsweikamp
parents:
diff changeset
621
heinrichsweikamp
parents:
diff changeset
622 ;-----------------------------------------------------------------------------
heinrichsweikamp
parents:
diff changeset
623 ; Loop to show all pages of the decoplan (surfacemode)
heinrichsweikamp
parents:
diff changeset
624
heinrichsweikamp
parents:
diff changeset
625 global deco_show_plan
heinrichsweikamp
parents:
diff changeset
626 deco_show_plan:
heinrichsweikamp
parents:
diff changeset
627 clrf decoplan_page
heinrichsweikamp
parents:
diff changeset
628 call TFT_ClearScreen
heinrichsweikamp
parents:
diff changeset
629 WIN_COLOR color_greenish
heinrichsweikamp
parents:
diff changeset
630 TEXT_SMALL .1,.1, tDivePlan
50
ec4d8503ec45 NEW: user-selectable color schemes
heinrichsweikamp
parents: 46
diff changeset
631 call TFT_standard_color
208
53771bd3d567 NEW: Show plan parameters in decoplan result page
heinrichsweikamp
parents: 197
diff changeset
632
53771bd3d567 NEW: Show plan parameters in decoplan result page
heinrichsweikamp
parents: 197
diff changeset
633 ; Show plan parameters
53771bd3d567 NEW: Show plan parameters in decoplan result page
heinrichsweikamp
parents: 197
diff changeset
634 WIN_SMALL .0,.25
53771bd3d567 NEW: Show plan parameters in decoplan result page
heinrichsweikamp
parents: 197
diff changeset
635 STRCPY "Int:"
53771bd3d567 NEW: Show plan parameters in decoplan result page
heinrichsweikamp
parents: 197
diff changeset
636 movff char_I_dive_interval,lo
53771bd3d567 NEW: Show plan parameters in decoplan result page
heinrichsweikamp
parents: 197
diff changeset
637 bsf leftbind
53771bd3d567 NEW: Show plan parameters in decoplan result page
heinrichsweikamp
parents: 197
diff changeset
638 output_8
53771bd3d567 NEW: Show plan parameters in decoplan result page
heinrichsweikamp
parents: 197
diff changeset
639 STRCAT_PRINT "'"
53771bd3d567 NEW: Show plan parameters in decoplan result page
heinrichsweikamp
parents: 197
diff changeset
640 WIN_SMALL .0,.50
53771bd3d567 NEW: Show plan parameters in decoplan result page
heinrichsweikamp
parents: 197
diff changeset
641 STRCPY_TEXT tBtTm_short
53771bd3d567 NEW: Show plan parameters in decoplan result page
heinrichsweikamp
parents: 197
diff changeset
642 movff char_I_bottom_time,lo
53771bd3d567 NEW: Show plan parameters in decoplan result page
heinrichsweikamp
parents: 197
diff changeset
643 bsf leftbind
53771bd3d567 NEW: Show plan parameters in decoplan result page
heinrichsweikamp
parents: 197
diff changeset
644 output_8
53771bd3d567 NEW: Show plan parameters in decoplan result page
heinrichsweikamp
parents: 197
diff changeset
645 STRCAT_PRINT "'"
53771bd3d567 NEW: Show plan parameters in decoplan result page
heinrichsweikamp
parents: 197
diff changeset
646 WIN_SMALL .0,.75
53771bd3d567 NEW: Show plan parameters in decoplan result page
heinrichsweikamp
parents: 197
diff changeset
647 STRCPY_TEXT tDepth
53771bd3d567 NEW: Show plan parameters in decoplan result page
heinrichsweikamp
parents: 197
diff changeset
648 PUTC ":"
53771bd3d567 NEW: Show plan parameters in decoplan result page
heinrichsweikamp
parents: 197
diff changeset
649 movff char_I_bottom_depth,lo
53771bd3d567 NEW: Show plan parameters in decoplan result page
heinrichsweikamp
parents: 197
diff changeset
650 bsf leftbind
53771bd3d567 NEW: Show plan parameters in decoplan result page
heinrichsweikamp
parents: 197
diff changeset
651 output_8
53771bd3d567 NEW: Show plan parameters in decoplan result page
heinrichsweikamp
parents: 197
diff changeset
652 STRCAT_PRINT "m"
53771bd3d567 NEW: Show plan parameters in decoplan result page
heinrichsweikamp
parents: 197
diff changeset
653
53771bd3d567 NEW: Show plan parameters in decoplan result page
heinrichsweikamp
parents: 197
diff changeset
654 ; Show deco mode
53771bd3d567 NEW: Show plan parameters in decoplan result page
heinrichsweikamp
parents: 197
diff changeset
655 WIN_TOP .155
53771bd3d567 NEW: Show plan parameters in decoplan result page
heinrichsweikamp
parents: 197
diff changeset
656 lfsr FSR2,buffer
53771bd3d567 NEW: Show plan parameters in decoplan result page
heinrichsweikamp
parents: 197
diff changeset
657 movff opt_dive_mode,lo ; 0=OC, 1=CC, 2=Gauge, 3=Apnea
53771bd3d567 NEW: Show plan parameters in decoplan result page
heinrichsweikamp
parents: 197
diff changeset
658 call TFT_display_decotype_surface1
0
heinrichsweikamp
parents:
diff changeset
659
heinrichsweikamp
parents:
diff changeset
660 ;---- Display model
heinrichsweikamp
parents:
diff changeset
661 movff char_I_deco_model,WREG
heinrichsweikamp
parents:
diff changeset
662 iorwf WREG
heinrichsweikamp
parents:
diff changeset
663 bnz deco_show_plan_m1
heinrichsweikamp
parents:
diff changeset
664
heinrichsweikamp
parents:
diff changeset
665 ; Display ZH-L16 sat/desat model.
208
53771bd3d567 NEW: Show plan parameters in decoplan result page
heinrichsweikamp
parents: 197
diff changeset
666 TEXT_SMALL .0,.130, tZHL16
53771bd3d567 NEW: Show plan parameters in decoplan result page
heinrichsweikamp
parents: 197
diff changeset
667 WIN_SMALL .14,.155
53771bd3d567 NEW: Show plan parameters in decoplan result page
heinrichsweikamp
parents: 197
diff changeset
668 PUTC ","
0
heinrichsweikamp
parents:
diff changeset
669 movff char_I_desaturation_multiplier,lo
heinrichsweikamp
parents:
diff changeset
670 output_8
heinrichsweikamp
parents:
diff changeset
671 STRCAT "%/"
heinrichsweikamp
parents:
diff changeset
672 movff char_I_saturation_multiplier,lo
heinrichsweikamp
parents:
diff changeset
673 output_8
heinrichsweikamp
parents:
diff changeset
674 bra deco_show_plan_m2
heinrichsweikamp
parents:
diff changeset
675
heinrichsweikamp
parents:
diff changeset
676 ; Display ZH-L16-GF low/high model.
heinrichsweikamp
parents:
diff changeset
677 deco_show_plan_m1:
208
53771bd3d567 NEW: Show plan parameters in decoplan result page
heinrichsweikamp
parents: 197
diff changeset
678 TEXT_SMALL .0,.130, tZHL16GF
53771bd3d567 NEW: Show plan parameters in decoplan result page
heinrichsweikamp
parents: 197
diff changeset
679 WIN_SMALL .14,.155
53771bd3d567 NEW: Show plan parameters in decoplan result page
heinrichsweikamp
parents: 197
diff changeset
680 PUTC ","
0
heinrichsweikamp
parents:
diff changeset
681 movff char_I_GF_Low_percentage,lo
heinrichsweikamp
parents:
diff changeset
682 output_99x
heinrichsweikamp
parents:
diff changeset
683 STRCAT "%/"
heinrichsweikamp
parents:
diff changeset
684 movff char_I_GF_High_percentage,lo
heinrichsweikamp
parents:
diff changeset
685 output_99x
208
53771bd3d567 NEW: Show plan parameters in decoplan result page
heinrichsweikamp
parents: 197
diff changeset
686 deco_show_plan_m2:
0
heinrichsweikamp
parents:
diff changeset
687 STRCAT_PRINT "%"
heinrichsweikamp
parents:
diff changeset
688
heinrichsweikamp
parents:
diff changeset
689 ;---- Display TTS result
208
53771bd3d567 NEW: Show plan parameters in decoplan result page
heinrichsweikamp
parents: 197
diff changeset
690 WIN_SMALL .0,.180
0
heinrichsweikamp
parents:
diff changeset
691 STRCPY_TEXT tTTS
heinrichsweikamp
parents:
diff changeset
692 STRCAT ": "
heinrichsweikamp
parents:
diff changeset
693
heinrichsweikamp
parents:
diff changeset
694 movff int_O_ascenttime+0,lo
heinrichsweikamp
parents:
diff changeset
695 movff int_O_ascenttime+1,hi
heinrichsweikamp
parents:
diff changeset
696 bsf leftbind
heinrichsweikamp
parents:
diff changeset
697 output_16
heinrichsweikamp
parents:
diff changeset
698 STRCAT_PRINT "'"
heinrichsweikamp
parents:
diff changeset
699
heinrichsweikamp
parents:
diff changeset
700 ;---- Display CNS result
208
53771bd3d567 NEW: Show plan parameters in decoplan result page
heinrichsweikamp
parents: 197
diff changeset
701 WIN_TOP .205
0
heinrichsweikamp
parents:
diff changeset
702 STRCPY_TEXT tCNS
heinrichsweikamp
parents:
diff changeset
703 STRCAT ": "
heinrichsweikamp
parents:
diff changeset
704 movff int_O_CNS_fraction+0,lo
heinrichsweikamp
parents:
diff changeset
705 movff int_O_CNS_fraction+1,hi
225
31088352ee32 BUGFIX: Show dives with >999mins divetime correctly
heinrichsweikamp
parents: 208
diff changeset
706 output_16_3 ; limit to 999 and display only (0-999)
0
heinrichsweikamp
parents:
diff changeset
707 STRCAT "%\x92" ; "->"
heinrichsweikamp
parents:
diff changeset
708 movff decoplan_CNS+0,lo
heinrichsweikamp
parents:
diff changeset
709 movff decoplan_CNS+1,hi
225
31088352ee32 BUGFIX: Show dives with >999mins divetime correctly
heinrichsweikamp
parents: 208
diff changeset
710 output_16_3 ; limit to 999 and display only (0-999)
0
heinrichsweikamp
parents:
diff changeset
711 STRCAT_PRINT "%"
heinrichsweikamp
parents:
diff changeset
712
heinrichsweikamp
parents:
diff changeset
713 ;---- Loop through pages
heinrichsweikamp
parents:
diff changeset
714 deco_show_plan_1:
heinrichsweikamp
parents:
diff changeset
715 rcall deco_show_plan_page
heinrichsweikamp
parents:
diff changeset
716 incf decoplan_page,F
heinrichsweikamp
parents:
diff changeset
717
heinrichsweikamp
parents:
diff changeset
718 call logbook_preloop_tasks
heinrichsweikamp
parents:
diff changeset
719 deco_show_plan_2:
heinrichsweikamp
parents:
diff changeset
720 btfsc switch_right
heinrichsweikamp
parents:
diff changeset
721 bra deco_show_plan_3
heinrichsweikamp
parents:
diff changeset
722 btfsc switch_left
208
53771bd3d567 NEW: Show plan parameters in decoplan result page
heinrichsweikamp
parents: 197
diff changeset
723 return ; Return to simulator menu
0
heinrichsweikamp
parents:
diff changeset
724 call log_screendump_and_onesecond ; Check if we need to make a screenshot and check for new second
heinrichsweikamp
parents:
diff changeset
725 btfsc sleepmode ; Timeout?
9
150d07db6048 Timeout in decoplanner result page
heinrichsweikamp
parents: 0
diff changeset
726 goto restart
0
heinrichsweikamp
parents:
diff changeset
727 bra deco_show_plan_2
heinrichsweikamp
parents:
diff changeset
728
heinrichsweikamp
parents:
diff changeset
729 deco_show_plan_3:
heinrichsweikamp
parents:
diff changeset
730 btfss decoplan_last_ceiling_shown
heinrichsweikamp
parents:
diff changeset
731 bra deco_show_plan_1
284
d1117b99fd99 preperations to compute gas consumtion in simulator
heinrichsweikamp
parents: 275
diff changeset
732 ; All stops shown
292
ccb93f319e78 ADD (back) Gas Volumes display after decoplanning.
jDG
parents: 284
diff changeset
733
295
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 294
diff changeset
734 ;---- In CCR mode, compute a BAILOUT decoplan ---------------------------------
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 294
diff changeset
735 banksel common
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 294
diff changeset
736 btfss FLAG_ccr_mode ; =1: CCR mode (Fixed ppO2 or Sensor) active
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 294
diff changeset
737 bra simulator_show_decoplan5_0 ; NO: normal OC mode: just display
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 294
diff changeset
738
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 294
diff changeset
739 btfsc is_bailout ; ALREADY in bailout mode ?
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 294
diff changeset
740 bra simulator_show_decoplan5_0 ; YES: alreay BAIL plan: display gas
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 294
diff changeset
741
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 294
diff changeset
742 ; Redo 2nd deco-plann, in bailout mode:
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 294
diff changeset
743 bsf is_bailout ; Set special bailout mode.
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 294
diff changeset
744 rcall deco_planer_redo ; Redo plan computation
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 294
diff changeset
745
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 294
diff changeset
746 movff char_I_setpoint_cbar+0,char_I_const_ppO2
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 294
diff changeset
747 bra deco_show_plan ; and display bailout stops
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 294
diff changeset
748
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 294
diff changeset
749 ;---- In OC+BAIL modes, show the gas Usage special page -----------------------
284
d1117b99fd99 preperations to compute gas consumtion in simulator
heinrichsweikamp
parents: 275
diff changeset
750 simulator_show_decoplan5_0:
295
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 294
diff changeset
751 bcf is_bailout ; Back to normal
284
d1117b99fd99 preperations to compute gas consumtion in simulator
heinrichsweikamp
parents: 275
diff changeset
752
d1117b99fd99 preperations to compute gas consumtion in simulator
heinrichsweikamp
parents: 275
diff changeset
753 ; Make sure to pass first gas
295
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 294
diff changeset
754 call get_first_gas_to_WREG ; Gets first gas (0-4) into WREG
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 294
diff changeset
755 incf WREG,f ; gas 1..5
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 294
diff changeset
756 movff WREG,char_I_first_gas ; Copy for compatibility
284
d1117b99fd99 preperations to compute gas consumtion in simulator
heinrichsweikamp
parents: 275
diff changeset
757
d1117b99fd99 preperations to compute gas consumtion in simulator
heinrichsweikamp
parents: 275
diff changeset
758 ; Compute gas consumption for each tank.
d1117b99fd99 preperations to compute gas consumtion in simulator
heinrichsweikamp
parents: 275
diff changeset
759 extern deco_gas_volumes
d1117b99fd99 preperations to compute gas consumtion in simulator
heinrichsweikamp
parents: 275
diff changeset
760 call deco_gas_volumes
d1117b99fd99 preperations to compute gas consumtion in simulator
heinrichsweikamp
parents: 275
diff changeset
761 movlb .1
d1117b99fd99 preperations to compute gas consumtion in simulator
heinrichsweikamp
parents: 275
diff changeset
762
d1117b99fd99 preperations to compute gas consumtion in simulator
heinrichsweikamp
parents: 275
diff changeset
763 ; Clear the complete stop result column:
294
f97e439d711c FIX clear before displaying gas volumes.
jDG
parents: 292
diff changeset
764 WIN_BOX_BLACK .0, .239, .80, .159 ; top, bottom, left, right
284
d1117b99fd99 preperations to compute gas consumtion in simulator
heinrichsweikamp
parents: 275
diff changeset
765
292
ccb93f319e78 ADD (back) Gas Volumes display after decoplanning.
jDG
parents: 284
diff changeset
766 movlw .25
ccb93f319e78 ADD (back) Gas Volumes display after decoplanning.
jDG
parents: 284
diff changeset
767 movwf waitms_temp ; Row for gas list is .25+.25
ccb93f319e78 ADD (back) Gas Volumes display after decoplanning.
jDG
parents: 284
diff changeset
768 clrf wait_temp ; Gas counter
284
d1117b99fd99 preperations to compute gas consumtion in simulator
heinrichsweikamp
parents: 275
diff changeset
769 lfsr FSR0,int_O_gas_volumes ; Initialize indexed addressing.
d1117b99fd99 preperations to compute gas consumtion in simulator
heinrichsweikamp
parents: 275
diff changeset
770
292
ccb93f319e78 ADD (back) Gas Volumes display after decoplanning.
jDG
parents: 284
diff changeset
771 WIN_LEFT .80 ; Set column
284
d1117b99fd99 preperations to compute gas consumtion in simulator
heinrichsweikamp
parents: 275
diff changeset
772 call TFT_standard_color
d1117b99fd99 preperations to compute gas consumtion in simulator
heinrichsweikamp
parents: 275
diff changeset
773
d1117b99fd99 preperations to compute gas consumtion in simulator
heinrichsweikamp
parents: 275
diff changeset
774 simulator_show_decoplan5_loop:
d1117b99fd99 preperations to compute gas consumtion in simulator
heinrichsweikamp
parents: 275
diff changeset
775 incf wait_temp,F ; Increment gas #
d1117b99fd99 preperations to compute gas consumtion in simulator
heinrichsweikamp
parents: 275
diff changeset
776
292
ccb93f319e78 ADD (back) Gas Volumes display after decoplanning.
jDG
parents: 284
diff changeset
777 STRCPY_TEXT tGas ; Print Gas number
ccb93f319e78 ADD (back) Gas Volumes display after decoplanning.
jDG
parents: 284
diff changeset
778 bsf leftbind
ccb93f319e78 ADD (back) Gas Volumes display after decoplanning.
jDG
parents: 284
diff changeset
779 movff wait_temp,lo
ccb93f319e78 ADD (back) Gas Volumes display after decoplanning.
jDG
parents: 284
diff changeset
780 output_8
ccb93f319e78 ADD (back) Gas Volumes display after decoplanning.
jDG
parents: 284
diff changeset
781
284
d1117b99fd99 preperations to compute gas consumtion in simulator
heinrichsweikamp
parents: 275
diff changeset
782 movlw .25
d1117b99fd99 preperations to compute gas consumtion in simulator
heinrichsweikamp
parents: 275
diff changeset
783 addwf waitms_temp,F ; Increase row position
d1117b99fd99 preperations to compute gas consumtion in simulator
heinrichsweikamp
parents: 275
diff changeset
784 movff waitms_temp,win_top ; Set Row
d1117b99fd99 preperations to compute gas consumtion in simulator
heinrichsweikamp
parents: 275
diff changeset
785
d1117b99fd99 preperations to compute gas consumtion in simulator
heinrichsweikamp
parents: 275
diff changeset
786 movff POSTINC0,lo ; Read (16bit) result, low first,
d1117b99fd99 preperations to compute gas consumtion in simulator
heinrichsweikamp
parents: 275
diff changeset
787 movff POSTINC0,hi ; then high.
d1117b99fd99 preperations to compute gas consumtion in simulator
heinrichsweikamp
parents: 275
diff changeset
788 movf lo,W ; Null ?
d1117b99fd99 preperations to compute gas consumtion in simulator
heinrichsweikamp
parents: 275
diff changeset
789 iorwf hi,W
d1117b99fd99 preperations to compute gas consumtion in simulator
heinrichsweikamp
parents: 275
diff changeset
790
d1117b99fd99 preperations to compute gas consumtion in simulator
heinrichsweikamp
parents: 275
diff changeset
791 movf lo,W ; == 65535 (saturated ?)
d1117b99fd99 preperations to compute gas consumtion in simulator
heinrichsweikamp
parents: 275
diff changeset
792 andwf hi,W
d1117b99fd99 preperations to compute gas consumtion in simulator
heinrichsweikamp
parents: 275
diff changeset
793 incf WREG
d1117b99fd99 preperations to compute gas consumtion in simulator
heinrichsweikamp
parents: 275
diff changeset
794 bnz simulator_show_decoplan5_2
d1117b99fd99 preperations to compute gas consumtion in simulator
heinrichsweikamp
parents: 275
diff changeset
795 call TFT_attention_color
292
ccb93f319e78 ADD (back) Gas Volumes display after decoplanning.
jDG
parents: 284
diff changeset
796 STRCAT_PRINT ": xxxx.x"
284
d1117b99fd99 preperations to compute gas consumtion in simulator
heinrichsweikamp
parents: 275
diff changeset
797 call TFT_standard_color
d1117b99fd99 preperations to compute gas consumtion in simulator
heinrichsweikamp
parents: 275
diff changeset
798 bra simulator_show_decoplan5_1
d1117b99fd99 preperations to compute gas consumtion in simulator
heinrichsweikamp
parents: 275
diff changeset
799
d1117b99fd99 preperations to compute gas consumtion in simulator
heinrichsweikamp
parents: 275
diff changeset
800 simulator_show_decoplan5_2:
292
ccb93f319e78 ADD (back) Gas Volumes display after decoplanning.
jDG
parents: 284
diff changeset
801 STRCAT ": "
284
d1117b99fd99 preperations to compute gas consumtion in simulator
heinrichsweikamp
parents: 275
diff changeset
802
d1117b99fd99 preperations to compute gas consumtion in simulator
heinrichsweikamp
parents: 275
diff changeset
803 bsf leftbind
d1117b99fd99 preperations to compute gas consumtion in simulator
heinrichsweikamp
parents: 275
diff changeset
804 output_16 ; No decimal anymore.
d1117b99fd99 preperations to compute gas consumtion in simulator
heinrichsweikamp
parents: 275
diff changeset
805 bcf leftbind
d1117b99fd99 preperations to compute gas consumtion in simulator
heinrichsweikamp
parents: 275
diff changeset
806 STRCAT_PRINT "" ; No unit: can be bars or litters.
d1117b99fd99 preperations to compute gas consumtion in simulator
heinrichsweikamp
parents: 275
diff changeset
807
d1117b99fd99 preperations to compute gas consumtion in simulator
heinrichsweikamp
parents: 275
diff changeset
808 ; Loop for all 5 gas
d1117b99fd99 preperations to compute gas consumtion in simulator
heinrichsweikamp
parents: 275
diff changeset
809 simulator_show_decoplan5_1:
d1117b99fd99 preperations to compute gas consumtion in simulator
heinrichsweikamp
parents: 275
diff changeset
810 movlw d'5' ; list all five gases
d1117b99fd99 preperations to compute gas consumtion in simulator
heinrichsweikamp
parents: 275
diff changeset
811 cpfseq wait_temp ; All gases shown?
d1117b99fd99 preperations to compute gas consumtion in simulator
heinrichsweikamp
parents: 275
diff changeset
812 bra simulator_show_decoplan5_loop ; No
d1117b99fd99 preperations to compute gas consumtion in simulator
heinrichsweikamp
parents: 275
diff changeset
813
292
ccb93f319e78 ADD (back) Gas Volumes display after decoplanning.
jDG
parents: 284
diff changeset
814 WIN_COLOR color_greenish
ccb93f319e78 ADD (back) Gas Volumes display after decoplanning.
jDG
parents: 284
diff changeset
815 WIN_SMALL .80,.25
295
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 294
diff changeset
816
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 294
diff changeset
817 btfsc FLAG_ccr_mode ; =1: CCR mode (Fixed ppO2 or Sensor) active
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 294
diff changeset
818 bra simulator_show_decoplan5_4 ; YES: This is bailout mode
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 294
diff changeset
819
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 294
diff changeset
820 STRCPY_TEXT tGasUsage ; OC: "Gas Usage"
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 294
diff changeset
821 bra simulator_show_decoplan5_5
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 294
diff changeset
822
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 294
diff changeset
823 simulator_show_decoplan5_4:
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 294
diff changeset
824 STRCPY_TEXT tDiveBailout ; CCR: "Bailout"
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 294
diff changeset
825
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 294
diff changeset
826 simulator_show_decoplan5_5
292
ccb93f319e78 ADD (back) Gas Volumes display after decoplanning.
jDG
parents: 284
diff changeset
827 STRCAT_PRINT ":"
ccb93f319e78 ADD (back) Gas Volumes display after decoplanning.
jDG
parents: 284
diff changeset
828 call TFT_standard_color
284
d1117b99fd99 preperations to compute gas consumtion in simulator
heinrichsweikamp
parents: 275
diff changeset
829
292
ccb93f319e78 ADD (back) Gas Volumes display after decoplanning.
jDG
parents: 284
diff changeset
830 call logbook_preloop_tasks
284
d1117b99fd99 preperations to compute gas consumtion in simulator
heinrichsweikamp
parents: 275
diff changeset
831 simulator_show_decoplan5_3:
292
ccb93f319e78 ADD (back) Gas Volumes display after decoplanning.
jDG
parents: 284
diff changeset
832 btfsc switch_right
ccb93f319e78 ADD (back) Gas Volumes display after decoplanning.
jDG
parents: 284
diff changeset
833 return ; Return to simulator menu
ccb93f319e78 ADD (back) Gas Volumes display after decoplanning.
jDG
parents: 284
diff changeset
834 btfsc switch_left
ccb93f319e78 ADD (back) Gas Volumes display after decoplanning.
jDG
parents: 284
diff changeset
835 return ; Return to simulator menu
ccb93f319e78 ADD (back) Gas Volumes display after decoplanning.
jDG
parents: 284
diff changeset
836 call log_screendump_and_onesecond ; Check if we need to make a screenshot and check for new second
ccb93f319e78 ADD (back) Gas Volumes display after decoplanning.
jDG
parents: 284
diff changeset
837 btfsc sleepmode ; Timeout?
ccb93f319e78 ADD (back) Gas Volumes display after decoplanning.
jDG
parents: 284
diff changeset
838 goto restart
ccb93f319e78 ADD (back) Gas Volumes display after decoplanning.
jDG
parents: 284
diff changeset
839 bra simulator_show_decoplan5_3
0
heinrichsweikamp
parents:
diff changeset
840
heinrichsweikamp
parents:
diff changeset
841 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
842 ;
heinrichsweikamp
parents:
diff changeset
843 global do_demo_divemode
heinrichsweikamp
parents:
diff changeset
844 do_demo_divemode:
heinrichsweikamp
parents:
diff changeset
845 extern option_save_all
heinrichsweikamp
parents:
diff changeset
846 call option_save_all ; Save all settings into EEPROM before starting simulation
heinrichsweikamp
parents:
diff changeset
847 call deco_push_tissues_to_vault
heinrichsweikamp
parents:
diff changeset
848 banksel common ; Bank1
heinrichsweikamp
parents:
diff changeset
849
heinrichsweikamp
parents:
diff changeset
850 bsf restore_deco_data ; Restore tissue and CNS after sim
heinrichsweikamp
parents:
diff changeset
851
heinrichsweikamp
parents:
diff changeset
852 bcf pressure_refresh
heinrichsweikamp
parents:
diff changeset
853 btfss pressure_refresh ; Wait for sensor
heinrichsweikamp
parents:
diff changeset
854 bra $-2
heinrichsweikamp
parents:
diff changeset
855
heinrichsweikamp
parents:
diff changeset
856 bsf simulatormode_active ; Set Flag
132
ec0b1e829399 Bugfix: Start dive mode simulator in correct depth
heinrichsweikamp
parents: 111
diff changeset
857 ; Compute dive ambient conditions
ec0b1e829399 Bugfix: Start dive mode simulator in correct depth
heinrichsweikamp
parents: 111
diff changeset
858 banksel char_I_bottom_depth
ec0b1e829399 Bugfix: Start dive mode simulator in correct depth
heinrichsweikamp
parents: 111
diff changeset
859 movf char_I_bottom_depth,W
ec0b1e829399 Bugfix: Start dive mode simulator in correct depth
heinrichsweikamp
parents: 111
diff changeset
860 mullw .100
ec0b1e829399 Bugfix: Start dive mode simulator in correct depth
heinrichsweikamp
parents: 111
diff changeset
861 movff PRODL,rel_pressure+0
ec0b1e829399 Bugfix: Start dive mode simulator in correct depth
heinrichsweikamp
parents: 111
diff changeset
862 movff PRODH,rel_pressure+1
ec0b1e829399 Bugfix: Start dive mode simulator in correct depth
heinrichsweikamp
parents: 111
diff changeset
863 movlw LOW(.1000)
ec0b1e829399 Bugfix: Start dive mode simulator in correct depth
heinrichsweikamp
parents: 111
diff changeset
864 addwf PRODL,W
ec0b1e829399 Bugfix: Start dive mode simulator in correct depth
heinrichsweikamp
parents: 111
diff changeset
865 movff WREG,sim_pressure+0
ec0b1e829399 Bugfix: Start dive mode simulator in correct depth
heinrichsweikamp
parents: 111
diff changeset
866 movlw HIGH(.1000)
ec0b1e829399 Bugfix: Start dive mode simulator in correct depth
heinrichsweikamp
parents: 111
diff changeset
867 addwfc PRODH,W
ec0b1e829399 Bugfix: Start dive mode simulator in correct depth
heinrichsweikamp
parents: 111
diff changeset
868 movff WREG,sim_pressure+1
0
heinrichsweikamp
parents:
diff changeset
869
136
9a637c9bb19a rename Deco Planner to Simulator
heinrichsweikamp
parents: 132
diff changeset
870 banksel common ; Bank1
0
heinrichsweikamp
parents:
diff changeset
871 bsf divemode
heinrichsweikamp
parents:
diff changeset
872 goto diveloop ; Switch into Divemode!
heinrichsweikamp
parents:
diff changeset
873
heinrichsweikamp
parents:
diff changeset
874
heinrichsweikamp
parents:
diff changeset
875 END