annotate code_part1/OSTC_code_asm_part1/menu_custom.asm @ 84:0f4c175ef824

FIX flickering in new CF menus
author JeanDo
date Wed, 08 Dec 2010 02:03:11 +0100
parents 3e351e25f5d1
children b40a0a6284da
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 ; Menu "Custom Functions", Custom Functions checker (Displays permanent warning if critical custom functions are altered)
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
20 ; written by: Matthias Heinrichs, info@heinrichsweikamp.com
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
21 ; written: 05/10/30
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
22 ; last updated: 08/08/31
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 ;First Bank of Custom Functions:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
27 ; The custom functions are stored in the internal EEPROM after 0x80
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
28 ; any custom function occupies 4 byte:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
29 ; 2 byte (low:high) store the default value, reset from menu "reset"
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
30 ; if bit16=1 then the custrom function is 15bit value, if not it's a 8bit value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
31 ; 2 byte (low:high) store the actual value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
32 ; defaults for custom functions are in menu "reset"
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
33 ; get values with GETCUSTOM8 .x with x=0...32 for 8 Bit values (stored in WREG)
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
34 ; or with GETCUSTOM15 .x with x=0...32 for 15 Bit values (stored in lo and hi)
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
35
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
36 ;Second Bank of Custom Functions:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
37 ; The custom functions are stored in the internal EEPROM after 0x180
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
38 ; any custom function occupies 4 byte:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
39 ; 2 byte (low:high) store the default value, reset from menu "reset"
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
40 ; if bit16=1 then the custrom function is 15bit value, if not it's a 8bit value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
41 ; 2 byte (low:high) store the actual value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
42 ; defaults for custom functions are in menu "reset"
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
43 ; get values with GETCUSTOM8 .x with x=0...32 for 8 Bit values (stored in WREG)
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
44 ; or with GETCUSTOM15 .x with x=0...32 for 15 Bit values (stored in lo and hi)
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
45
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
46 ; [jDG] 2010-11-30 More fancy displsy of the various CF types
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
47 ; data types. When we do have a 8bit data (bit16=0), the high byte serves to
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
48 ; define the display format:
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
49
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
50 CF_INT8 EQU 0 ; Default display, 8 or 15 bits values.
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
51 CF_PERCENT EQU 1 ; Displays 110%
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
52 CF_DECI EQU 2 ; Displays 1.6
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
53 CF_CENTI EQU 3 ; Displays 1.50
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
54 CF_MILI EQU 4 ; Displays 1.015
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
55 CF_BOOL EQU 5 ; Displays ON/OFF
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
56 CF_SEC EQU 6 ; Displays 4:00
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
57 CF_COLOR EQU 7 ; Display 240 plus a color watch (inverse video space)
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
58 CF_INT15 EQU 0x80; Default display. Flag for 15bit, typeless values.
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
59
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
60 GETCUSTOM8 macro custom8
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
61 movlw custom8
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
62 call getcustom8_1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
63 endm
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
64
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
65 getcustom8_1:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
66 ; # number of requested custom function in wreg
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
67 movwf customfunction_temp2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
68
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
69 movlw d'31'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
70 cpfsgt customfunction_temp2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
71 bra getcustom8_2 ; Lower bank
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
72
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
73 movlw d'1' ; Upper Bank
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
74 movwf EEADRH
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
75 movlw d'32'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
76 subwf customfunction_temp2,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
77 bra getcustom8_3
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
78
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
79 getcustom8_2:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
80 clrf EEADRH
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
81 getcustom8_3:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
82 movf customfunction_temp2,W
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
83 mullw d'4'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
84 movf PRODL,W ; x4 for adress
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
85 addlw d'130'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
86 movwf EEADR ; +130 for LOW Byte of value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
87 call read_eeprom ; Lowbyte
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
88 movf EEDATA,W ; copied into wreg
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
89 clrf EEADRH
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
90 return ; return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
91
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
92 GETCUSTOM15 macro custom15
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
93 movlw custom15
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
94 call getcustom15_1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
95 endm
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
96
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
97 getcustom15_1:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
98 ; # number of requested custom function in wreg
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
99 movwf customfunction_temp2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
100
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
101 movlw d'31'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
102 cpfsgt customfunction_temp2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
103 bra getcustom15_2 ; Lower bank
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
104
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
105 movlw d'1' ; Upper Bank
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
106 movwf EEADRH
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
107 movlw d'32'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
108 subwf customfunction_temp2,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
109 bra getcustom15_3
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
110 getcustom15_2:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
111 clrf EEADRH
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
112 getcustom15_3:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
113 movf customfunction_temp2,W
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
114 mullw d'4'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
115 movf PRODL,W ; x4 for adress
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
116 addlw d'130'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
117 movwf EEADR ; +130 for LOW Byte of value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
118 call read_eeprom ; Lowbyte
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
119 movff EEDATA,lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
120 incf EEADR,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
121 call read_eeprom ; Highbyte
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
122 movff EEDATA,hi
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
123 clrf EEADRH
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
124 return ; return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
125
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
126 menu_custom_functions_page2:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
127 movlw d'154' ; start of custom function descriptors
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
128 movwf customfunction_temp1
7
5c4ba624165d cf32 bug fixed
heinrichsweikamp
parents: 0
diff changeset
129 bsf customfunction_page ; Use Page II...
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
130 bra menu_custom_functions0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
131
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
132 menu_custom_functions:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
133 movlw d'36' ; start of custom function descriptors
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
134 movwf customfunction_temp1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
135 bcf customfunction_page ; Use Page I...
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
136
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
137 menu_custom_functions0:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
138 bsf leftbind
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
139 call PLED_ClearScreen
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
140 movlw d'1'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
141 movwf menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
142
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
143 bcf menubit4
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
144 bcf cursor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
145 bcf sleepmode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
146 clrf decodata+0 ; here: # of CustomFunction
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
147 clrf divemins+0 ; here: # of CustomFunction*4
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
148 bcf first_FA ; here: =1: -, =0: +
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
149 bcf second_FA ; here: =1: stepsize 1, =0: stepsize 10
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
150
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
151 call PLED_topline_box
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
152 WIN_INVERT .1 ; Init new Wordprocessor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
153
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
154 btfss customfunction_page ;
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
155 bra menu_custom_functions10
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
156 DISPLAYTEXT .186 ; Custom FunctionsII
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
157 bra menu_custom_functions11
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
158
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
159 menu_custom_functions10:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
160 DISPLAYTEXT .27 ; Custom FunctionsI
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
161
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
162 menu_custom_functions11:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
163 WIN_INVERT .0 ; Init new Wordprocessor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
164
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
165 menu_custom_functions1:
29
c6cab044a338 1.61beta rc2
heinrichsweikamp
parents: 27
diff changeset
166 call PLED_standard_color
c6cab044a338 1.61beta rc2
heinrichsweikamp
parents: 27
diff changeset
167
7
5c4ba624165d cf32 bug fixed
heinrichsweikamp
parents: 0
diff changeset
168 movlw d'1'
5c4ba624165d cf32 bug fixed
heinrichsweikamp
parents: 0
diff changeset
169 btfss customfunction_page ; Use Page II...
5c4ba624165d cf32 bug fixed
heinrichsweikamp
parents: 0
diff changeset
170 movlw d'0'
5c4ba624165d cf32 bug fixed
heinrichsweikamp
parents: 0
diff changeset
171 movwf EEADRH
5c4ba624165d cf32 bug fixed
heinrichsweikamp
parents: 0
diff changeset
172
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
173 clrf timeout_counter2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
174 bcf menubit2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
175 bcf menubit3
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
176 WIN_LEFT .20
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
177 WIN_TOP .35
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
178 lfsr FSR2,letter
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
179 movff decodata+0,lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
180
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
181 movlw d'0'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
182 btfsc customfunction_page ; Add offset for display
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
183 movlw d'32'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
184 addwf lo,F
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
185 movff lo, apnoe_mins ; Copy use when NO_CF_TYPES
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
186
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
187 output_99x
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
188 movlw ':'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
189 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
190 movlw ' '
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
191 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
192 call word_processor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
193
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
194 movf customfunction_temp1,W ; start of custom function descriptors
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
195 addwf decodata+0,W ; add # of current custom function, place result in wreg
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
196 call displaytext1 ; shows descriptor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
197
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
198 ; Read defaults into hi:lo
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
199 movf divemins+0,W
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
200 addlw 0x80
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
201 movwf EEADR
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
202 call read_eeprom ; Lowbyte
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
203 movff EEDATA,lo
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
204 movf divemins+0,W
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
205 addlw 0x81
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
206 movwf EEADR
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
207 call read_eeprom ; Highbyte
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
208 movff EEDATA,hi
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
209
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
210 #ifdef NO_CF_TYPES
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
211 movlw binary_cf1
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents: 79
diff changeset
212 subwf apnoe_mins,W ; Binary cf?
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
213 bz menu_custom_functions10c ; Yes
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
214
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
215 movlw binary_cf2
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents: 79
diff changeset
216 subwf apnoe_mins,W ; Binary cf?
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
217 bz menu_custom_functions10c ; Yes
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
218
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
219 movlw binary_cf3
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents: 79
diff changeset
220 subwf apnoe_mins,W ; Binary cf?
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
221 bz menu_custom_functions10c ; Yes
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
222
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
223 movlw binary_cf4
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents: 79
diff changeset
224 subwf apnoe_mins,W ; Binary cf?
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
225 bz menu_custom_functions10c ; Yes
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
226
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
227 movlw binary_cf5
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents: 79
diff changeset
228 subwf apnoe_mins,W ; Binary cf?
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
229 bz menu_custom_functions10c ; Yes
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
230
17
68825abc35f7 1.55beta rc1
heinrichsweikamp
parents: 7
diff changeset
231 movlw binary_cf6
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents: 79
diff changeset
232 subwf apnoe_mins,W ; Binary cf?
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
233 bz menu_custom_functions10c ; Yes
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents: 79
diff changeset
234
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
235 bra menu_custom_functions10a ; Not a binary CF...
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
236 #else
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
237 movf hi,W ; Is it a ON/OFF flag ?
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
238 xorlw CF_BOOL
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
239 bnz menu_custom_functions10a ; Not a binary CF selected
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
240 #endif
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
241
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
242 menu_custom_functions10c:
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
243 setf apnoe_mins ; Yes, set apnoe_mins to 0xFF
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
244
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
245 WIN_LEFT .20
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
246 WIN_TOP .65
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
247 lfsr FSR2,letter ; Make a string of 8 spaces
84
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
248 call cf_fill_line
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
249 call word_processor ; Clear +/- line
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
250
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
251 WIN_TOP .95
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
252 call word_processor ; Clear 1/10 line
84
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
253
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
254 bra menu_custom_functions10b
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
255
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
256 menu_custom_functions10a:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
257 clrf apnoe_mins ; Yes, clear apnoe_mins
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
258
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
259 WIN_LEFT .20
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
260 WIN_TOP .65
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
261 lfsr FSR2,letter
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
262 movlw '+'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
263 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
264 movlw '/'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
265 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
266 movlw '-'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
267 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
268 movlw ':'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
269 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
270 movlw ' '
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
271 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
272 movlw '+'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
273 btfsc first_FA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
274 movlw '-'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
275 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
276 call word_processor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
277
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
278 WIN_LEFT .20
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
279 WIN_TOP .95
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
280 lfsr FSR2,letter
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
281 movlw '1'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
282 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
283 movlw '/'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
284 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
285 movlw '1'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
286 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
287 movlw '0'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
288 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
289 movlw ':'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
290 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
291 movlw ' '
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
292 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
293 movlw '1'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
294 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
295 movlw '0'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
296 btfsc second_FA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
297 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
298 movlw ' '
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
299 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
300 call word_processor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
301
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
302 menu_custom_functions10b:
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
303 WIN_LEFT .20
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
304 WIN_TOP .125
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
305 lfsr FSR2,letter
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
306 OUTPUTTEXT d'89' ;"Default:"
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
307 movlw ' '
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
308 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
309
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
310 call display_customfunction ; Typed display.
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
311
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
312 WIN_LEFT .20
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
313 WIN_TOP .155
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
314 lfsr FSR2,letter
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
315 OUTPUTTEXT d'97' ; "Current:"
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
316 movlw ' '
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
317 movwf POSTINC2
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
318
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
319 movf divemins+0,W
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
320 addlw 0x82
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
321 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
322 call read_eeprom ; Lowbyte
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
323 movff EEDATA,lo
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
324
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
325 movf divemins+0,W
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
326 addlw 0x83
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
327 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
328 call read_eeprom ; Highbyte
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
329
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
330 btfss hi,7 ; A 15bit value ?
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
331 bra menu_custom_functions1b ; No : keep types there !
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
332
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
333 movff EEDATA,hi
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
334 bsf hi,7 ; Mark it a 15bit value.
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
335
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
336 menu_custom_functions1b:
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
337 call display_customfunction
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
338
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
339 menu_custom_functions1a:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
340 DISPLAYTEXT .11 ; Exit
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
341
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
342 call wait_switches ; Waits until switches are released, resets flag if button stays pressed!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
343 call PLED_menu_cursor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
344
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
345 customfunctions_loop:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
346 call check_switches_logbook
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
347
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
348 btfsc menubit3
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
349 bra customfunctions2 ; Move cursor or generate next page
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
350
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
351 btfsc menubit2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
352 bra do_customfunction ; call subfunction
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
353
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
354 btfsc divemode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
355 goto restart ; dive started during cf menu
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
356
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
357 btfsc onesecupdate
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
358 call timeout_surfmode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
359
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
360 btfsc onesecupdate
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
361 call set_dive_modes
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
362
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
363 bcf onesecupdate ; end of 1sek. tasks
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
364
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
365 btfsc sleepmode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
366 bra exit_customfunctions
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
367
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
368 bra customfunctions_loop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
369
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
370 customfunctions2:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
371 incf menupos,F
84
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
372 btfss apnoe_mins,0 ; Are we editing a boolean value ?
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
373 bra customfunctions2a ; NO : don't skip lines 2/3.
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
374
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
375 movlw d'4' ; Just after increment,
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
376 cpfsgt menupos ; Is current position < 4 ?
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
377 movwf menupos ; NO: skip set to 4.
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
378
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
379 customfunctions2a:
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
380 movlw d'7'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
381 cpfseq menupos ; =7?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
382 bra customfunctions3 ; No
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
383 movlw d'1'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
384 movwf menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
385
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
386 customfunctions3:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
387 clrf timeout_counter2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
388 call PLED_menu_cursor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
389
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
390 call wait_switches ; Waits until switches are released, resets flag if button stays pressed!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
391
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
392 bcf menubit3 ; clear flag
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
393 bra customfunctions_loop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
394
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
395 ;-----------------------------------------------------------------------------
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
396 ; Input : hi:lo = data to display, with type embebed into hi
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
397 ; FSR2 = current string pointer.
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
398 ; Trash : FSR1 (used to backup EEADRH and hi)
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
399
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
400 display_customfunction:
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
401 #ifndef NO_CF_TYPES
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
402 movff EEADRH, FSR1H ; Backup...
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
403 movff hi, FSR1L
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
404
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
405 ;---- decode type --------------------------------------------------------
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
406 movf hi,W ; Just set N/Z flags
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
407 bn cf_type_0 ; Keep 15bits value in old format.
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
408 bz cf_type_99 ; 8bit standard mode
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
409
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
410 ; Jump table:
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
411 dcfsnz hi
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
412 bra cf_type_01
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
413 dcfsnz hi
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
414 bra cf_type_02
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
415 dcfsnz hi
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
416 bra cf_type_03
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
417 dcfsnz hi
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
418 bra cf_type_04
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
419 dcfsnz hi
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
420 bra cf_type_05
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
421 dcfsnz hi
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
422 bra cf_type_06
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
423 dcfsnz hi
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
424 bra cf_type_07
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
425 bra cf_type_99 ; Default to 8bit mode...
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
426
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
427 cf_type_01: ; Type == 1 is percent mode
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
428 output_16dp 0 ; NOTE : hi is already reseted...
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
429 movlw '%'
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
430 movwf POSTINC2
84
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
431 bra cf_do_wp
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
432
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
433 cf_type_02: ; Type == 2 is deci mode.
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
434 output_16dp 4
84
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
435 bra cf_do_wp
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
436
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
437 cf_type_03: ; Type == 3 is centi mode.
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
438 output_16dp 3
84
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
439 bra cf_do_wp
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
440
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
441 cf_type_04: ; Type == 4 is mili mode
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
442 output_16dp 2
84
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
443 bra cf_do_wp
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
444
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
445 cf_type_05: ; Type == 5 is on/off mode.
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
446 movf lo,W ; Get flag value...
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
447 bz cf_type_off
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
448 OUTPUTTEXT d'130' ; ON
84
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
449 bra cf_do_wp
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
450 cf_type_off:
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
451 OUTPUTTEXT d'131' ; OFF
84
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
452 bra cf_do_wp
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
453
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
454 cf_type_06: ; Type == 6 is mm:ss mode (... or hh:mm)
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
455 call convert_time ; Convert to min:sec into hi:low.
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
456 movff lo,wp_temp ; Save seconds,
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
457 movff hi,lo ; Get minutes
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
458 output_8 ; Print them
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
459 movlw ':' ; Separator
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
460 movwf POSTINC2
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
461 movff wp_temp,lo ; Get back seconds
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
462 output_99x ; lo in 2 digits with trailing zeros.
84
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
463 bra cf_do_wp
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
464
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
465 cf_type_07: ; Type == 7 is Color swatch.
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
466 output_8
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
467
84
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
468 call cf_fill_line ; it does less flickering when editing colors...
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
469 call word_processor
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
470
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
471 movf lo,W ; Get color.
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
472 movff WREG,box_temp+0 ; Set color
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
473 movff win_top,WREG ; BEWARE : this is a bank0 variable !
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
474 movff WREG,box_temp+1 ; row top (0-239)
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
475 addlw .23
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
476 movff WREG,box_temp+2 ; row bottom (0-239)
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
477 movlw .110
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
478 movff WREG,box_temp+3 ; column left (0-159)
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
479 movlw .140
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
480 movff WREG,box_temp+4 ; column right (0-159)
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
481
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
482 call PLED_box
84
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
483 bra cf_done ; wp already done. Skip it...
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
484
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
485 cf_type_99: ; 8bit mode. Or unrecognized type...
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
486 clrf hi
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
487
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
488 cf_type_0: ; 15bit mode.
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
489 bcf hi,7
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
490 output_16
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
491
84
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
492 cf_do_wp: ; Process by calling wordprocessor
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
493 call cf_fill_line
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
494 call word_processor
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
495
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
496 cf_done:
84
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
497 movff FSR1L, hi ; And restore saved registers before return.
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
498 movff FSR1H, EEADRH
84
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
499 return
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
500
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
501 cf_fill_line: ; Mattias: No flicker if u clear just what you need...
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
502 movf FSR2L,W ; How many chars lefts ?
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
503 sublw (LOW letter) + .17 ; Remaining chars to fill: (letter + 21) - PTR
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
504 btfsc STATUS,N ; Add chars until none left...
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
505 return
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
506 movlw ' '
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
507 movwf POSTINC2
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
508 bra cf_fill_line
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
509
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
510 #else
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
511 bcf hi,7 ; clear Bit 7 of value
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
512 output_16
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
513
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
514 movff win_top,WREG ; Get "Default:" line position (BANK0 !)
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
515 xorlw .125 ; This is the default value ?
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
516 bnz cf_no_bits ; NO: skip bits for current value
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
517
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
518 movlw ','
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
519 movwf POSTINC2
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
520
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
521 movlw '1'
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
522 btfss EEDATA,7 ; 15Bit?
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
523 movlw '8' ; 8Bit!
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
524 tstfsz apnoe_mins ; apnoe_mins=0?
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
525 movlw '1' ; No, 1Bit!
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
526 movwf POSTINC2
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
527
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
528 movlw '5'
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
529 btfsc EEDATA,7 ; 15Bit?
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
530 movwf POSTINC2
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
531 movlw 'B'
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
532 movwf POSTINC2
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
533
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
534 cf_no_bits:
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
535 movlw ' '
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
536 movwf POSTINC2
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
537 movwf POSTINC2
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
538 movwf POSTINC2
84
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
539 goto word_processor
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
540 #endif
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
541
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
542 ;-----------------------------------------------------------------------------
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
543
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
544 do_customfunction:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
545 CLRF EEADRH
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
546 movlw d'1'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
547 btfsc customfunction_page
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
548 movwf EEADRH ; Reset EEADRH correct (Was adjusted in check_timeout...)
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
549
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
550 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
551 bra next_customfunction
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
552 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
553 bra toggle_plusminus
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
554 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
555 bra toggle_oneorten
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
556 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
557 bra restore_cfn_value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
558 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
559 bra adjust_cfn_value
84
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
560
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
561 exit_customfunctions:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
562 movlw d'2' ; Return to correct list entry
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
563 btfss customfunction_page
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
564 movlw d'1'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
565 movwf menupos ;
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
566 clrf EEADRH ; Clear EEADRH !
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
567 goto setup_menu2 ; exit...
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
568
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
569 next_customfunction:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
570 incf decodata+0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
571 btfsc decodata+0,5 ;>31?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
572 clrf decodata+0 ;Yes, so reset to zero
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
573
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
574 movf decodata+0,W
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
575 mullw d'4'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
576 movff PRODL, divemins+0 ;divemins+0 for correct addressing
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
577
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
578 movlw d'1'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
579 movwf menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
580 bra menu_custom_functions1 ; also debounces switches
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
581
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
582 toggle_plusminus:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
583 btg first_FA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
584 movlw d'2'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
585 movwf menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
586 bra menu_custom_functions1 ; also debounces switches
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
587
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
588 toggle_oneorten:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
589 btg second_FA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
590 movlw d'3'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
591 movwf menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
592 bra menu_custom_functions1 ; also debounces switches
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
593
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
594 restore_cfn_value:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
595 movf divemins+0,W ; read default value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
596 addlw 0x80
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
597 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
598 call read_eeprom ; Lowbyte
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
599 movff EEDATA,lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
600 movf divemins+0,W
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
601 addlw 0x81
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
602 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
603 call read_eeprom ; Highbyte
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
604 movff EEDATA,hi
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
605 bcf hi,7 ; clear bit 7 of value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
606
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
607 movf divemins+0,W ; store default value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
608 addlw 0x82
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
609 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
610 movff lo,EEDATA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
611 call write_eeprom ; Lowbyte
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
612 movf divemins+0,W
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
613 addlw 0x83
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
614 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
615 movff hi,EEDATA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
616 call write_eeprom ; Highbyte
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
617
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
618 movlw d'4'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
619 movwf menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
620 bra menu_custom_functions1 ; also debounces switches
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
621
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
622 adjust_cfn_value:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
623 movf divemins+0,W ; get current value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
624 addlw 0x82
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
625 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
626 call read_eeprom ; Lowbyte
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
627 movff EEDATA,lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
628 movf divemins+0,W
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
629 addlw 0x83
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
630 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
631 call read_eeprom ; Highbyte
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
632 movff EEDATA,hi
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
633
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
634 movf divemins+0,W
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
635 addlw 0x81
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
636 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
637 call read_eeprom ; Highbyte
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
638 movff EEDATA,divemins+1 ; Highbyte of default value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
639
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
640 btfss apnoe_mins,0 ; If apnoe_mins=1 then CF is binary
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
641 bra adjust_cfn_value1 ; Not Binary
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
642
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
643 tstfsz lo ; =0?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
644 setf lo ; No, Set to 255
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
645 incf lo,F ; Increase by one
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
646 clrf hi ; Delete hi byte (Not required but to make sure...)
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
647 bra adjust_cfn_value3 ; Store result
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
648
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
649 adjust_cfn_value1:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
650 btfss first_FA ; Minus?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
651 bra adjust_cfn_value2 ; No, Plus
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
652
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
653 movlw d'1'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
654 btfsc second_FA ; -10?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
655 movlw d'10'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
656
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
657 subwf lo,F ; substract value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
658 movlw d'0'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
659 btfsc divemins+1,7 ; 8Bit value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
660 subwfb hi,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
661
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
662 movlw b'01111111'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
663 btfsc hi,7 ; >32768?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
664 movwf hi
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
665
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
666 bra adjust_cfn_value3
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
667
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
668 adjust_cfn_value2:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
669 movlw d'1'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
670 btfsc second_FA ; +10?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
671 movlw d'10'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
672
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
673 addwf lo,F ; add value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
674 movlw d'0'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
675 btfsc divemins+1,7 ; 8Bit value?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
676 addwfc hi,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
677
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
678 btfsc hi,7 ; >32768?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
679 clrf hi
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
680
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
681 adjust_cfn_value3:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
682 movf divemins+0,W ; Store current value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
683 addlw 0x82
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
684 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
685 movff lo,EEDATA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
686 call write_eeprom ; Lowbyte
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
687 movf divemins+0,W
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
688 addlw 0x83
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
689 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
690 movff hi,EEDATA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
691 call write_eeprom ; Highbyte
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
692 movlw d'5'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
693 movwf menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
694 bra menu_custom_functions1 ; also debounces switches
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
695
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
696 getcustom15_default:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
697 ; # number of requested custom function in wreg
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
698 movwf customfunction_temp2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
699
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
700 movlw d'31'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
701 cpfsgt customfunction_temp2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
702 bra getcustom15_d2 ; Lower bank
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
703
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
704 movlw d'1' ; Upper Bank
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
705 movwf EEADRH
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
706 movlw d'32'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
707 subwf customfunction_temp2,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
708 bra getcustom15_d3
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
709 getcustom15_d2:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
710 clrf EEADRH
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
711 getcustom15_d3:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
712 movf customfunction_temp2,W
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
713 mullw d'4'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
714 movf PRODL,W ; x4 for adress
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
715 addlw d'128'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
716 movwf EEADR ; +130 for LOW Byte of value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
717 call read_eeprom ; Lowbyte
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
718 movff EEDATA,lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
719 incf EEADR,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
720 call read_eeprom ; Highbyte
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
721 movff EEDATA,hi
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
722 clrf EEADRH
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
723 #ifndef NO_CF_TYPES
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
724 btfss hi,7 ; Is it a 15bit value ?
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
725 clrf hi ; NO: clear type flags.
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
726 #endif
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
727 bcf hi,7 ; Always clear 15bit flag.
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
728 return ; return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
729
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
730 custom_functions_check_divemode: ;displays warning if a critical custom function is not set to default
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
731 dcfsnz cf_checker_counter,F ; counts custom functions to check for warning symbol
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
732 bra check_cf11
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
733 dcfsnz cf_checker_counter,F ; counts custom functions to check for warning symbol
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
734 bra check_cf12
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
735 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
736
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
737 custom_functions_check_surfmode: ;displays warning if a critical custom function is not set to default
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
738 dcfsnz cf_checker_counter,F ; counts custom functions to check for warning symbol
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
739 bra check_cf11
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
740 dcfsnz cf_checker_counter,F ; counts custom functions to check for warning symbol
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
741 bra check_cf12
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
742 dcfsnz cf_checker_counter,F ; counts custom functions to check for warning symbol
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
743 bra check_cf17
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
744 dcfsnz cf_checker_counter,F ; counts custom functions to check for warning symbol
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
745 bra check_cf18
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
746 dcfsnz cf_checker_counter,F ; counts custom functions to check for warning symbol
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
747 bra check_cf19
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
748 dcfsnz cf_checker_counter,F ; counts custom functions to check for warning symbol
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
749 bra check_cf29
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
750 dcfsnz cf_checker_counter,F ; counts custom functions to check for warning symbol
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
751 bra check_cf32
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
752 dcfsnz cf_checker_counter,F ; counts custom functions to check for warning symbol
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
753 bra check_cf33
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
754 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
755
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
756 check_cf11:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
757 movlw d'11' ; saturation factor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
758 rcall custom_function_check_low ; compares current with default value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
759 call test_and_display_warning ; displays the warning if the custom function is not correct
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
760 movlw d'2' ; next in testing row
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
761 movwf cf_checker_counter ;
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
762 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
763
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
764 check_cf12:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
765 movlw d'12' ; desaturation factor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
766 rcall custom_function_check_high ; compares current with default value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
767 call test_and_display_warning ; displays the warning if the custom function is not correct
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
768 movlw d'3' ; next in testing row
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
769 movwf cf_checker_counter ;
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
770 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
771
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
772 check_cf17:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
773 movlw d'17' ; lower threshold ppO2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
774 rcall custom_function_check_low ; compares current with default value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
775 call test_and_display_warning ; displays the warning if the custom function is not correct
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
776 movlw d'4' ; next in testing row
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
777 movwf cf_checker_counter ;
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
778 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
779
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
780 check_cf18:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
781 movlw d'18' ; upper threshold ppO2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
782 rcall custom_function_check_high ; compares current with default value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
783 call test_and_display_warning ; displays the warning if the custom function is not correct
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
784 movlw d'5' ; next in testing row
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
785 movwf cf_checker_counter ;
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
786 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
787
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
788 check_cf19:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
789 movlw d'19' ; upper threshold ppO2 display
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
790 rcall custom_function_check_high ; compares current with default value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
791 call test_and_display_warning ; displays the warning if the custom function is not correct
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
792 movlw d'6' ; next in testing row
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
793 movwf cf_checker_counter ;
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
794 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
795
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
796 check_cf29:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
797 movlw d'6'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
798 movwf cf_checker_counter ; upper limit for CF29, here: used as a temp variable
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
799 movlw d'29' ; last deco stop in [m]
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
800 rcall custom_function_check_high_limit ; compares current with default value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
801 call test_and_display_warning ; displays the warning if the custom function is not correct
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
802 movlw d'7' ; next in testing row
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
803 movwf cf_checker_counter ;
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
804 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
805
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
806 check_cf32:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
807 movlw d'32' ; GF LOW
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
808 rcall custom_function_check_high ; compares current with default value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
809 call test_and_display_warning ; displays the warning if the custom function is not correct
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
810 movlw d'8' ; next in testing row
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
811 movwf cf_checker_counter ;
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
812 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
813
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
814 check_cf33:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
815 movlw d'33' ; GF HIGH
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
816 rcall custom_function_check_high ; compares current with default value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
817 call test_and_display_warning ; displays the warning if the custom function is not correct
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
818 movlw d'1' ; next in testing row
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
819 movwf cf_checker_counter ;
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
820 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
821
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
822
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
823 test_and_display_warning:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
824 movwf lo ; copy result
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
825 tstfsz lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
826 return ; CF OK
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
827 goto custom_warn_surfmode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
828
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
829 custom_function_check_low: ; Checks CF (#WREG)
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
830 ; Returns WREG=0 if CF is lower then default
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
831 movwf temp1 ; save for custom value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
832 call getcustom15_1 ; Get Current Value stored in hi and lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
833 movff lo,sub_a+0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
834 movff hi,sub_a+1 ; save value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
835
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
836 movf temp1,w
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
837 call getcustom15_default ; Get Default value stored in hi and lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
838 movff lo,sub_b+0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
839 movff hi,sub_b+1 ; save value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
840 call sub16 ; sub_c = sub_a - sub_b with "neg_flag" bit set if sub_b > sub_a
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
841 btfss neg_flag ; negative?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
842 retlw .255 ; no
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
843 retlw .0 ; yes
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
844
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
845 custom_function_check_high: ; Checks CF (#WREG)
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
846 ; Returns WREG=0 if CF is higher then default
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
847 movwf temp1 ; save for custom value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
848 call getcustom15_1 ; Get Current Value stored in hi and lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
849 movff lo,sub_b+0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
850 movff hi,sub_b+1 ; save value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
851
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
852 movf temp1,w
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
853 call getcustom15_default ; Get Default value stored in hi and lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
854 movff lo,sub_a+0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
855 movff hi,sub_a+1 ; save value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
856 call sub16 ; sub_c = sub_a - sub_b with "neg_flag" bit set if sub_b > sub_a
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
857 btfss neg_flag ; negative?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
858 retlw .255 ; no
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
859 retlw .0 ; yes
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
860
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
861 custom_function_check_high_limit: ; Checks if CF (#WREG) is lower then limit (#cf_checker_counter)
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
862 movwf temp1 ; save for custom value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
863 call getcustom15_1 ; Get Current Value stored in hi and lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
864 movff lo,sub_b+0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
865 movff hi,sub_b+1 ; save value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
866 movff cf_checker_counter, sub_a+0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
867 clrf sub_a+1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
868 call sub16 ; sub_c = sub_a - sub_b with "neg_flag" bit set if sub_b > sub_a
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
869 btfss neg_flag ; negative?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
870 retlw .255 ; no
25
99512945c7a1 1.61 beta rc2
heinrichsweikamp
parents: 17
diff changeset
871 retlw .0 ; yes