annotate code_part1/OSTC_code_asm_part1/menu_gassetup.asm @ 48:ebc5abda180d

cleanup
author heinrichsweikamp
date Thu, 15 Jul 2010 18:11:08 +0200
parents 56aea9fcdd8f
children cd5b650920f6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
2 ; OSTC - diving computer code
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
3 ; Copyright (C) 2008 HeinrichsWeikamp GbR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
4
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
5 ; This program is free software: you can redistribute it and/or modify
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
6 ; it under the terms of the GNU General Public License as published by
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
7 ; the Free Software Foundation, either version 3 of the License, or
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
8 ; (at your option) any later version.
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
9
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
10 ; This program is distributed in the hope that it will be useful,
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
11 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
12 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
13 ; GNU General Public License for more details.
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
14
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
15 ; You should have received a copy of the GNU General Public License
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
16 ; along with this program. If not, see <http://www.gnu.org/licenses/>.
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
17
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
18
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
19 ; Gas Setup menu
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
20 ; written by: Matthias Heinrichs, info@heinrichsweikamp.com
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
21 ; written: 10/08/07
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
22 ; last updated: 080906
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
23 ; known bugs:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
24 ; ToDo:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
25
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
26 menu_gassetup:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
27 movlw d'1'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
28 movwf menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
29
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
30 menu_gassetup_prelist:
36
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
31 call PLED_ClearScreen
47
56aea9fcdd8f 1.65beta release
heinrichsweikamp
parents: 45
diff changeset
32 call gassetup_sort_gaslist ; Sorts Gaslist according to change depth
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
33 clrf timeout_counter2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
34 bcf sleepmode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
35 bcf menubit2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
36 bcf menubit3
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
37 call PLED_topline_box
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
38 WIN_INVERT .1 ; Init new Wordprocessor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
39 DISPLAYTEXT .106 ; Gas List
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
40 WIN_INVERT .0 ; Init new Wordprocessor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
41 clrf decodata+0 ; Here: # of gas 0-4
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
42 clrf divemins+0 ; Here: # of Gas * 4
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
43 movlw d'5'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
44 movwf waitms_temp ; here: stores row for gas list
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
45 movlw d'2'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
46 movwf wait_temp ; here: stores eeprom address for gas list
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
47
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
48 ; Changed v1.44se
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
49 menu_gassetup_list:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
50 WIN_LEFT .20
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
51 movlw d'4'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
52 addwf wait_temp,F ; Increase eeprom address for gas list
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
53 movlw d'30'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
54 addwf waitms_temp,F ; Increase row
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
55 movf waitms_temp,W ; Load row into WREG
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
56 movff WREG,win_top
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
57 lfsr FSR2,letter
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
58 movlw 'G'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
59 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
60 movff decodata+0,lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
61 incf lo,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
62 bsf leftbind
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
63 output_99
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
64 movlw ':'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
65 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
66
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
67 call menu_gassetup_grey_inactive ; Sets Greyvalue for inactive gases
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
68 call word_processor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
69 WIN_LEFT .40
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
70 movf waitms_temp,W ; Load row into WREG
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
71 movff WREG,win_top
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
72 lfsr FSR2,letter
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
73
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
74 movlw d'33'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
75 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
76 call read_eeprom ; Get current startgas 1-5 # into EEDATA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
77 decf EEDATA,W ; 0-4
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
78 cpfseq decodata+0 ; =current displayed gas #?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
79 bra menu_gassetup_Tx ; no, do not display *
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
80 movlw '*' ; display *
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
81 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
82
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
83 ; New v1.44se
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
84 menu_gassetup_Tx:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
85 call menu_gassetup_grey_inactive ; Sets Greyvalue for inactive gases
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
86 call word_processor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
87
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
88 WIN_LEFT .48
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
89 movf waitms_temp,W ; Load row into WREG
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
90 movff WREG,win_top
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
91 lfsr FSR2,letter
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
92
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
93 movff wait_temp, EEADR ; Gas %He - Set address in internal EEPROM
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
94 incf EEADR,F ; Gas %He - Set address in internal EEPROM
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
95 call read_eeprom ; Read He value from EEPROM
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
96 movff EEDATA,lo ; Move EEDATA -> lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
97 movf lo,f ; Move lo -> f
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
98 movlw d'0' ; Move 0 -> WREG
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
99 cpfsgt lo ; He > 0?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
100 bra menu_gassetup_Nx ; NO check o2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
101
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
102 ; YES Write TX 15/55
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
103 call gassetup_write_Tx
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
104 movff wait_temp, EEADR ; Gas %O2 - Set address in internal EEPROM
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
105 call read_eeprom ; O2 value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
106 movff EEDATA,lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
107 output_8
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
108 movlw '/'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
109 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
110 incf EEADR,F ; Gas #hi: %He - Set address in internal EEPROM
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
111 call read_eeprom ; He value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
112 movff EEDATA,lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
113 output_8
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
114 bra menu_gassetup_list0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
115
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
116 ; New v1.44se
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
117 menu_gassetup_Nx:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
118 movff wait_temp, EEADR ; Gas %O2 - Set address in internal EEPROM
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
119 call read_eeprom ; Read O2 value from EEPROM
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
120 movff EEDATA,lo ; Move EEDATA -> lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
121 movf lo,f ; Move lo -> f
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
122 movlw d'21' ; Move 21 -> WREG
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
123 cpfsgt lo ; o2 > 21%
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
124 bra menu_gassetup_Air ; NO AIR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
125 movlw d'100' ; Move 100 -> WREG
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
126 cpfslt lo ; o2 < 100%
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
127 bra menu_gassetup_O2 ; NO write O2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
128
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
129 ; YES Write NX 32
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
130 call gassetup_write_Nx
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
131 output_8
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
132 bra menu_gassetup_list0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
133
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
134 ; New v1.44se
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
135 menu_gassetup_O2:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
136 movlw 'O'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
137 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
138 movlw '2'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
139 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
140 movlw ' '
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
141 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
142 output_8
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
143 bra menu_gassetup_list0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
144
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
145 ; New v1.44se
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
146 menu_gassetup_Air:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
147 cpfseq lo ; o2 = 21%
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
148 call menu_gassetup_Err
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
149
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
150 movlw 'A'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
151 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
152 movlw 'I'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
153 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
154 movlw 'R'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
155 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
156 movlw ' '
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
157 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
158 output_8
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
159 bra menu_gassetup_list0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
160
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
161 ; New v1.44se
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
162 menu_gassetup_Err:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
163 movlw 'E'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
164 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
165 movlw 'R'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
166 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
167 movlw 'R'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
168 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
169 movlw ' '
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
170 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
171 output_8
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
172
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
173 ; Changed v1.44se
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
174 menu_gassetup_list0:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
175 call menu_gassetup_grey_inactive ; Sets Greyvalue for inactive gases
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
176 call word_processor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
177
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
178 WIN_LEFT .105
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
179 movf waitms_temp,W ; Load row into WREG
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
180 movff WREG,win_top
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
181 lfsr FSR2,letter
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
182
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
183 movlw ' '
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
184 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
185 movlw 'i'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
186 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
187 movlw 'n'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
188 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
189 movlw ' '
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
190 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
191 movf decodata+0,W ; read current value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
192 addlw d'28' ; offset in memory
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
193 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
194 call read_eeprom ; Low-value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
195 movff EEDATA,lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
196 output_8
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
197 movlw 'm'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
198 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
199 call menu_gassetup_grey_inactive ; Sets Greyvalue for inactive gases
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
200 call word_processor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
201
3
3cf8af30b36e v1.51 beta
heinrichsweikamp
parents: 0
diff changeset
202 call PLED_standard_color
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
203
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
204 incf decodata+0,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
205 movlw d'5'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
206 cpfseq decodata+0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
207 goto menu_gassetup_list
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
208
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
209 DISPLAYTEXT .11 ; Exit
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
210 call wait_switches ; Waits until switches are released, resets flag if button stays pressed!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
211 call PLED_menu_cursor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
212
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
213 gassetup_list_loop:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
214 call check_switches_logbook
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
215
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
216 btfsc menubit3
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
217 bra gassetup_list2 ; move cursor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
218
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
219 btfsc menubit2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
220 bra do_gassetup_list; call gas-specific submenu
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
221
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
222 btfsc divemode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
223 goto restart ; dive started!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
224
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
225 btfsc onesecupdate
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
226 call timeout_surfmode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
227
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
228 btfsc onesecupdate
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
229 call set_dive_modes
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
230
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
231 bcf onesecupdate ; 1 sec. functions done
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
232
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
233 btfsc sleepmode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
234 bra exit_gassetup_list
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
235
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
236 bra gassetup_list_loop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
237
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
238 gassetup_list2:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
239 incf menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
240 movlw d'7'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
241 cpfseq menupos ; =7?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
242 bra gassetup_list3 ; No
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
243 movlw d'1'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
244 movwf menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
245
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
246 gassetup_list3:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
247 clrf timeout_counter2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
248 call PLED_menu_cursor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
249
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
250 call wait_switches ; Waits until switches are released, resets flag if button stays pressed!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
251
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
252 bcf menubit3 ; clear flag
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
253 bra gassetup_list_loop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
254
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
255 exit_gassetup_list: ; exit...
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
256 movlw d'2'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
257 movwf menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
258 goto menu2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
259
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
260 do_gassetup_list:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
261 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
262 bra gassetup_list_edit_gas1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
263 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
264 bra gassetup_list_edit_gas2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
265 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
266 bra gassetup_list_edit_gas3
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
267 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
268 bra gassetup_list_edit_gas4
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
269 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
270 bra gassetup_list_edit_gas5
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
271 bra exit_gassetup_list ; Exit List
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
272
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
273 gassetup_list_edit_gas1:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
274 movlw d'0'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
275 movwf decodata+0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
276 movlw d'0'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
277 movwf divemins+0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
278 bra menu_gassetup_page1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
279
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
280 gassetup_list_edit_gas2:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
281 movlw d'1'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
282 movwf decodata+0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
283 movlw d'4'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
284 movwf divemins+0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
285 bra menu_gassetup_page1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
286
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
287 gassetup_list_edit_gas3:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
288 movlw d'2'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
289 movwf decodata+0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
290 movlw d'8'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
291 movwf divemins+0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
292 bra menu_gassetup_page1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
293
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
294 gassetup_list_edit_gas4:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
295 movlw d'3'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
296 movwf decodata+0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
297 movlw d'12'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
298 movwf divemins+0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
299 bra menu_gassetup_page1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
300
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
301 gassetup_list_edit_gas5:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
302 movlw d'4'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
303 movwf decodata+0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
304 movlw d'16'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
305 movwf divemins+0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
306 bra menu_gassetup_page1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
307
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
308 menu_gassetup_page1:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
309 movlw d'1'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
310 movwf menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
311 bcf gas_setup_page2 ; Page 1 of gassetup
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
312 bcf menubit4
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
313 bcf cursor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
314 bcf sleepmode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
315 bcf first_FA ; Here: =1: -, =0: +
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
316
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
317 menu_gassetup0:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
318 call PLED_ClearScreen
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
319 DISPLAYTEXT .30 ; More...
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
320 DISPLAYTEXT .11 ; Exit
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
321
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
322 menu_gassetup1:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
323 clrf timeout_counter2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
324 bcf menubit2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
325 bcf menubit3
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
326
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
327 rcall gassetup_title_bar2 ; Displays the title bar with the current Gas info
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
328
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
329 WIN_TOP .65
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
330 WIN_LEFT .20
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
331 lfsr FSR2,letter
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
332 movlw 'O'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
333 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
334 movlw '2'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
335 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
336 movlw ':'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
337 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
338 movlw ' '
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
339 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
340
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
341 movf divemins+0,W
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
342 addlw 0x06
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
343 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
344 call read_eeprom ; O2 value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
345 movff EEDATA,lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
346 output_8
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
347 movlw '%'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
348 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
349 movlw ' '
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
350 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
351 movlw '('
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
352 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
353 movlw 'M'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
354 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
355 movlw 'O'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
356 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
357 movlw 'D'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
358 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
359 movlw ':'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
360 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
361
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
362 ; Show MOD in m
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
363 GETCUSTOM8 .18 ; ppO2 warnvalue in WREG
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
364 mullw d'10'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
365 movff PRODL,xA+0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
366 movff PRODH,xA+1 ; ppO2 in [0.01Bar] * 10
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
367
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
368 movf divemins+0,W
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
369 addlw 0x06
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
370 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
371 call read_eeprom ; O2 value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
372 movff EEDATA,xB+0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
373 clrf xB+1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
374 call div16x16 ;xA/xB=xC with xA as remainder
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
375 movlw d'10'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
376 subwf xC+0,F ; Subtract 10m...
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
377 movff xC+0,lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
378 movlw d'0'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
379 subwfb xC+1,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
380 movff xC+1,hi
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
381 output_16
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
382 movlw 'm'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
383 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
384 movlw ')'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
385 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
386 movlw ' '
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
387 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
388 movlw ' '
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
389 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
390 call word_processor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
391
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
392 WIN_TOP .95
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
393 lfsr FSR2,letter
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
394 movlw 'H'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
395 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
396 movlw 'e'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
397 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
398 movlw ':'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
399 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
400 movlw ' '
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
401 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
402 movf divemins+0,W
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
403 addlw 0x07
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
404 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
405 call read_eeprom ; He value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
406 movff EEDATA,lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
407 output_8
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
408 movlw '%'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
409 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
410 movlw ' '
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
411 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
412 movlw ' '
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
413 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
414 call word_processor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
415
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
416 WIN_TOP .125
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
417 lfsr FSR2,letter
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
418 movlw '+'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
419 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
420 movlw '/'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
421 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
422 movlw '-'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
423 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
424 movlw ':'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
425 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
426 movlw ' '
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
427 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
428 movlw '+'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
429 btfsc first_FA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
430 movlw '-'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
431 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
432 call word_processor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
433
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
434 WIN_TOP .155
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
435 lfsr FSR2,letter
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
436 OUTPUTTEXT .89 ; Default:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
437 movf divemins+0,W
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
438 addlw 0x04
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
439 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
440 call read_eeprom ; Default O2 value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
441 movff EEDATA,lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
442 output_8
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
443 movlw '/'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
444 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
445 movf divemins+0,W
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
446 addlw 0x05
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
447 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
448 call read_eeprom ; Default He value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
449 movff EEDATA,lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
450 output_8
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
451 movlw ' '
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
452 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
453 movlw ' '
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
454 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
455 call word_processor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
456
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
457 call wait_switches ; Waits until switches are released, resets flag if button stays pressed!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
458 call PLED_menu_cursor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
459
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
460 gassetup_loop:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
461 call check_switches_logbook
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
462
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
463 btfsc menubit3
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
464 bra gassetup2 ; move cursor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
465
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
466 btfsc menubit2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
467 bra do_gassetup ; call submenu
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
468
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
469 btfsc divemode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
470 goto restart ; dive started!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
471
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
472 btfsc onesecupdate
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
473 call timeout_surfmode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
474
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
475 btfsc onesecupdate
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
476 call set_dive_modes
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
477
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
478 bcf onesecupdate ; 1 sec. functions done
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
479
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
480 btfsc sleepmode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
481 bra exit_gassetup
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
482
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
483 bra gassetup_loop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
484
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
485 gassetup2:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
486 incf menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
487 movlw d'7'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
488 cpfseq menupos ; =7?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
489 bra gassetup3 ; No
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
490 movlw d'1'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
491 movwf menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
492
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
493 gassetup3:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
494
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
495 clrf timeout_counter2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
496 call PLED_menu_cursor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
497
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
498 call wait_switches ; Waits until switches are released, resets flag if button stays pressed!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
499
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
500 bcf menubit3 ; clear flag
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
501 bra gassetup_loop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
502
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
503 do_gassetup:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
504 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
505 bra next_gas_page
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
506 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
507 bra adjust_o2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
508 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
509 bra adjust_he
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
510 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
511 bra toggle_plus_minus_gassetup
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
512 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
513 bra restore_gas
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
514 exit_gassetup: ; exit...
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
515 movff decodata+0,menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
516 incf menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
517 bra menu_gassetup_prelist
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
518
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
519 toggle_plus_minus_gassetup:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
520 btg first_FA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
521 movlw d'4'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
522 movwf menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
523 bra menu_gassetup1 ; return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
524
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
525 next_gas:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
526 movlw d'1'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
527 movwf menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
528 bra menu_gassetup0 ; incl. clear screen
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
529
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
530 adjust_o2:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
531 movf divemins+0,W ; read current value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
532 addlw 0x06
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
533 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
534 call read_eeprom ; Low-value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
535 movff EEDATA,lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
536
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
537 btfsc first_FA ; Minus?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
538 bra adjust_o2_1 ; yes, minus!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
539
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
540 incf lo,F ; increase O2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
541 movlw d'101'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
542 cpfseq lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
543 bra adjust_o2_2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
544 movlw d'4' ; LOWER O2 Limit
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
545 movwf lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
546 bra adjust_o2_2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
547
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
548 adjust_o2_1:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
549 decf lo,F ; decrease O2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
550 movlw d'3'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
551 cpfseq lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
552 bra adjust_o2_2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
553
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
554 movf divemins+0,W
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
555 addlw 0x07
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
556 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
557 call read_eeprom ; read He value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
558
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
559 movlw d'100'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
560 movwf lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
561 movf EEDATA,W ; He value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
562 subwf lo,F ; lo=100% - He%
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
563
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
564 adjust_o2_2: ; test if O2+He>100...
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
565 movf divemins+0,W
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
566 addlw 0x07
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
567 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
568 call read_eeprom ; read He value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
569 movf EEDATA,W ; He value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
570 addwf lo,W ; add O2 value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
571 movwf hi ; store in temp
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
572 movlw d'101'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
573 cpfseq hi ; O2 and He > 100?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
574 bra adjust_o2_3 ; No!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
575
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
576 movlw d'4' ; LOWER O2 Limit
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
577 movwf lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
578
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
579 adjust_o2_3:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
580 movf divemins+0,W ; save current value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
581 addlw 0x06
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
582 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
583 movff lo,EEDATA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
584 call write_eeprom ; Low-value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
585
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
586 movlw d'2'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
587 movwf menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
588 bra menu_gassetup1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
589
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
590 adjust_he:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
591 movf divemins+0,W ; read current value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
592 addlw 0x07
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
593 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
594 call read_eeprom ; Low-value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
595 movff EEDATA,lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
596
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
597 btfsc first_FA ; Minus?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
598 bra adjust_he_1 ; yes, minus!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
599
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
600 incf lo,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
601 movlw d'92' ; He limited to (useless) 90%
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
602 cpfseq lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
603 bra adjust_he_2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
604 clrf lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
605 bra adjust_he_2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
606
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
607 adjust_he_1:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
608 decf lo,F ; decrease He
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
609 movlw d'255'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
610 cpfseq lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
611 bra adjust_he_2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
612 clrf lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
613
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
614 adjust_he_2: ; test if O2+He>100...
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
615 movf divemins+0,W
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
616 addlw 0x06
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
617 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
618 call read_eeprom ; read He value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
619 movf EEDATA,W ; He value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
620 addwf lo,W ; add O2 value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
621 movwf hi ; store in temp
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
622 movlw d'101'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
623 cpfseq hi ; O2 and He > 100?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
624 bra adjust_he_3 ; No!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
625 ; clrf lo ; Yes, clear He to zero
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
626 decf lo,F ; reduce He again = unchanged after operation
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
627
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
628 adjust_he_3:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
629 movf divemins+0,W ; save current value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
630 addlw 0x07
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
631 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
632 movff lo,EEDATA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
633 call write_eeprom ; Low-value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
634
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
635 movlw d'3'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
636 movwf menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
637 bra menu_gassetup1 ;
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
638
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
639 restore_gas:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
640 movf divemins+0,W ; read Default value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
641 addlw 0x04
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
642 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
643 call read_eeprom ; Low-value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
644 movff EEDATA,lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
645 movf divemins+0,W
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
646 addlw 0x05
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
647 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
648 call read_eeprom ; High-value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
649 movff EEDATA,hi
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
650
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
651 movf divemins+0,W ; save Default value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
652 addlw 0x06
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
653 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
654 movff lo,EEDATA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
655 call write_eeprom ; Low-value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
656 movf divemins+0,W
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
657 addlw 0x07
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
658 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
659 movff hi,EEDATA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
660 call write_eeprom ; High-value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
661
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
662 movlw d'5'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
663 movwf menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
664 bra menu_gassetup1 ;
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
665
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
666
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
667 next_gas_page:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
668 call PLED_ClearScreen
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
669 movlw d'1'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
670 movwf menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
671 DISPLAYTEXT .109 ; Back
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
672
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
673 DISPLAYTEXT .11 ; Exit
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
674
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
675 next_gas_page1:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
676 clrf timeout_counter2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
677 bcf menubit2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
678 bcf menubit3
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
679
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
680 rcall gassetup_title_bar2 ; Displays the title bar with the current Gas info
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
681 rcall gassetup_show_ppO2 ; Display the ppO2 of the change depth with the current gas
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
682
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
683 WIN_TOP .65
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
684 WIN_LEFT .20
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
685 lfsr FSR2,letter
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
686 OUTPUTTEXT .105 ; "Active Gas? "
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
687 read_int_eeprom d'27' ; read flag register
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
688
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
689 ; hi contains active gas flags in BIT0:4 ....
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
690
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
691 movff decodata+0,lo ; Gas 0-4
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
692 incf lo,F ; Gas 1-5
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
693
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
694 active_gas_display:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
695 rrcf EEDATA ; roll flags into carry
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
696 decfsz lo,F ; max. 5 times...
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
697 bra active_gas_display
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
698
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
699 btfss STATUS,C ; test carry
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
700 bra active_gas_display_no
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
701
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
702 OUTPUTTEXT .96 ; Yes
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
703 bra active_gas_display_end
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
704
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
705 active_gas_display_no:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
706 movlw ' ' ; three spaces instead of "Yes"
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
707 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
708 movlw ' '
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
709 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
710 movlw ' '
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
711 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
712
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
713 active_gas_display_end:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
714 call word_processor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
715
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
716 WIN_TOP .95
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
717 WIN_LEFT .20
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
718 lfsr FSR2,letter
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
719 OUTPUTTEXT .88 ; First Gas?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
720 movlw ' '
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
721 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
722
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
723 movlw d'33'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
724 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
725 call read_eeprom ; Get current startgas 1-5 # into EEDATA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
726 decf EEDATA,W ; 0-4
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
727 cpfseq decodata+0 ; =current displayed gas #?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
728 bra menu_firstgas0 ; no, display three spaces
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
729
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
730 OUTPUTTEXT .96 ; Yes
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
731 bra menu_firstgas1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
732
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
733 menu_firstgas0:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
734 movlw ' '
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
735 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
736 movlw ' '
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
737 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
738 movlw ' '
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
739 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
740
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
741 menu_firstgas1:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
742 call word_processor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
743
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
744 WIN_TOP .125
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
745 WIN_LEFT .20
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
746 lfsr FSR2,letter
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
747 OUTPUTTEXT .107 ; Change+
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
748 call word_processor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
749
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
750 WIN_TOP .155
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
751 WIN_LEFT .20
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
752 lfsr FSR2,letter
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
753 OUTPUTTEXT .108 ; Change-
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
754 call word_processor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
755
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
756 call wait_switches ; Waits until switches are released, resets flag if button stays pressed!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
757 call PLED_menu_cursor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
758
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
759 next_gas_page_loop:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
760 call check_switches_logbook
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
761
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
762 btfsc menubit3
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
763 bra next_gas_page2 ; move cursor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
764
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
765 btfsc menubit2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
766 bra do_next_gas_page ; call submenu
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
767
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
768 btfsc divemode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
769 goto restart ; dive started!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
770
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
771 btfsc onesecupdate
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
772 call timeout_surfmode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
773
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
774 btfsc onesecupdate
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
775 call set_dive_modes
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
776
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
777 bcf onesecupdate ; 1 sec. functions done
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
778
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
779 btfsc sleepmode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
780 bra exit_gassetup
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
781
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
782 bra next_gas_page_loop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
783
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
784 next_gas_page2:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
785 incf menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
786
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
787 movlw d'7'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
788 cpfseq menupos ; =7?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
789 bra next_gas_page3 ; No
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
790 movlw d'1'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
791 movwf menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
792
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
793 next_gas_page3:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
794 clrf timeout_counter2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
795 call PLED_menu_cursor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
796
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
797 call wait_switches ; Waits until switches are released, resets flag if button stays pressed!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
798
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
799 bcf menubit3 ; clear flag
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
800 bra next_gas_page_loop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
801
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
802 do_next_gas_page:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
803 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
804 bra next_gas
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
805 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
806 bra toggle_active_gas
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
807 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
808 bra make_first_gas
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
809 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
810 bra change_gas_depth_plus
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
811 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
812 bra change_gas_depth_minus
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
813 bra exit_gassetup ; Exit menu
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
814
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
815 make_first_gas:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
816 movff decodata+0,EEDATA ; current gas (0-4) into EEDATA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
817 incf EEDATA,F ; current gas (1-5) into EEDATA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
818 movlw d'33'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
819 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
820 call write_eeprom ; store in internal EEPROM
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
821 movlw d'3'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
822 movwf menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
823 bra next_gas_page1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
824
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
825 toggle_active_gas:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
826 read_int_eeprom d'27' ; read flag register
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
827 movff decodata+0,lo ; selected gas 0-4
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
828 incf lo,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
829 dcfsnz lo,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
830 btg EEDATA,0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
831 dcfsnz lo,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
832 btg EEDATA,1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
833 dcfsnz lo,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
834 btg EEDATA,2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
835 dcfsnz lo,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
836 btg EEDATA,3
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
837 dcfsnz lo,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
838 btg EEDATA,4
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
839 write_int_eeprom d'27' ; write flag register
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
840 movlw d'2'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
841 movwf menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
842 bra next_gas_page1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
843
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
844 change_gas_depth_plus:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
845 movf decodata+0,W ; read current value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
846 addlw d'28' ; offset in memory
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
847 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
848 call read_eeprom ; Low-value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
849 movff EEDATA,lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
850
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
851 incf lo,F ; increase depth
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
852 movlw d'100' ; Change depth limit + 1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
853 cpfseq lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
854 bra change_gas_depth_plus2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
855 movlw d'99' ; Change depth limit
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
856 movwf lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
857 change_gas_depth_plus2:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
858 movff lo,EEDATA ; write result
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
859 call write_eeprom ; save result in EEPROM
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
860
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
861 movlw d'4'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
862 movwf menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
863 bra next_gas_page1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
864
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
865
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
866 change_gas_depth_minus:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
867 movf decodata+0,W ; read current value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
868 addlw d'28' ; offset in memory
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
869 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
870 call read_eeprom ; Low-value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
871 movff EEDATA,lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
872
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
873 decf lo,F ; decrease depth
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
874 movlw d'255'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
875 cpfseq lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
876 bra change_gas_depth_minus2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
877 movlw d'0'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
878 movwf lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
879
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
880 change_gas_depth_minus2:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
881 movff lo,EEDATA ; write result
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
882 call write_eeprom ; save result in EEPROM
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
883
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
884 movlw d'5'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
885 movwf menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
886 bra next_gas_page1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
887
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
888 ; Changed v1.44se
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
889 gassetup_title_bar2:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
890 call PLED_topline_box
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
891 WIN_INVERT .1 ; Init new Wordprocessor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
892 WIN_TOP .2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
893 WIN_LEFT .0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
894 lfsr FSR2,letter
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
895 OUTPUTTEXT .95 ; Gas#
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
896 movff decodata+0,lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
897 incf lo,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
898 bsf leftbind
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
899 output_99
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
900 movlw ':'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
901 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
902 movlw ' '
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
903 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
904 call word_processor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
905
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
906 WIN_TOP .2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
907 WIN_LEFT .50
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
908 lfsr FSR2,letter
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
909
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
910 ;He check
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
911 movf divemins+0,W
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
912 addlw 0x07
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
913 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
914 call read_eeprom ; He value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
915 movff EEDATA,lo ; Move EEData -> lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
916 movf lo,f ; Move lo -> f
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
917 movlw d'0' ; Move 0 -> WREG
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
918 cpfsgt lo ; He > 0?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
919 bra gassetup_title_bar3 ; NO check o2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
920
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
921 ; YES Write TX 15/55
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
922 call gassetup_write_Tx ; Write TX
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
923 movf divemins+0,W
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
924 addlw 0x06
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
925 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
926 call read_eeprom ; O2 value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
927 movff EEDATA,lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
928 output_8 ; Write O2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
929 movlw '/'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
930 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
931 movf divemins+0,W
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
932 addlw 0x07
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
933 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
934 call read_eeprom ; He value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
935 movff EEDATA,lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
936 output_8 ; Write He
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
937 bra gassetup_title_bar7
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
938
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
939 ; New v1.44se
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
940 gassetup_title_bar3: ; O2 Check
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
941 movf divemins+0,W
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
942 addlw 0x06
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
943 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
944 call read_eeprom ; O2 value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
945 movff EEDATA,lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
946 movf lo,f ; Move lo -> f
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
947 movlw d'21' ; Move 21 -> WREG
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
948 cpfseq lo ; o2 = 21
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
949 cpfsgt lo ; o2 > 21%
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
950 bra gassetup_title_bar5 ; NO AIR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
951 movlw d'100' ; Move 100 -> WREG
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
952 cpfslt lo ; o2 < 100%
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
953 bra gassetup_title_bar4 ; NO write O2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
954
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
955 ; YES Write NX 32
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
956 call gassetup_write_Nx
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
957 output_8
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
958 bra gassetup_title_bar7
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
959
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
960 ; New v1.44se
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
961 gassetup_title_bar4:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
962 movlw 'O'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
963 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
964 movlw '2'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
965 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
966 movlw ' '
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
967 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
968 output_8
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
969 bra gassetup_title_bar7
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
970
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
971 ; New v1.44se
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
972 gassetup_title_bar5:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
973 cpfseq lo ; o2 = 21%
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
974 bra gassetup_title_bar6
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
975
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
976 movlw 'A'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
977 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
978 movlw 'I'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
979 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
980 movlw 'R'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
981 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
982 movlw ' '
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
983 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
984 output_8
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
985 bra gassetup_title_bar7
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
986
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
987 ; New v1.44se
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
988 gassetup_title_bar6: ; ERROR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
989 movlw 'E'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
990 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
991 movlw 'R'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
992 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
993 movlw 'R'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
994 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
995 movlw ' '
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
996 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
997 output_8
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
998 bra gassetup_title_bar7
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
999
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1000 gassetup_title_bar7:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1001 movlw ' '
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1002 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1003 movlw 'i'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1004 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1005 movlw 'n'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1006 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1007 movlw ' '
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1008 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1009 movf decodata+0,W ; read current value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1010 addlw d'28' ; offset in memory
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1011 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1012 call read_eeprom ; Low-value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1013 movff EEDATA,lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1014 output_8
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1015 movlw 'm'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1016 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1017 movlw ' '
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1018 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1019
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1020 call word_processor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1021 WIN_INVERT .0 ; Init new Wordprocessor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1022 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1023
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1024 ; New v1.44se
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1025 gassetup_write_Nx:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1026 movlw 'N'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1027 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1028 movlw 'X'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1029 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1030 movlw ' '
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1031 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1032 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1033
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1034 ; New v1.44se
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1035 gassetup_write_Tx:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1036 movlw 'T'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1037 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1038 movlw 'X'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1039 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1040 movlw ' '
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1041 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1042 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1043
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1044 ; New v1.44se
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1045 menu_gassetup_grey_inactive:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1046 ; Set Greyvalue to lower value when gas is inactive
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1047 read_int_eeprom d'27' ; read flag register
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1048 movff decodata+0,lo ; copy gas number 0-4
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1049 incf lo,F ; 1-5
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1050 menu_gassetup_list1:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1051 rrcf EEDATA ; roll flags into carry
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1052 decfsz lo,F ; max. 5 times...
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1053 bra menu_gassetup_list1
3
3cf8af30b36e v1.51 beta
heinrichsweikamp
parents: 0
diff changeset
1054
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1055 btfss STATUS,C ; test carry
3
3cf8af30b36e v1.51 beta
heinrichsweikamp
parents: 0
diff changeset
1056 bra menu_gassetup_list1_grey
3cf8af30b36e v1.51 beta
heinrichsweikamp
parents: 0
diff changeset
1057
3cf8af30b36e v1.51 beta
heinrichsweikamp
parents: 0
diff changeset
1058 GETCUSTOM8 d'35' ;movlw color_white
3cf8af30b36e v1.51 beta
heinrichsweikamp
parents: 0
diff changeset
1059 call PLED_set_color ; grey out inactive gases!
3cf8af30b36e v1.51 beta
heinrichsweikamp
parents: 0
diff changeset
1060 return
3cf8af30b36e v1.51 beta
heinrichsweikamp
parents: 0
diff changeset
1061
3cf8af30b36e v1.51 beta
heinrichsweikamp
parents: 0
diff changeset
1062 menu_gassetup_list1_grey:
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1063 movlw color_grey
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1064 call PLED_set_color ; grey out inactive gases!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1065 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1066
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1067 gassetup_show_ppO2:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1068 movf divemins+0,W
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1069 addlw 0x06
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1070 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1071 call read_eeprom ; O2 value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1072 movff EEDATA,hi
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1073
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1074 movf decodata+0,W ; read current value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1075 addlw d'28' ; offset in memory
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1076 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1077 call read_eeprom ; Change depth in m
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1078 movff EEDATA,lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1079 movlw d'10'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1080 addwf lo,F ; Depth+10m=lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1081 movf hi,W
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1082 mulwf lo ; (Depth+10m)*O2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1083 movff PRODL,xA+0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1084 movff PRODH,xA+1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1085 movlw d'10'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1086 movwf xB+0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1087 clrf xB+1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1088 call div16x16 ;xA/xB=xC with xA as remainder
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1089 movff xC+0,lo ; ((Depth+10m)*O2)/10 = [0.01Bar] ppO2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1090 movff xC+1,hi
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1091
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1092 WIN_LEFT .55
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1093 WIN_TOP .35
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1094 lfsr FSR2,letter
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1095 movlw '('
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1096 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1097 movlw 'p'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1098 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1099 movlw 'p'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1100 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1101 movlw 'O'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1102 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1103 movlw '2'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1104 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1105 movlw ':'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1106 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1107 output_16dp d'3'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1108 movlw 'B'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1109 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1110 movlw 'a'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1111 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1112 movlw 'r'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1113 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1114 movlw ')'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1115 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1116 movlw ' '
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1117 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1118 call word_processor
35
d4f0c097a7fa preparations for new gaslist
heinrichsweikamp
parents: 3
diff changeset
1119 return
d4f0c097a7fa preparations for new gaslist
heinrichsweikamp
parents: 3
diff changeset
1120
d4f0c097a7fa preparations for new gaslist
heinrichsweikamp
parents: 3
diff changeset
1121
d4f0c097a7fa preparations for new gaslist
heinrichsweikamp
parents: 3
diff changeset
1122 gassetup_sort_gaslist: ; Sorts Gaslist according to change depth
d4f0c097a7fa preparations for new gaslist
heinrichsweikamp
parents: 3
diff changeset
1123 ; EEPROM Locations of Gaslist
d4f0c097a7fa preparations for new gaslist
heinrichsweikamp
parents: 3
diff changeset
1124 ; Gas1:
d4f0c097a7fa preparations for new gaslist
heinrichsweikamp
parents: 3
diff changeset
1125 ; O2 Default:4
d4f0c097a7fa preparations for new gaslist
heinrichsweikamp
parents: 3
diff changeset
1126 ; He Default:5
d4f0c097a7fa preparations for new gaslist
heinrichsweikamp
parents: 3
diff changeset
1127 ; O2 Current:6
d4f0c097a7fa preparations for new gaslist
heinrichsweikamp
parents: 3
diff changeset
1128 ; He Current:7
d4f0c097a7fa preparations for new gaslist
heinrichsweikamp
parents: 3
diff changeset
1129 ; Change: 28
d4f0c097a7fa preparations for new gaslist
heinrichsweikamp
parents: 3
diff changeset
1130 ; Active: 27,0
d4f0c097a7fa preparations for new gaslist
heinrichsweikamp
parents: 3
diff changeset
1131
d4f0c097a7fa preparations for new gaslist
heinrichsweikamp
parents: 3
diff changeset
1132 ; Gas2:
d4f0c097a7fa preparations for new gaslist
heinrichsweikamp
parents: 3
diff changeset
1133 ; O2 Default:8
d4f0c097a7fa preparations for new gaslist
heinrichsweikamp
parents: 3
diff changeset
1134 ; He Default:9
d4f0c097a7fa preparations for new gaslist
heinrichsweikamp
parents: 3
diff changeset
1135 ; O2 Current:10
d4f0c097a7fa preparations for new gaslist
heinrichsweikamp
parents: 3
diff changeset
1136 ; He Current:11
d4f0c097a7fa preparations for new gaslist
heinrichsweikamp
parents: 3
diff changeset
1137 ; Change: 29
d4f0c097a7fa preparations for new gaslist
heinrichsweikamp
parents: 3
diff changeset
1138 ; Active: 27,1
d4f0c097a7fa preparations for new gaslist
heinrichsweikamp
parents: 3
diff changeset
1139
d4f0c097a7fa preparations for new gaslist
heinrichsweikamp
parents: 3
diff changeset
1140 ; Gas3:
d4f0c097a7fa preparations for new gaslist
heinrichsweikamp
parents: 3
diff changeset
1141 ; O2 Default:12
d4f0c097a7fa preparations for new gaslist
heinrichsweikamp
parents: 3
diff changeset
1142 ; He Default:13
d4f0c097a7fa preparations for new gaslist
heinrichsweikamp
parents: 3
diff changeset
1143 ; O2 Current:14
d4f0c097a7fa preparations for new gaslist
heinrichsweikamp
parents: 3
diff changeset
1144 ; He Current:15
d4f0c097a7fa preparations for new gaslist
heinrichsweikamp
parents: 3
diff changeset
1145 ; Change: 30
d4f0c097a7fa preparations for new gaslist
heinrichsweikamp
parents: 3
diff changeset
1146 ; Active: 27,2
d4f0c097a7fa preparations for new gaslist
heinrichsweikamp
parents: 3
diff changeset
1147
d4f0c097a7fa preparations for new gaslist
heinrichsweikamp
parents: 3
diff changeset
1148 ; Gas4:
d4f0c097a7fa preparations for new gaslist
heinrichsweikamp
parents: 3
diff changeset
1149 ; O2 Default:16
d4f0c097a7fa preparations for new gaslist
heinrichsweikamp
parents: 3
diff changeset
1150 ; He Default:17
d4f0c097a7fa preparations for new gaslist
heinrichsweikamp
parents: 3
diff changeset
1151 ; O2 Current:18
d4f0c097a7fa preparations for new gaslist
heinrichsweikamp
parents: 3
diff changeset
1152 ; He Current:19
d4f0c097a7fa preparations for new gaslist
heinrichsweikamp
parents: 3
diff changeset
1153 ; Change: 31
d4f0c097a7fa preparations for new gaslist
heinrichsweikamp
parents: 3
diff changeset
1154 ; Active: 27,3
d4f0c097a7fa preparations for new gaslist
heinrichsweikamp
parents: 3
diff changeset
1155
d4f0c097a7fa preparations for new gaslist
heinrichsweikamp
parents: 3
diff changeset
1156 ; Gas5:
d4f0c097a7fa preparations for new gaslist
heinrichsweikamp
parents: 3
diff changeset
1157 ; O2 Default:20
d4f0c097a7fa preparations for new gaslist
heinrichsweikamp
parents: 3
diff changeset
1158 ; He Default:21
d4f0c097a7fa preparations for new gaslist
heinrichsweikamp
parents: 3
diff changeset
1159 ; O2 Current:22
d4f0c097a7fa preparations for new gaslist
heinrichsweikamp
parents: 3
diff changeset
1160 ; He Current:23
d4f0c097a7fa preparations for new gaslist
heinrichsweikamp
parents: 3
diff changeset
1161 ; Change: 32
d4f0c097a7fa preparations for new gaslist
heinrichsweikamp
parents: 3
diff changeset
1162 ; Active: 27,4
d4f0c097a7fa preparations for new gaslist
heinrichsweikamp
parents: 3
diff changeset
1163
47
56aea9fcdd8f 1.65beta release
heinrichsweikamp
parents: 45
diff changeset
1164 ; reset Change depths (Important for all users who upgrade from <1.60!)
56aea9fcdd8f 1.65beta release
heinrichsweikamp
parents: 45
diff changeset
1165 clrf EEADRH
56aea9fcdd8f 1.65beta release
heinrichsweikamp
parents: 45
diff changeset
1166 clrf EEDATA
56aea9fcdd8f 1.65beta release
heinrichsweikamp
parents: 45
diff changeset
1167 write_int_eeprom d'118' ;
56aea9fcdd8f 1.65beta release
heinrichsweikamp
parents: 45
diff changeset
1168 write_int_eeprom d'119' ;
56aea9fcdd8f 1.65beta release
heinrichsweikamp
parents: 45
diff changeset
1169 write_int_eeprom d'120' ;
56aea9fcdd8f 1.65beta release
heinrichsweikamp
parents: 45
diff changeset
1170 write_int_eeprom d'121' ;
56aea9fcdd8f 1.65beta release
heinrichsweikamp
parents: 45
diff changeset
1171 write_int_eeprom d'122' ;
56aea9fcdd8f 1.65beta release
heinrichsweikamp
parents: 45
diff changeset
1172 movlw d'21' ; O2 Current
56aea9fcdd8f 1.65beta release
heinrichsweikamp
parents: 45
diff changeset
1173 movwf EEDATA
56aea9fcdd8f 1.65beta release
heinrichsweikamp
parents: 45
diff changeset
1174 write_int_eeprom d'96' ;
56aea9fcdd8f 1.65beta release
heinrichsweikamp
parents: 45
diff changeset
1175 write_int_eeprom d'100' ;
56aea9fcdd8f 1.65beta release
heinrichsweikamp
parents: 45
diff changeset
1176 write_int_eeprom d'104' ;
56aea9fcdd8f 1.65beta release
heinrichsweikamp
parents: 45
diff changeset
1177 write_int_eeprom d'108' ;
56aea9fcdd8f 1.65beta release
heinrichsweikamp
parents: 45
diff changeset
1178 write_int_eeprom d'112' ;
56aea9fcdd8f 1.65beta release
heinrichsweikamp
parents: 45
diff changeset
1179
56aea9fcdd8f 1.65beta release
heinrichsweikamp
parents: 45
diff changeset
1180 clrf EEDATA ; He Current
56aea9fcdd8f 1.65beta release
heinrichsweikamp
parents: 45
diff changeset
1181 write_int_eeprom d'97' ;
56aea9fcdd8f 1.65beta release
heinrichsweikamp
parents: 45
diff changeset
1182 write_int_eeprom d'101' ;
56aea9fcdd8f 1.65beta release
heinrichsweikamp
parents: 45
diff changeset
1183 write_int_eeprom d'105' ;
56aea9fcdd8f 1.65beta release
heinrichsweikamp
parents: 45
diff changeset
1184 write_int_eeprom d'109' ;
56aea9fcdd8f 1.65beta release
heinrichsweikamp
parents: 45
diff changeset
1185 write_int_eeprom d'113' ;
56aea9fcdd8f 1.65beta release
heinrichsweikamp
parents: 45
diff changeset
1186
36
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1187 ; Find deepest Gas
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1188 ; Copy all to RAM
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1189 movlw d'3'
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1190 movwf EEADR
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1191 clrf EEADRH
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1192 lfsr FSR2,letter ; Store gases in Letter buffer (max. 26Byte!)
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1193 gassetup_sort_gaslist1:
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1194 incf EEADR,F ; Next Adress
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1195 call read_eeprom ; Read byte
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1196 movff EEDATA,POSTINC2 ; Copy into RAM
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1197 movlw d'23'
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1198 cpfseq EEADR ; All done?
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1199 bra gassetup_sort_gaslist1 ; No, not yet
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1200 ; Letter+0 = EEPROM 4
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1201 ; ...
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1202 ; Letter+20 = EEPROM 23
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1203 read_int_eeprom d'28'
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1204 movff EEDATA,POSTINC2 ; Change Depth Gas1 -> Letter+21
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1205 read_int_eeprom d'29'
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1206 movff EEDATA,POSTINC2 ; Change Depth Gas2 -> Letter+22
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1207 read_int_eeprom d'30'
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1208 movff EEDATA,POSTINC2 ; Change Depth Gas3 -> Letter+23
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1209 read_int_eeprom d'31'
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1210 movff EEDATA,POSTINC2 ; Change Depth Gas4 -> Letter+24
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1211 read_int_eeprom d'32'
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1212 movff EEDATA,POSTINC2 ; Change Depth Gas5 -> Letter+25
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1213 read_int_eeprom d'27'
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1214 movff EEDATA,POSTINC2 ; Active Byte -> Letter+26
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1215
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1216 ; All change depths = 0? -> Skip sort!
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1217 lfsr FSR2,letter+.20 ; Change depths...
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1218 movlw d'5'
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1219 movwf logbook_temp3 ; Gas (0-4)
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1220 clrf logbook_temp1 ; counter
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1221 gassetup_sort_gaslist1a:
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1222 movf POSTINC2,W
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1223 addwf logbook_temp1,F ; sum
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1224 decfsz logbook_temp3,F ; Loop
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1225 bra gassetup_sort_gaslist1a
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1226
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1227 tstfsz logbook_temp1 ; All depths = 0?
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1228 bra gassetup_sort_gaslist1b ; No
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1229 return ; Yes, skip all!
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1230
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1231 gassetup_sort_gaslist1b:
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1232 ; Initialize sorting...
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1233 bcf menubit2 ; Change Start gas only 1x
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1234 movlw d'99'
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1235 movwf logbook_temp4 ; Last Gas change depth
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1236
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1237 rcall gassetup_sort_sort ; Sort!
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1238 ; Done. Copy Gas #logbook_temp3 into EEPROM Place Gas 5
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1239 movlw d'5' ; Gas 5
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1240 movwf logbook_temp5
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1241 rcall gassetup_sort_store
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1242 movff logbook_temp1,EEDATA ; Change depth -> EEDATA
45
985607cfb813 1.65beta
heinrichsweikamp
parents: 44
diff changeset
1243 write_int_eeprom d'122' ; Write Change Depth Gas 5
36
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1244
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1245 rcall gassetup_sort_sort ; Sort!
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1246 ; Done. Copy Gas #logbook_temp3 into EEPROM Place Gas 4
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1247 movlw d'4' ; Gas 4
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1248 movwf logbook_temp5
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1249 rcall gassetup_sort_store
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1250 movff logbook_temp1,EEDATA ; Change depth -> EEDATA
45
985607cfb813 1.65beta
heinrichsweikamp
parents: 44
diff changeset
1251 write_int_eeprom d'121' ; Write Change Depth Gas 4
36
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1252
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1253 rcall gassetup_sort_sort ; Sort!
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1254 ; Done. Copy Gas #logbook_temp3 into EEPROM Place Gas 3
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1255 movlw d'3' ; Gas 3
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1256 movwf logbook_temp5
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1257 rcall gassetup_sort_store
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1258 movff logbook_temp1,EEDATA ; Change depth -> EEDATA
45
985607cfb813 1.65beta
heinrichsweikamp
parents: 44
diff changeset
1259 write_int_eeprom d'120' ; Write Change Depth Gas 3
36
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1260
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1261 rcall gassetup_sort_sort ; Sort!
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1262 ; Done. Copy Gas #logbook_temp3 into EEPROM Place Gas 2
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1263 movlw d'2' ; Gas 2
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1264 movwf logbook_temp5
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1265 rcall gassetup_sort_store
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1266 movff logbook_temp1,EEDATA ; Change depth -> EEDATA
45
985607cfb813 1.65beta
heinrichsweikamp
parents: 44
diff changeset
1267 write_int_eeprom d'119' ; Write Change Depth Gas 2
36
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1268
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1269 rcall gassetup_sort_sort ; Sort!
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1270 ; Done. Copy Gas #logbook_temp3 into EEPROM Place Gas 1
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1271 movlw d'1' ; Gas 1
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1272 movwf logbook_temp5
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1273 rcall gassetup_sort_store
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1274 movff logbook_temp1,EEDATA ; Change depth -> EEDATA
45
985607cfb813 1.65beta
heinrichsweikamp
parents: 44
diff changeset
1275 write_int_eeprom d'118' ; Write Change Depth Gas 1
36
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1276 return
35
d4f0c097a7fa preparations for new gaslist
heinrichsweikamp
parents: 3
diff changeset
1277
36
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1278 gassetup_sort_sort:
41
3ab1188651af 1.63 in work...
heinrichsweikamp
parents: 36
diff changeset
1279 clrf logbook_temp2 ; Gas (0-4)
3ab1188651af 1.63 in work...
heinrichsweikamp
parents: 36
diff changeset
1280 clrf logbook_temp1 ; Here: Change depth in m
3ab1188651af 1.63 in work...
heinrichsweikamp
parents: 36
diff changeset
1281 clrf logbook_temp3 ; Gas (0-4)
36
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1282
41
3ab1188651af 1.63 in work...
heinrichsweikamp
parents: 36
diff changeset
1283 lfsr FSR2,letter+.20 ; Change depths...
36
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1284 gassetup_sort_gaslist2:
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1285 movf POSTINC2,W ; Get Change depth into WREG
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1286
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1287 cpfsgt logbook_temp4 ; logbook_temp4 < W? Here: Change depth of last sort run
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1288 bra gassetup_sort_gaslist3 ; Skip, tested depth > max. Depth from last run
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1289
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1290 cpfslt logbook_temp1 ; logbook_temp1 < W?
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1291 bra gassetup_sort_gaslist3 ; Skip, tested depth < max. Depth from this run
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1292
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1293 movwf logbook_temp1 ; copy new depth (current run)
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1294 movff logbook_temp2,logbook_temp3 ; Holds deepest Gas 0-4 of this run
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1295 gassetup_sort_gaslist3:
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1296 incf logbook_temp2,F ; Check next Gas
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1297 movlw d'5'
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1298 cpfseq logbook_temp2 ; All done?
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1299 bra gassetup_sort_gaslist2 ; No
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1300 gassetup_sort_gaslist4:
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1301 movff logbook_temp1,logbook_temp4 ; copy new depth (Store for next run)
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1302
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1303 ; Debugger
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1304 ;call enable_rs232
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1305 ; movff logbook_temp1,TXREG
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1306 ; call rs232_wait_tx ; wait for UART
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1307 ; movff logbook_temp2,TXREG
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1308 ; call rs232_wait_tx ; wait for UART
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1309 ; movff logbook_temp3,TXREG
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1310 ; call rs232_wait_tx ; wait for UART
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1311 ; movff logbook_temp4,TXREG
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1312 ; call rs232_wait_tx ; wait for UART
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1313 ; movff logbook_temp5,TXREG
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1314 ; call rs232_wait_tx ; wait for UART
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1315 ; WAITMS d'255'
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1316 return
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1317
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1318 gassetup_sort_store:
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1319 lfsr FSR2,letter ; Point to Gas0
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1320 movf logbook_temp3,W
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1321 mullw d'4'
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1322 movf PRODL,W ; x4
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1323 addwf FSR2L,F
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1324 movlw d'0'
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1325 addwfc FSR2H,F ; Point to Gas #logbook_temp3 (0-4)
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1326
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1327 btfsc menubit2 ; Change Start gas only 1x
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1328 bra gassetup_sort_store2 ; Skip
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1329 ; First Gas: 33 (1-5)
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1330 ; Was gas #logbook_temp3 first gas?
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1331 read_int_eeprom d'33' ; Get old first gas (1-5)
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1332 incf logbook_temp3,W ; Gas 1-5 -> WREG
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1333 cpfseq EEDATA ; Compare with EEDATA d'33'
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1334 bra gassetup_sort_store2 ; Was not first gas!
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1335 movff logbook_temp5,EEDATA ; Copy new first gas
45
985607cfb813 1.65beta
heinrichsweikamp
parents: 44
diff changeset
1336 write_int_eeprom d'123' ; Store
985607cfb813 1.65beta
heinrichsweikamp
parents: 44
diff changeset
1337 bsf menubit2 ; Done. Do not change again.
36
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1338
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1339 gassetup_sort_store2:
45
985607cfb813 1.65beta
heinrichsweikamp
parents: 44
diff changeset
1340 ; Was Gas #logbook_temp3 active?
985607cfb813 1.65beta
heinrichsweikamp
parents: 44
diff changeset
1341 ; Letter+26 holds active bits 25?
985607cfb813 1.65beta
heinrichsweikamp
parents: 44
diff changeset
1342 movff logbook_temp3,logbook_temp6 ; Counter 0-4
985607cfb813 1.65beta
heinrichsweikamp
parents: 44
diff changeset
1343 incf logbook_temp6,F ; Counter 1-5
985607cfb813 1.65beta
heinrichsweikamp
parents: 44
diff changeset
1344 movff letter+.25, logbook_temp2 ; No longer used
985607cfb813 1.65beta
heinrichsweikamp
parents: 44
diff changeset
1345 read_int_eeprom d'27' ; Active flag register
985607cfb813 1.65beta
heinrichsweikamp
parents: 44
diff changeset
1346 gassetup_sort_store3:
985607cfb813 1.65beta
heinrichsweikamp
parents: 44
diff changeset
1347 rrcf logbook_temp2,F ; Shift into Carry
985607cfb813 1.65beta
heinrichsweikamp
parents: 44
diff changeset
1348 decfsz logbook_temp6,F ; 1-5 x
985607cfb813 1.65beta
heinrichsweikamp
parents: 44
diff changeset
1349 bra gassetup_sort_store3 ; Loop
985607cfb813 1.65beta
heinrichsweikamp
parents: 44
diff changeset
1350 ; Carry now holds active bit of gas #logbook_temp3 (0-4)
985607cfb813 1.65beta
heinrichsweikamp
parents: 44
diff changeset
1351
985607cfb813 1.65beta
heinrichsweikamp
parents: 44
diff changeset
1352 btfss STATUS,C ; Was Gas active?
985607cfb813 1.65beta
heinrichsweikamp
parents: 44
diff changeset
1353 clrf logbook_temp1 ; No!, Clear change Depth to make it inactive for sorted list!
985607cfb813 1.65beta
heinrichsweikamp
parents: 44
diff changeset
1354
36
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1355 movf logbook_temp5,W
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1356 mullw d'4'
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1357 movff PRODL,EEADR ; Point to EEPROM of Gas #logbook_temp5
45
985607cfb813 1.65beta
heinrichsweikamp
parents: 44
diff changeset
1358
985607cfb813 1.65beta
heinrichsweikamp
parents: 44
diff changeset
1359 movlw d'90' ; +90 Offset to new...
985607cfb813 1.65beta
heinrichsweikamp
parents: 44
diff changeset
1360 addwf EEADR,F ; ..sorted list!
985607cfb813 1.65beta
heinrichsweikamp
parents: 44
diff changeset
1361
36
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1362 movff POSTINC2,EEDATA ; O2 Default
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1363 call write_eeprom ; store in internal EEPROM
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1364 incf EEADR,F ; +1
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1365 movff POSTINC2,EEDATA ; He Default
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1366 call write_eeprom ; store in internal EEPROM
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1367 incf EEADR,F ; +1
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1368 movff POSTINC2,EEDATA ; O2 Current
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1369 call write_eeprom ; store in internal EEPROM
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1370 incf EEADR,F ; +1
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1371 movff POSTINC2,EEDATA ; He Current
3c38ba950dfb Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents: 35
diff changeset
1372 call write_eeprom ; store in internal EEPROM
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1373 return