annotate code_part1/OSTC_code_asm_part1/menu_custom.asm @ 90:6655b1c59adc

FIX new cf menu BOOL mode: should skip lines 2&3.
author JeanDo
date Fri, 10 Dec 2010 02:36:56 +0100
parents b40a0a6284da
children ce3283064cde
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.
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
51 CF_PERCENT EQU 1 ; Displays 110%
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
52 CF_DECI EQU 2 ; Displays 1.6
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
53 CF_CENTI EQU 3 ; Displays 1.50
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
54 CF_MILI EQU 4 ; Displays 1.015
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
55 CF_BOOL EQU 5 ; Displays ON/OFF
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
56 CF_SEC EQU 6 ; Displays 4:00
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
57 CF_COLOR EQU 7 ; Display 240 plus a color watch (inverse video space)
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
58 ;
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
59 CF_TYPES EQU 0x1F
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
60 CF_MAX_BIT EQU 6 ; Default is the highest safe value.
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
61 CF_MAX EQU (1<<CF_MAX_BIT)
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
62 CF_MIN_BIT EQU 5 ; Default is the lowest safe value.
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
63 CF_MIN EQU (1<<CF_MIN_BIT)
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
64 ;
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
65 CF_INT15 EQU 0x80; Default display. Flag for 15bit, typeless values.
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
66
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
67 ; Overlay our tmp data with some unused variables. But use more
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
68 ; meaningfull labels...
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
69 cf32_x4 EQU divemins+0 ; CF# modulus 32, time 4.
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
70 cf_type EQU divemins+1 ; Type of the edited CF
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
71 cf_value EQU divesecs
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
72 cf_min EQU apnoe_mins
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
73 cf_max EQU apnoe_secs
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
74
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
75 GETCUSTOM8 macro custom8
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
76 movlw custom8
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
77 call getcustom8_1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
78 endm
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
79
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
80 getcustom8_1:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
81 ; # number of requested custom function in wreg
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
82 movwf customfunction_temp2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
83
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
84 movlw d'31'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
85 cpfsgt customfunction_temp2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
86 bra getcustom8_2 ; Lower bank
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
87
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
88 movlw d'1' ; Upper Bank
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
89 movwf EEADRH
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
90 movlw d'32'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
91 subwf customfunction_temp2,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
92 bra getcustom8_3
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
93
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
94 getcustom8_2:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
95 clrf EEADRH
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
96 getcustom8_3:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
97 movf customfunction_temp2,W
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
98 mullw d'4'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
99 movf PRODL,W ; x4 for adress
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
100 addlw d'130'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
101 movwf EEADR ; +130 for LOW Byte of value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
102 call read_eeprom ; Lowbyte
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
103 movf EEDATA,W ; copied into wreg
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
104 clrf EEADRH
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
105 return ; return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
106
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
107 GETCUSTOM15 macro custom15
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
108 movlw custom15
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
109 call getcustom15_1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
110 endm
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
111
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
112 getcustom15_1:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
113 ; # number of requested custom function in wreg
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
114 movwf customfunction_temp2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
115
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
116 movlw d'31'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
117 cpfsgt customfunction_temp2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
118 bra getcustom15_2 ; Lower bank
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
119
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
120 movlw d'1' ; Upper Bank
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
121 movwf EEADRH
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
122 movlw d'32'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
123 subwf customfunction_temp2,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
124 bra getcustom15_3
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
125 getcustom15_2:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
126 clrf EEADRH
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
127 getcustom15_3:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
128 movf customfunction_temp2,W
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
129 mullw d'4'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
130 movf PRODL,W ; x4 for adress
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
131 addlw d'130'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
132 movwf EEADR ; +130 for LOW Byte of value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
133 call read_eeprom ; Lowbyte
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
134 movff EEDATA,lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
135 incf EEADR,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
136 call read_eeprom ; Highbyte
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
137 movff EEDATA,hi
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
138 clrf EEADRH
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
139 return ; return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
140
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
141 menu_custom_functions_page2:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
142 movlw d'154' ; start of custom function descriptors
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
143 movwf customfunction_temp1
7
5c4ba624165d cf32 bug fixed
heinrichsweikamp
parents: 0
diff changeset
144 bsf customfunction_page ; Use Page II...
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
145 bra menu_custom_functions0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
146
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
147 menu_custom_functions:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
148 movlw d'36' ; start of custom function descriptors
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
149 movwf customfunction_temp1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
150 bcf customfunction_page ; Use Page I...
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
151
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
152 menu_custom_functions0:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
153 bsf leftbind
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
154 call PLED_ClearScreen
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
155 movlw d'1'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
156 movwf menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
157
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
158 bcf menubit4
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
159 bcf cursor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
160 bcf sleepmode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
161 clrf decodata+0 ; here: # of CustomFunction
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
162 clrf cf32_x4 ; here: # of CustomFunction*4
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
163 bcf first_FA ; here: =1: -, =0: +
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
164 bcf second_FA ; here: =1: stepsize 1, =0: stepsize 10
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
165
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
166 call PLED_topline_box
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
167 WIN_INVERT .1 ; Init new Wordprocessor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
168
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
169 btfss customfunction_page ;
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
170 bra menu_custom_functions10
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
171 DISPLAYTEXT .186 ; Custom FunctionsII
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
172 bra menu_custom_functions11
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
173
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
174 menu_custom_functions10:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
175 DISPLAYTEXT .27 ; Custom FunctionsI
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
176
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
177 menu_custom_functions11:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
178 WIN_INVERT .0 ; Init new Wordprocessor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
179
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
180 menu_custom_functions1:
29
c6cab044a338 1.61beta rc2
heinrichsweikamp
parents: 27
diff changeset
181 call PLED_standard_color
c6cab044a338 1.61beta rc2
heinrichsweikamp
parents: 27
diff changeset
182
7
5c4ba624165d cf32 bug fixed
heinrichsweikamp
parents: 0
diff changeset
183 movlw d'1'
5c4ba624165d cf32 bug fixed
heinrichsweikamp
parents: 0
diff changeset
184 btfss customfunction_page ; Use Page II...
5c4ba624165d cf32 bug fixed
heinrichsweikamp
parents: 0
diff changeset
185 movlw d'0'
5c4ba624165d cf32 bug fixed
heinrichsweikamp
parents: 0
diff changeset
186 movwf EEADRH
5c4ba624165d cf32 bug fixed
heinrichsweikamp
parents: 0
diff changeset
187
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
188 clrf timeout_counter2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
189 bcf menubit2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
190 bcf menubit3
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
191 WIN_LEFT .20
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
192 WIN_TOP .35
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
193 lfsr FSR2,letter
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
194 movff decodata+0,lo ; decodata == CF number % 32
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
195
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
196 movlw d'0'
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
197 btfsc customfunction_page ; Add offset for display in CF menu II
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
198 movlw d'32'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
199 addwf lo,F
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
200
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
201 output_99x
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
202 movlw ':'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
203 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
204 movlw ' '
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
205 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
206 call word_processor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
207
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
208 movf customfunction_temp1,W ; start of custom function descriptors
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
209 addwf decodata+0,W ; add # of current custom function, place result in wreg
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
210 call displaytext1 ; shows descriptor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
211
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
212 ; Read default, type and min/max from reset table.
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
213 rcall cf_read_default
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
214
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
215 movf cf_type,W ; Is it a ON/OFF flag ?
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
216 xorlw CF_BOOL
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
217 bnz menu_custom_functions10a ; Not a binary CF selected
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
218
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
219 menu_custom_functions10c:
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
220 ; Erase unused lines when editing boolean...
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
221 WIN_LEFT .20
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
222 WIN_TOP .65
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
223 lfsr FSR2,letter ; Make a string of 8 spaces
84
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
224 call cf_fill_line
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
225 call word_processor ; Clear +/- line
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
226
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
227 WIN_TOP .95
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
228 call word_processor ; Clear 1/10 line
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
229
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
230 bra menu_custom_functions10b
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
231
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
232 menu_custom_functions10a:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
233 WIN_LEFT .20
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
234 WIN_TOP .65
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
235 lfsr FSR2,letter
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
236 movlw '+'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
237 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
238 movlw '/'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
239 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
240 movlw '-'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
241 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
242 movlw ':'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
243 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
244 movlw ' '
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
245 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
246 movlw '+'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
247 btfsc first_FA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
248 movlw '-'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
249 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
250 call word_processor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
251
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
252 WIN_LEFT .20
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
253 WIN_TOP .95
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
254 lfsr FSR2,letter
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
255 movlw '1'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
256 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
257 movlw '/'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
258 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
259 movlw '1'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
260 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
261 movlw '0'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
262 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
263 movlw ':'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
264 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
265 movlw ' '
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
266 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
267 movlw '1'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
268 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
269 movlw '0'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
270 btfsc second_FA
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 movwf POSTINC2
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
274 call word_processor
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
275
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
276 menu_custom_functions10b:
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
277 WIN_LEFT .20
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
278 WIN_TOP .125
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
279 lfsr FSR2,letter
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
280 OUTPUTTEXT d'89' ;"Default:"
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
281
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
282 call display_customfunction ; Typed display.
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
283
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
284 WIN_LEFT .20
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
285 WIN_TOP .155
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
286 lfsr FSR2,letter
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
287 OUTPUTTEXT d'97' ; "Current:"
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
288
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
289 movf cf32_x4,W
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
290 addlw 0x82
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
291 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
292 call read_eeprom ; Lowbyte
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
293 movff EEDATA,lo
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
294 movff EEDATA, cf_value ; Backup low 8bit value.
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
295
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
296 movf cf32_x4,W
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
297 addlw 0x83
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
298 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
299 call read_eeprom ; Highbyte
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
300 movff EEDATA,hi
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
301
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
302 call display_customfunction
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
303
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
304 ; End of mask: min/max and the exit line...
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
305 rcall display_minmax
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
306 DISPLAYTEXT .11 ; Exit
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
307
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
308 call wait_switches ; Waits until switches are released, resets flag if button stays pressed!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
309 call PLED_menu_cursor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
310
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
311 customfunctions_loop:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
312 call check_switches_logbook
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
313
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
314 btfsc menubit3
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
315 bra customfunctions2 ; Move cursor or generate next page
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
316
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
317 btfsc menubit2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
318 bra do_customfunction ; call subfunction
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
319
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
320 btfsc divemode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
321 goto restart ; dive started during cf menu
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
322
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
323 btfsc onesecupdate
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
324 call timeout_surfmode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
325
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
326 btfsc onesecupdate
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
327 call set_dive_modes
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
328
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
329 bcf onesecupdate ; end of 1sek. tasks
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
330
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
331 btfsc sleepmode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
332 bra exit_customfunctions
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
333
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
334 bra customfunctions_loop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
335
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
336 customfunctions2:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
337 incf menupos,F
90
6655b1c59adc FIX new cf menu BOOL mode: should skip lines 2&3.
JeanDo
parents: 86
diff changeset
338 movf cf_type,W ; Are we editing a boolean value ?
6655b1c59adc FIX new cf menu BOOL mode: should skip lines 2&3.
JeanDo
parents: 86
diff changeset
339 xorlw CF_BOOL
6655b1c59adc FIX new cf menu BOOL mode: should skip lines 2&3.
JeanDo
parents: 86
diff changeset
340 bnz customfunctions2a ; NO : don't skip lines 2/3.
84
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
341
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
342 movlw d'4' ; Just after increment,
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
343 cpfsgt menupos ; Is current position < 4 ?
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
344 movwf menupos ; NO: skip set to 4.
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
345
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
346 customfunctions2a:
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
347 movlw d'7'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
348 cpfseq menupos ; =7?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
349 bra customfunctions3 ; No
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
350 movlw d'1'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
351 movwf menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
352
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
353 customfunctions3:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
354 clrf timeout_counter2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
355 call PLED_menu_cursor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
356
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
357 call wait_switches ; Waits until switches are released, resets flag if button stays pressed!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
358
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
359 bcf menubit3 ; clear flag
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
360 bra customfunctions_loop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
361
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
362 ;-----------------------------------------------------------------------------
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
363 ; Read default value (into hi:lo), cf_type, and cf_min/cf_max if any.
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
364 ;
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
365 cf_read_default:
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
366 movlw LOW(cf_default_table0) ; Get 24bit PROM pointer. SKIP
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
367 movwf TBLPTRL
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
368 movlw HIGH(cf_default_table0)
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
369 movwf TBLPTRH
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
370 movlw UPPER(cf_default_table0)
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
371 movwf TBLPTRU
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
372
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
373 movlw 0
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
374 btfsc customfunction_page ; Page II CF# ?
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
375 movlw 0x80 ; YES: add 128 to ptr.
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
376 addwf cf32_x4,W ; Add 4 x (CF index modulus 32)
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
377 addwf TBLPTRL,F ; And to a 8+16 add into TBLPTR
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
378 movlw 0 ; (keep carry)
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
379 addwfc TBLPTRH,F ; Propagate to 16bit (but not 24bits).
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
380
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
381 tblrd*+
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
382 movff TABLAT,lo ; Low byte --> lo
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
383 tblrd*+
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
384 movff TABLAT,hi ; High byte --> hi
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
385 btfss hi,7 ; 15bit ?
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
386 clrf hi ; NO: clear extra type flags
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
387 bcf hi,7 ; clear 15bit flag
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
388
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
389 movff TABLAT,cf_type ; type (high byte) --> cf_type
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
390 movlw CF_MILI
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
391 btfsc cf_type,7 ; Display all 15bits as 1.234 floats.
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
392 movwf cf_type
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
393
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
394 tblrd*+
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
395 movff TABLAT,cf_min ; Then get optional min/max
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
396 tblrd*+
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
397 movff TABLAT,cf_max
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
398
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
399 return
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
400
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
401 ;-----------------------------------------------------------------------------
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
402 ; Display a 8/15bit value, plus optional min and max bound.
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
403 ; Input : hi:lo = data to display.
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
404 ; cf_type = the type.
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
405 ; cf_min, cf_max : the optional min/max.
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
406 ; FSR2 = current string pointer.
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
407 ; Trash : hi:lo (when displaying min/max)
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
408
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
409 display_customfunction:
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
410 movff EEADRH, FSR1H ; Backup...
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
411
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
412 rcall display_formated
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
413 rcall cf_fill_line
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
414 call word_processor
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
415
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
416 movff FSR1H, EEADRH
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
417 return
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
418
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
419 ;-----------------------------------------------------------------------------
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
420 ; Display optional min/max values.
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
421 ; Inputs: cf_value, cf_min, cf_max (and cf_type to display min/max).
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
422 ; Trashed: hi:lo while display min and max values.
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
423 display_minmax:
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
424 movff EEADRH, FSR1H ; Backup...
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
425
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
426 ; Display min line
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
427 WIN_TOP .65
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
428 WIN_LEFT .100
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
429 lfsr FSR2, letter
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
430
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
431 btfss cf_type, CF_MIN_BIT ; A min value exists ?
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
432 bra cf_no_min
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
433
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
434 movf cf_min,W ; Retrieve current 8b value
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
435 subwf cf_value,W ; Compute (lo-min)
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
436 bc cf_min_passed ; Ok if CARRY, ie. min >= lo
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
437 call PLED_warnings_color
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
438 WIN_INVERT 1
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
439 cf_min_passed:
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
440
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
441 movlw '>' ; A min value follows
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
442 movwf POSTINC2
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
443 movlw ' '
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
444 movwf POSTINC2
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
445 movff cf_min, lo
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
446 rcall display_formated
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
447
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
448 cf_no_min:
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
449 rcall cf_fill_line ; Fill buffer
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
450 lfsr FSR2, letter+.7 ; Limit to 8 chars btw.
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
451 call word_processor
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
452
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
453 ; Display max line
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
454 WIN_TOP .95
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
455 call PLED_standard_color
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
456 WIN_INVERT 0
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
457 lfsr FSR2, letter
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
458
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
459 btfss cf_type, CF_MAX_BIT ; A max value exists ?
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
460 bra cf_no_max
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
461
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
462 movf cf_value,W ; Retrieve current max bound
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
463 subwf cf_max,W ; Compute (max-lo)
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
464 bc cf_max_passed ; Ok if no carry, ie. max <= lo
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
465 call PLED_warnings_color
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
466 WIN_INVERT 1
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
467 cf_max_passed:
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
468
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
469 movlw '<' ; A max value follows
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
470 movwf POSTINC2
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
471 movlw ' '
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
472 movwf POSTINC2
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
473 movff cf_max, lo
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
474 rcall display_formated
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
475
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
476 cf_no_max:
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
477 rcall cf_fill_line ; Fill buffer
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
478 lfsr FSR2, letter+.7 ; Limit to 8 chars btw.
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
479 call word_processor
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
480
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
481 cf_minmax_done:
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
482 call PLED_standard_color
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
483 WIN_INVERT 0
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
484 movff FSR1H, EEADRH
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
485 return
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
486
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
487 ;-----------------------------------------------------------------------------
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
488 ; Display a single 8/15 bit value, according to cf_type.
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
489 ; Input : hi:lo = data to display.
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
490 ; cf_type = the type.
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
491 ; cf_min, cf_max : the optional min/max.
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
492 ; FSR2 = current string pointer.
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
493 display_formated:
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
494
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
495 ;---- decode type --------------------------------------------------------
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
496 movf cf_type,W ; Just set N/Z flags
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
497 bn cf_type_neg ; Keep 15bits value in old format.
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
498 andlw CF_TYPES ; Look just at types
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
499 bz cf_type_00 ; 8bit standard mode
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
500
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
501 ; Jump table: ; test the value with cleared flags...
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
502 dcfsnz WREG
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
503 bra cf_type_01
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
504 dcfsnz WREG
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
505 bra cf_type_02
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
506 dcfsnz WREG
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
507 bra cf_type_03
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
508 dcfsnz WREG
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
509 bra cf_type_04
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
510 dcfsnz WREG
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
511 bra cf_type_05
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
512 dcfsnz WREG
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
513 bra cf_type_06
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
514 dcfsnz WREG
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
515 bra cf_type_07
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
516 bra cf_type_00 ; Default to 8bit mode...
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
517
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
518 cf_type_01: ; Type == 1 is CF_PERCENT mode
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
519 bcf leftbind
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
520 output_8
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
521 movlw '%'
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
522 movwf POSTINC2
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
523 retlw 0
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
524
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
525 cf_type_02: ; Type == 2 is CF_DECI mode.
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
526 clrf hi
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
527 bsf leftbind
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
528 output_16dp 4
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
529 retlw 0
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
530
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
531 cf_type_03: ; Type == 3 is CF_CENTI mode.
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
532 clrf hi
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
533 bsf leftbind
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
534 output_16dp 3
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
535 retlw 0
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
536
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
537 cf_type_04: ; Type == 4 is CF_MILI mode
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
538 output_16dp 2
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
539 retlw 0
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
540
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
541 cf_type_05: ; Type == 5 is CF_BOOL mode.
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
542 movf lo,W ; Get flag value...
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
543 bz cf_type_off
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
544 OUTPUTTEXT d'130' ; ON
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
545 retlw 0
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
546
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
547 cf_type_off:
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
548 OUTPUTTEXT d'131' ; OFF
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
549 retlw 0
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
550
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
551 cf_type_06: ; Type == 6 is CF_SECS mode (mm:ss or hh:mm)
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
552 clrf hi
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
553 call convert_time ; Convert to min:sec into hi:low.
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
554 movff lo,wp_temp ; Save seconds,
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
555 movff hi,lo ; Get minutes
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
556 bsf leftbind ; Skip leading space(s).
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
557 output_8 ; Print them
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
558 movlw ':' ; Separator
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
559 movwf POSTINC2
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
560 movff wp_temp,lo ; Get back seconds
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
561 output_99x ; lo in 2 digits with trailing zeros.
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
562 retlw 0
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
563
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
564 cf_type_07: ; Type == 7 is CF_COLOR swatch.
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
565 bcf leftbind ; Keep leading space (better alignement)
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
566 output_8
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
567 movlw ' '
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
568 movwf POSTINC2
84
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
569 call word_processor
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
570
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
571 movf lo,W ; Get color.
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
572 movff WREG,box_temp+0 ; Set color
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
573 movff win_top,WREG ; BEWARE : this is a bank0 variable !
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
574 movff WREG,box_temp+1 ; row top (0-239)
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
575 addlw .23
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
576 movff WREG,box_temp+2 ; row bottom (0-239)
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
577 movlw .110
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
578 movff WREG,box_temp+3 ; column left (0-159)
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
579 movlw .148
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
580 movff WREG,box_temp+4 ; column right (0-159)
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
581
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
582 call PLED_box
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
583 retlw -1 ; wp already done. Skip it...
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
584
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
585 cf_type_00: ; 8bit mode. Or unrecognized type...
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
586 clrf hi
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
587 bsf leftbind
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
588
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
589 cf_type_neg: ; 15bit mode.
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
590 bcf hi,7
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
591 output_16
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
592 retlw 0
84
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
593
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
594 ;-----------------------------------------------------------------------------
84
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
595
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
596 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
597 movf FSR2L,W ; How many chars lefts ?
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
598 sublw (LOW letter) + .18 ; Remaining chars to fill: (letter + 18) - PTR
84
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
599 btfsc STATUS,N ; Add chars until none left...
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
600 return
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
601 movlw ' '
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
602 movwf POSTINC2
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
603 bra cf_fill_line
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
604
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
605 ;-----------------------------------------------------------------------------
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
606
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
607 do_customfunction:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
608 CLRF EEADRH
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
609 movlw d'1'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
610 btfsc customfunction_page
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
611 movwf EEADRH ; Reset EEADRH correct (Was adjusted in check_timeout...)
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
612
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
613 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
614 bra next_customfunction
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
615 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
616 bra toggle_plusminus
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
617 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
618 bra toggle_oneorten
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
619 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
620 bra restore_cfn_value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
621 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
622 bra adjust_cfn_value
84
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
623
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
624 ;-----------------------------------------------------------------------------
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
625
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
626 exit_customfunctions:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
627 movlw d'2' ; Return to correct list entry
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
628 btfss customfunction_page
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
629 movlw d'1'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
630 movwf menupos ;
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
631 clrf EEADRH ; Clear EEADRH !
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
632 goto setup_menu2 ; exit...
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
633
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
634 ;-----------------------------------------------------------------------------
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
635
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
636 next_customfunction:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
637 incf decodata+0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
638 btfsc decodata+0,5 ;>31?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
639 clrf decodata+0 ;Yes, so reset to zero
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
640
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
641 movf decodata+0,W
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
642 mullw d'4'
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
643 movff PRODL, cf32_x4 ; 12bit address for correct addressing
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
644
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
645 movlw d'1'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
646 movwf menupos
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
647 bra menu_custom_functions1 ; also debounces switches
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
648
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
649 ;-----------------------------------------------------------------------------
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
650
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
651 toggle_plusminus:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
652 btg first_FA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
653 movlw d'2'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
654 movwf menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
655 bra menu_custom_functions1 ; also debounces switches
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
656
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
657 ;-----------------------------------------------------------------------------
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
658
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
659 toggle_oneorten:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
660 btg second_FA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
661 movlw d'3'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
662 movwf menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
663 bra menu_custom_functions1 ; also debounces switches
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
664
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
665 ;-----------------------------------------------------------------------------
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
666
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
667 restore_cfn_value:
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
668 rcall cf_read_default ; hi:lo is trashed by min/max display.
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
669
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
670 movf cf32_x4,W ; store default value
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
671 addlw 0x82
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
672 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
673 movff lo,EEDATA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
674 call write_eeprom ; Lowbyte
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
675 movf cf32_x4,W
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
676 addlw 0x83
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
677 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
678 movff hi,EEDATA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
679 call write_eeprom ; Highbyte
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
680
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
681 movlw d'4'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
682 movwf menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
683 bra menu_custom_functions1 ; also debounces switches
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
684
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
685 ;-----------------------------------------------------------------------------
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
686 ; Adjust current value.
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
687 adjust_cfn_value:
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
688 movf cf32_x4,W ; get current value
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
689 addlw 0x82
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
690 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
691 call read_eeprom ; Lowbyte
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
692 movff EEDATA,lo
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
693 movf cf32_x4,W
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
694 addlw 0x83
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
695 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
696 call read_eeprom ; Highbyte
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
697 movff EEDATA,hi
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
698
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
699 movf cf_type,W
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
700 xorlw CF_BOOL
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
701 bnz adjust_cfn_value1
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
702
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
703 btg lo,0 ; Change lower bit.
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
704 bra adjust_cfn_value3 ; Store result
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
705
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
706 adjust_cfn_value1:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
707 movlw d'1'
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
708 btfsc second_FA ; -10?
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
709 movlw d'10'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
710
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
711 btfss first_FA ; Minus?
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
712 bra adjust_cfn_value2 ; No, Plus
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
713
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
714 subwf lo,F ; substract value
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
715 movlw d'0'
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
716 btfsc cf_type,7 ; 8Bit value
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
717 subwfb hi,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
718
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
719 movlw b'01111111'
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
720 btfsc hi,7 ; >32768?
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
721 movwf hi
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
722
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
723 bra adjust_cfn_value3
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
724
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
725 adjust_cfn_value2:
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
726 addwf lo,F ; add value
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
727 movlw d'0'
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
728 btfsc cf_type,7 ; 8Bit value?
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
729 addwfc hi,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
730
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
731 btfsc hi,7 ; >32768?
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
732 clrf hi
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
733
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
734 adjust_cfn_value3:
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
735 movf cf32_x4,W ; Store current value
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
736 addlw 0x82
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
737 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
738 movff lo,EEDATA
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
739 call write_eeprom ; Lowbyte
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
740 movf cf32_x4,W
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
741 addlw 0x83
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
742 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
743 movff hi,EEDATA
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
744 call write_eeprom ; Highbyte
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
745 movlw d'5'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
746 movwf menupos
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
747 bra menu_custom_functions1 ; also debounces switches