annotate code_part1/OSTC_code_asm_part1/menu_custom.asm @ 79:69c462400279

Making CF edition esier
author JeanDo
date Mon, 06 Dec 2010 18:00:13 +0100
parents c6cab044a338
children 3e351e25f5d1
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:
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
166
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
167 #ifndef NO_CF_TYPES
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
168 ;---- Clear color swatches area ------------------------------------------
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
169 ; BEWARE: PLED_box reset the EEADRH register, so t should be
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
170 ; be done before setting CF page I/II...
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
171 clrf WREG ; Black background
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
172 movff WREG,box_temp+0 ; Set color
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
173 movlw .125
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
174 movff WREG,box_temp+1 ; row top (0-239)
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
175 movlw .178
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
176 movff WREG,box_temp+2 ; row bottom (0-239)
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
177 movlw .75
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
178 movff WREG,box_temp+3 ; column left (0-159)
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
179 movlw .150
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
180 movff WREG,box_temp+4 ; column right (0-159)
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
181 call PLED_box
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
182 #endif
29
c6cab044a338 1.61beta rc2
heinrichsweikamp
parents: 27
diff changeset
183 call PLED_standard_color
c6cab044a338 1.61beta rc2
heinrichsweikamp
parents: 27
diff changeset
184
7
5c4ba624165d cf32 bug fixed
heinrichsweikamp
parents: 0
diff changeset
185 movlw d'1'
5c4ba624165d cf32 bug fixed
heinrichsweikamp
parents: 0
diff changeset
186 btfss customfunction_page ; Use Page II...
5c4ba624165d cf32 bug fixed
heinrichsweikamp
parents: 0
diff changeset
187 movlw d'0'
5c4ba624165d cf32 bug fixed
heinrichsweikamp
parents: 0
diff changeset
188 movwf EEADRH
5c4ba624165d cf32 bug fixed
heinrichsweikamp
parents: 0
diff changeset
189
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
190 clrf timeout_counter2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
191 bcf menubit2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
192 bcf menubit3
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
193 WIN_LEFT .20
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
194 WIN_TOP .35
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
195 lfsr FSR2,letter
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
196 movff decodata+0,lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
197
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
198 movlw d'0'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
199 btfsc customfunction_page ; Add offset for display
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
200 movlw d'32'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
201 addwf lo,F
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
202 movff lo, apnoe_mins ; Copy use when NO_CF_TYPES
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
203
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
204 output_99x
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
205 movlw ':'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
206 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
207 movlw ' '
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
208 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
209 call word_processor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
210
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
211 movf customfunction_temp1,W ; start of custom function descriptors
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
212 addwf decodata+0,W ; add # of current custom function, place result in wreg
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
213 call displaytext1 ; shows descriptor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
214
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
215 ; Read defaults into hi:lo
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
216 movf divemins+0,W
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
217 addlw 0x80
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
218 movwf EEADR
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
219 call read_eeprom ; Lowbyte
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
220 movff EEDATA,lo
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
221 movf divemins+0,W
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
222 addlw 0x81
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
223 movwf EEADR
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
224 call read_eeprom ; Highbyte
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
225 movff EEDATA,hi
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
226
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
227 #ifdef NO_CF_TYPES
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
228 movlw binary_cf1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
229 subwf apnoe_mins,W ; Binary cf?
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
230 bz menu_custom_functions10c ; Yes
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
231
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
232 movlw binary_cf2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
233 subwf apnoe_mins,W ; Binary cf?
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
234 bz menu_custom_functions10c ; Yes
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
235
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
236 movlw binary_cf3
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
237 subwf apnoe_mins,W ; Binary cf?
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
238 bz menu_custom_functions10c ; Yes
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
239
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
240 movlw binary_cf4
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
241 subwf apnoe_mins,W ; Binary cf?
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
242 bz menu_custom_functions10c ; Yes
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
243
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
244 movlw binary_cf5
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
245 subwf apnoe_mins,W ; Binary cf?
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
246 bz menu_custom_functions10c ; Yes
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
247
17
68825abc35f7 1.55beta rc1
heinrichsweikamp
parents: 7
diff changeset
248 movlw binary_cf6
68825abc35f7 1.55beta rc1
heinrichsweikamp
parents: 7
diff changeset
249 subwf apnoe_mins,W ; Binary cf?
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
250 bz menu_custom_functions10c ; Yes
17
68825abc35f7 1.55beta rc1
heinrichsweikamp
parents: 7
diff changeset
251
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
252 bra menu_custom_functions10a ; Not a binary CF...
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
253 #else
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
254 movf hi,W ; Is it a ON/OFF flag ?
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
255 xorlw CF_BOOL
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
256 bnz menu_custom_functions10a ; Not a binary CF selected
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
257 #endif
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
258
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
259 menu_custom_functions10c:
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
260 setf apnoe_mins ; Yes, set apnoe_mins to 0xFF
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
261
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
262 WIN_LEFT .20
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
263 WIN_TOP .65
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
264 lfsr FSR2,letter ; Make a string of 8 spaces
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
265 movlw ' '
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
266 movwf POSTINC2
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
267 movwf POSTINC2
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
268 movwf POSTINC2
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
269 movwf POSTINC2
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
270 movwf POSTINC2
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
271 movwf POSTINC2
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
272 movwf POSTINC2
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
273 movwf POSTINC2
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
274 call word_processor ; Clear +/- line
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
275
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
276 WIN_TOP .95
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
277 call word_processor ; Clear 1/10 line
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
278 bra menu_custom_functions10b
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
279
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
280 menu_custom_functions10a:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
281 clrf apnoe_mins ; Yes, clear apnoe_mins
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
282
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
283 WIN_LEFT .20
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
284 WIN_TOP .65
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
285 lfsr FSR2,letter
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
286 movlw '+'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
287 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
288 movlw '/'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
289 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
290 movlw '-'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
291 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
292 movlw ':'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
293 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
294 movlw ' '
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
295 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
296 movlw '+'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
297 btfsc first_FA
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
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
302 WIN_LEFT .20
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
303 WIN_TOP .95
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
304 lfsr FSR2,letter
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
305 movlw '1'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
306 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
307 movlw '/'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
308 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
309 movlw '1'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
310 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
311 movlw '0'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
312 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
313 movlw ':'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
314 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
315 movlw ' '
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
316 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
317 movlw '1'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
318 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
319 movlw '0'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
320 btfsc second_FA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
321 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
322 movlw ' '
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
323 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
324 call word_processor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
325
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
326 menu_custom_functions10b:
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
327 WIN_LEFT .20
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
328 WIN_TOP .125
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
329 lfsr FSR2,letter
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
330 OUTPUTTEXT d'89' ;"Default:"
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
331 movlw ' '
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
332 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
333
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
334 call display_customfunction ; Typed display.
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
335
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
336 WIN_LEFT .20
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
337 WIN_TOP .155
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
338 lfsr FSR2,letter
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
339 OUTPUTTEXT d'97' ; "Current:"
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
340 movlw ' '
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
341 movwf POSTINC2
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
342
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
343 movf divemins+0,W
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
344 addlw 0x82
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
345 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
346 call read_eeprom ; Lowbyte
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
347 movff EEDATA,lo
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
348
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
349 movf divemins+0,W
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
350 addlw 0x83
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
351 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
352 call read_eeprom ; Highbyte
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
353
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
354 btfss hi,7 ; A 15bit value ?
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
355 bra menu_custom_functions1b ; No : keep types there !
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
356
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
357 movff EEDATA,hi
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
358 bsf hi,7 ; Mark it a 15bit value.
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
359
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
360 menu_custom_functions1b:
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
361 call display_customfunction
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
362
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
363 menu_custom_functions1a:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
364 DISPLAYTEXT .11 ; Exit
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
365
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
366 call wait_switches ; Waits until switches are released, resets flag if button stays pressed!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
367 call PLED_menu_cursor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
368
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
369 customfunctions_loop:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
370 call check_switches_logbook
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
371
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
372 btfsc menubit3
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
373 bra customfunctions2 ; Move cursor or generate next page
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
374
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
375 btfsc menubit2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
376 bra do_customfunction ; call subfunction
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
377
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
378 btfsc divemode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
379 goto restart ; dive started during cf menu
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
380
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
381 btfsc onesecupdate
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
382 call timeout_surfmode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
383
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
384 btfsc onesecupdate
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
385 call set_dive_modes
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
386
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
387 bcf onesecupdate ; end of 1sek. tasks
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
388
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
389 btfsc sleepmode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
390 bra exit_customfunctions
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
391
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
392 bra customfunctions_loop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
393
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
394 customfunctions2:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
395 incf menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
396 movlw d'7'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
397 cpfseq menupos ; =7?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
398 bra customfunctions3 ; No
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
399 movlw d'1'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
400 movwf menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
401
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
402 customfunctions3:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
403 clrf timeout_counter2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
404 call PLED_menu_cursor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
405
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
406 call wait_switches ; Waits until switches are released, resets flag if button stays pressed!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
407
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
408 bcf menubit3 ; clear flag
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
409 bra customfunctions_loop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
410
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
411 ;-----------------------------------------------------------------------------
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
412 ; Input : hi:lo = data to display, with type embebed into hi
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
413 ; FSR2 = current string pointer.
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
414 ; Trash : FSR1 (used to backup EEADRH and hi)
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
415
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
416 display_customfunction:
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
417 #ifndef NO_CF_TYPES
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
418 movff EEADRH, FSR1H ; Backup...
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
419 movff hi, FSR1L
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
420
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
421 ;---- decode type --------------------------------------------------------
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
422 movf hi,W ; Just set N/Z flags
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
423 bn cf_type_0 ; Keep 15bits value in old format.
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
424 bz cf_type_99 ; 8bit standard mode
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
425
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
426 ; Jump table:
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
427 dcfsnz hi
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
428 bra cf_type_01
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
429 dcfsnz hi
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
430 bra cf_type_02
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
431 dcfsnz hi
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
432 bra cf_type_03
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
433 dcfsnz hi
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
434 bra cf_type_04
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
435 dcfsnz hi
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
436 bra cf_type_05
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
437 dcfsnz hi
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
438 bra cf_type_06
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
439 dcfsnz hi
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
440 bra cf_type_07
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
441 bra cf_type_99 ; Default to 8bit mode...
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
442
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
443 cf_type_01: ; Type == 1 is percent mode
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
444 output_16dp 0 ; NOTE : hi is already reseted...
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
445 movlw '%'
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
446 movwf POSTINC2
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
447 bra cf_done
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
448
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
449 cf_type_02: ; Type == 2 is deci mode.
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
450 output_16dp 4
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
451 bra cf_done
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
452
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
453 cf_type_03: ; Type == 3 is centi mode.
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
454 output_16dp 3
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
455 bra cf_done
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
456
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
457 cf_type_04: ; Type == 4 is mili mode
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
458 output_16dp 2
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
459 bra cf_done
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
460
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
461 cf_type_05: ; Type == 5 is on/off mode.
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
462 movf lo,W ; Get flag value...
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
463 bz cf_type_off
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
464 OUTPUTTEXT d'130' ; ON
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
465 bra cf_done
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
466 cf_type_off:
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
467 OUTPUTTEXT d'131' ; OFF
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
468 bra cf_done
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
469
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
470 cf_type_06: ; Type == 6 is mm:ss mode (... or hh:mm)
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
471 call convert_time ; Convert to min:sec into hi:low.
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
472 movff lo,wp_temp ; Save seconds,
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
473 movff hi,lo ; Get minutes
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
474 output_8 ; Print them
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
475 movlw ':' ; Separator
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
476 movwf POSTINC2
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
477 movff wp_temp,lo ; Get back seconds
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
478 output_99x ; lo in 2 digits with trailing zeros.
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
479 bra cf_done
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
480
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
481 cf_type_07: ; Type == 7 is Color swatch.
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
482 output_8
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
483
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
484 movf lo,W ; Get color.
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
485 movff WREG,box_temp+0 ; Set color
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
486 movff win_top,WREG ; BEWARE : this is a bank0 variable !
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
487 movff WREG,box_temp+1 ; row top (0-239)
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
488 addlw .23
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
489 movff WREG,box_temp+2 ; row bottom (0-239)
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
490 movlw .110
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
491 movff WREG,box_temp+3 ; column left (0-159)
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
492 movlw .140
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
493 movff WREG,box_temp+4 ; column right (0-159)
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
494
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
495 call PLED_box
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
496 bra cf_done ; W/o trailling spaces...
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
497
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
498 cf_type_99: ; 8bit mode. Or unrecognized type...
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
499 clrf hi
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
500
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
501 cf_type_0: ; 15bit mode.
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
502 bcf hi,7
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
503 output_16
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
504
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
505 cf_done:
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
506 movff FSR1L, hi ; Restore saved registers...
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
507 movff FSR1H, EEADRH
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
508 #else
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
509 bcf hi,7 ; clear Bit 7 of value
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
510 output_16
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
511
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
512 movff win_top,WREG ; Get "Default:" line position (BANK0 !)
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
513 xorlw .125 ; This is the default value ?
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
514 bnz cf_no_bits ; NO: skip bits for current value
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
515
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
516 movlw ','
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
517 movwf POSTINC2
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
518
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
519 movlw '1'
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
520 btfss EEDATA,7 ; 15Bit?
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
521 movlw '8' ; 8Bit!
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
522 tstfsz apnoe_mins ; apnoe_mins=0?
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
523 movlw '1' ; No, 1Bit!
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
524 movwf POSTINC2
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
525
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
526 movlw '5'
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
527 btfsc EEDATA,7 ; 15Bit?
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
528 movwf POSTINC2
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
529 movlw 'B'
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
530 movwf POSTINC2
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
531
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
532 cf_no_bits:
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
533 movlw ' '
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
534 movwf POSTINC2
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
535 movwf POSTINC2
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
536 movwf POSTINC2
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
537 #endif
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
538 goto word_processor
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
539
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
540 ;-----------------------------------------------------------------------------
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
541
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
542 do_customfunction:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
543 CLRF EEADRH
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
544 movlw d'1'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
545 btfsc customfunction_page
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
546 movwf EEADRH ; Reset EEADRH correct (Was adjusted in check_timeout...)
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
547
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
548 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
549 bra next_customfunction
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
550 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
551 bra toggle_plusminus
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
552 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
553 bra toggle_oneorten
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
554 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
555 bra restore_cfn_value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
556 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
557 bra adjust_cfn_value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
558 exit_customfunctions:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
559 movlw d'2' ; Return to correct list entry
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
560 btfss customfunction_page
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
561 movlw d'1'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
562 movwf menupos ;
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
563 clrf EEADRH ; Clear EEADRH !
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
564 goto setup_menu2 ; exit...
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
565
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
566
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
567 next_customfunction:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
568 incf decodata+0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
569 btfsc decodata+0,5 ;>31?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
570 clrf decodata+0 ;Yes, so reset to zero
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
571
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
572 movf decodata+0,W
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
573 mullw d'4'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
574 movff PRODL, divemins+0 ;divemins+0 for correct addressing
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
575
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
576 movlw d'1'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
577 movwf menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
578 bra menu_custom_functions1 ; also debounces switches
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
579
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
580 toggle_plusminus:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
581 btg first_FA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
582 movlw d'2'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
583 movwf menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
584 bra menu_custom_functions1 ; also debounces switches
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
585
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
586 toggle_oneorten:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
587 btg second_FA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
588 movlw d'3'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
589 movwf menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
590 bra menu_custom_functions1 ; also debounces switches
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
591
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
592 restore_cfn_value:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
593 movf divemins+0,W ; read default value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
594 addlw 0x80
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
595 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
596 call read_eeprom ; Lowbyte
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
597 movff EEDATA,lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
598 movf divemins+0,W
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
599 addlw 0x81
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
600 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
601 call read_eeprom ; Highbyte
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
602 movff EEDATA,hi
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
603 bcf hi,7 ; clear bit 7 of value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
604
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
605 movf divemins+0,W ; store default value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
606 addlw 0x82
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
607 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
608 movff lo,EEDATA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
609 call write_eeprom ; Lowbyte
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
610 movf divemins+0,W
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
611 addlw 0x83
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
612 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
613 movff hi,EEDATA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
614 call write_eeprom ; Highbyte
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
615
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
616 movlw d'4'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
617 movwf menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
618 bra menu_custom_functions1 ; also debounces switches
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
619
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
620 adjust_cfn_value:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
621 movf divemins+0,W ; get current value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
622 addlw 0x82
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
623 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
624 call read_eeprom ; Lowbyte
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
625 movff EEDATA,lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
626 movf divemins+0,W
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
627 addlw 0x83
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
628 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
629 call read_eeprom ; Highbyte
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
630 movff EEDATA,hi
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
631
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
632 movf divemins+0,W
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
633 addlw 0x81
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
634 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
635 call read_eeprom ; Highbyte
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
636 movff EEDATA,divemins+1 ; Highbyte of default value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
637
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
638 btfss apnoe_mins,0 ; If apnoe_mins=1 then CF is binary
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
639 bra adjust_cfn_value1 ; Not Binary
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
640
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
641 tstfsz lo ; =0?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
642 setf lo ; No, Set to 255
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
643 incf lo,F ; Increase by one
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
644 clrf hi ; Delete hi byte (Not required but to make sure...)
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
645 bra adjust_cfn_value3 ; Store result
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
646
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
647 adjust_cfn_value1:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
648 btfss first_FA ; Minus?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
649 bra adjust_cfn_value2 ; No, Plus
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
650
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
651 movlw d'1'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
652 btfsc second_FA ; -10?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
653 movlw d'10'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
654
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
655 subwf lo,F ; substract value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
656 movlw d'0'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
657 btfsc divemins+1,7 ; 8Bit value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
658 subwfb hi,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
659
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
660 movlw b'01111111'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
661 btfsc hi,7 ; >32768?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
662 movwf hi
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
663
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
664 bra adjust_cfn_value3
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
665
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
666 adjust_cfn_value2:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
667 movlw d'1'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
668 btfsc second_FA ; +10?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
669 movlw d'10'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
670
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
671 addwf lo,F ; add value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
672 movlw d'0'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
673 btfsc divemins+1,7 ; 8Bit value?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
674 addwfc hi,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
675
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
676 btfsc hi,7 ; >32768?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
677 clrf hi
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
678
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
679 adjust_cfn_value3:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
680 movf divemins+0,W ; Store current value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
681 addlw 0x82
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
682 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
683 movff lo,EEDATA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
684 call write_eeprom ; Lowbyte
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
685 movf divemins+0,W
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
686 addlw 0x83
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
687 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
688 movff hi,EEDATA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
689 call write_eeprom ; Highbyte
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
690 movlw d'5'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
691 movwf menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
692 bra menu_custom_functions1 ; also debounces switches
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
693
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
694 getcustom15_default:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
695 ; # number of requested custom function in wreg
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
696 movwf customfunction_temp2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
697
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
698 movlw d'31'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
699 cpfsgt customfunction_temp2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
700 bra getcustom15_d2 ; Lower bank
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
701
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
702 movlw d'1' ; Upper Bank
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
703 movwf EEADRH
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
704 movlw d'32'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
705 subwf customfunction_temp2,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
706 bra getcustom15_d3
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
707 getcustom15_d2:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
708 clrf EEADRH
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
709 getcustom15_d3:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
710 movf customfunction_temp2,W
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
711 mullw d'4'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
712 movf PRODL,W ; x4 for adress
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
713 addlw d'128'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
714 movwf EEADR ; +130 for LOW Byte of value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
715 call read_eeprom ; Lowbyte
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
716 movff EEDATA,lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
717 incf EEADR,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
718 call read_eeprom ; Highbyte
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
719 movff EEDATA,hi
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
720 clrf EEADRH
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
721 #ifndef NO_CF_TYPES
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
722 btfss hi,7 ; Is it a 15bit value ?
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
723 clrf hi ; NO: clear type flags.
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
724 #endif
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
725 bcf hi,7 ; Always clear 15bit flag.
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
726 return ; return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
727
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
728 custom_functions_check_divemode: ;displays warning if a critical custom function is not set to default
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
729 dcfsnz cf_checker_counter,F ; counts custom functions to check for warning symbol
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
730 bra check_cf11
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_cf12
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
733 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
734
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
735 custom_functions_check_surfmode: ;displays warning if a critical custom function is not set to default
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
736 dcfsnz cf_checker_counter,F ; counts custom functions to check for warning symbol
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
737 bra check_cf11
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_cf12
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_cf17
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_cf18
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_cf19
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_cf29
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_cf32
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_cf33
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
752 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
753
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
754 check_cf11:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
755 movlw d'11' ; saturation factor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
756 rcall custom_function_check_low ; compares current with default value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
757 call test_and_display_warning ; displays the warning if the custom function is not correct
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
758 movlw d'2' ; next in testing row
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
759 movwf cf_checker_counter ;
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
760 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
761
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
762 check_cf12:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
763 movlw d'12' ; desaturation factor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
764 rcall custom_function_check_high ; compares current with default value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
765 call test_and_display_warning ; displays the warning if the custom function is not correct
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
766 movlw d'3' ; next in testing row
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
767 movwf cf_checker_counter ;
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
768 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
769
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
770 check_cf17:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
771 movlw d'17' ; lower threshold ppO2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
772 rcall custom_function_check_low ; compares current with default value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
773 call test_and_display_warning ; displays the warning if the custom function is not correct
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
774 movlw d'4' ; next in testing row
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
775 movwf cf_checker_counter ;
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
776 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
777
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
778 check_cf18:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
779 movlw d'18' ; upper threshold ppO2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
780 rcall custom_function_check_high ; compares current with default value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
781 call test_and_display_warning ; displays the warning if the custom function is not correct
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
782 movlw d'5' ; next in testing row
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
783 movwf cf_checker_counter ;
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
784 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
785
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
786 check_cf19:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
787 movlw d'19' ; upper threshold ppO2 display
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
788 rcall custom_function_check_high ; compares current with default value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
789 call test_and_display_warning ; displays the warning if the custom function is not correct
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
790 movlw d'6' ; next in testing row
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
791 movwf cf_checker_counter ;
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
792 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
793
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
794 check_cf29:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
795 movlw d'6'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
796 movwf cf_checker_counter ; upper limit for CF29, here: used as a temp variable
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
797 movlw d'29' ; last deco stop in [m]
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
798 rcall custom_function_check_high_limit ; compares current with default value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
799 call test_and_display_warning ; displays the warning if the custom function is not correct
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
800 movlw d'7' ; next in testing row
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
801 movwf cf_checker_counter ;
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
802 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
803
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
804 check_cf32:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
805 movlw d'32' ; GF LOW
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
806 rcall custom_function_check_high ; compares current with default value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
807 call test_and_display_warning ; displays the warning if the custom function is not correct
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
808 movlw d'8' ; next in testing row
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
809 movwf cf_checker_counter ;
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
810 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
811
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
812 check_cf33:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
813 movlw d'33' ; GF HIGH
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
814 rcall custom_function_check_high ; compares current with default value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
815 call test_and_display_warning ; displays the warning if the custom function is not correct
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
816 movlw d'1' ; next in testing row
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
817 movwf cf_checker_counter ;
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
818 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
819
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
820
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
821 test_and_display_warning:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
822 movwf lo ; copy result
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
823 tstfsz lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
824 return ; CF OK
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
825 goto custom_warn_surfmode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
826
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
827 custom_function_check_low: ; Checks CF (#WREG)
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
828 ; Returns WREG=0 if CF is lower then default
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
829 movwf temp1 ; save for custom value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
830 call getcustom15_1 ; Get Current Value stored in hi and lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
831 movff lo,sub_a+0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
832 movff hi,sub_a+1 ; save value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
833
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
834 movf temp1,w
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
835 call getcustom15_default ; Get Default value stored in hi and lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
836 movff lo,sub_b+0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
837 movff hi,sub_b+1 ; save value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
838 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
839 btfss neg_flag ; negative?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
840 retlw .255 ; no
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
841 retlw .0 ; yes
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
842
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
843 custom_function_check_high: ; Checks CF (#WREG)
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
844 ; Returns WREG=0 if CF is higher then default
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
845 movwf temp1 ; save for custom value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
846 call getcustom15_1 ; Get Current Value stored in hi and lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
847 movff lo,sub_b+0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
848 movff hi,sub_b+1 ; save value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
849
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
850 movf temp1,w
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
851 call getcustom15_default ; Get Default value stored in hi and lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
852 movff lo,sub_a+0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
853 movff hi,sub_a+1 ; save value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
854 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
855 btfss neg_flag ; negative?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
856 retlw .255 ; no
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
857 retlw .0 ; yes
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
858
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
859 custom_function_check_high_limit: ; Checks if CF (#WREG) is lower then limit (#cf_checker_counter)
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
860 movwf temp1 ; save for custom value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
861 call getcustom15_1 ; Get Current Value stored in hi and lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
862 movff lo,sub_b+0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
863 movff hi,sub_b+1 ; save value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
864 movff cf_checker_counter, sub_a+0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
865 clrf sub_a+1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
866 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
867 btfss neg_flag ; negative?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
868 retlw .255 ; no
25
99512945c7a1 1.61 beta rc2
heinrichsweikamp
parents: 17
diff changeset
869 retlw .0 ; yes