annotate code_part1/OSTC_code_asm_part1/menu_custom.asm @ 335:d36fe3651d56 ScreenDump

Updated to 1.91beta Added screen dumps in cf menu, and in GasList (second page). --> Need a centralized subroutine when waitting switches...
author JeanDo
date Fri, 13 May 2011 02:09:06 +0200
parents 2f21f7a77608
children 6bdf80d7276c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1 ; OSTC - diving computer code
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
2 ; Copyright (C) 2008 HeinrichsWeikamp GbR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
3
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
4 ; This program is free software: you can redistribute it and/or modify
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
5 ; it under the terms of the GNU General Public License as published by
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
6 ; the Free Software Foundation, either version 3 of the License, or
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
7 ; (at your option) any later version.
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
8
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
9 ; This program is distributed in the hope that it will be useful,
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
10 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
11 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
12 ; GNU General Public License for more details.
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
13
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
14 ; You should have received a copy of the GNU General Public License
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
15 ; along with this program. If not, see <http://www.gnu.org/licenses/>.
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
16
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
17
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
18 ; Menu "Custom Functions", Custom Functions checker (Displays permanent warning if critical custom functions are altered)
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
19 ; written by: Matthias Heinrichs, info@heinrichsweikamp.com
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
20 ; written: 05/10/30
97
dc349e4264bb Cleanup CF for bad 15bits value display
JeanDo
parents: 94
diff changeset
21 ; last updated: 2010/12/11
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
22 ; known bugs:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
23 ; ToDo:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
24
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
25 ;First Bank of Custom Functions:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
26 ; The custom functions are stored in the internal EEPROM after 0x80
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
27 ; any custom function occupies 4 byte:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
28 ; 2 byte (low:high) store the default value, reset from menu "reset"
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
29 ; if bit16=1 then the custrom function is 15bit value, if not it's a 8bit value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
30 ; 2 byte (low:high) store the actual value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
31 ; defaults for custom functions are in menu "reset"
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
32 ; get values with GETCUSTOM8 .x with x=0...32 for 8 Bit values (stored in WREG)
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
33 ; or with GETCUSTOM15 .x with x=0...32 for 15 Bit values (stored in lo and hi)
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
34
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
35 ;Second Bank of Custom Functions:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
36 ; The custom functions are stored in the internal EEPROM after 0x180
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
37 ; any custom function occupies 4 byte:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
38 ; 2 byte (low:high) store the default value, reset from menu "reset"
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
39 ; if bit16=1 then the custrom function is 15bit value, if not it's a 8bit value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
40 ; 2 byte (low:high) store the actual value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
41 ; defaults for custom functions are in menu "reset"
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
42 ; get values with GETCUSTOM8 .x with x=0...32 for 8 Bit values (stored in WREG)
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
43 ; or with GETCUSTOM15 .x with x=0...32 for 15 Bit values (stored in lo and hi)
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
44
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
45 ; [jDG] 2010-11-30 More fancy displsy of the various CF types
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
46 ; data types. When we do have a 8bit data (bit16=0), the high byte serves to
97
dc349e4264bb Cleanup CF for bad 15bits value display
JeanDo
parents: 94
diff changeset
47 ; define the display format. Also stores min/max bounds into the PROM table.
dc349e4264bb Cleanup CF for bad 15bits value display
JeanDo
parents: 94
diff changeset
48 ; And provides surfacemode checking of all parameters.
79
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...
164
999abb01c78f + Change data allocation scheme
JeanDo
parents: 123
diff changeset
69 #define cf32_x4 divemins+0 ; CF# modulus 32, time 4.
999abb01c78f + Change data allocation scheme
JeanDo
parents: 123
diff changeset
70 #define cf_type divemins+1 ; Type of the edited CF
999abb01c78f + Change data allocation scheme
JeanDo
parents: 123
diff changeset
71 #define cf_value divesecs
999abb01c78f + Change data allocation scheme
JeanDo
parents: 123
diff changeset
72 #define cf_min apnoe_mins
999abb01c78f + Change data allocation scheme
JeanDo
parents: 123
diff changeset
73 #define cf_max apnoe_secs
86
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
167
cb055a7d75f3 + Use overlay local vars.
JeanDo
parents: 164
diff changeset
107 GETCUSTOM15 macro number
cb055a7d75f3 + Use overlay local vars.
JeanDo
parents: 164
diff changeset
108 movlw number
cb055a7d75f3 + Use overlay local vars.
JeanDo
parents: 164
diff changeset
109 call getcustom15
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
110 endm
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
111
167
cb055a7d75f3 + Use overlay local vars.
JeanDo
parents: 164
diff changeset
112 global getcustom15
cb055a7d75f3 + Use overlay local vars.
JeanDo
parents: 164
diff changeset
113 getcustom15:
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
114 ; # number of requested custom function in wreg
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
115 movwf customfunction_temp2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
116
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
117 movlw d'31'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
118 cpfsgt customfunction_temp2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
119 bra getcustom15_2 ; Lower bank
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
120
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
121 movlw d'1' ; Upper Bank
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
122 movwf EEADRH
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
123 movlw d'32'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
124 subwf customfunction_temp2,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
125 bra getcustom15_3
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
126 getcustom15_2:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
127 clrf EEADRH
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
128 getcustom15_3:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
129 movf customfunction_temp2,W
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
130 mullw d'4'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
131 movf PRODL,W ; x4 for adress
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
132 addlw d'130'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
133 movwf EEADR ; +130 for LOW Byte of value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
134 call read_eeprom ; Lowbyte
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
135 movff EEDATA,lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
136 incf EEADR,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
137 call read_eeprom ; Highbyte
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
138 movff EEDATA,hi
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
139 clrf EEADRH
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
140 return ; return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
141
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
142 menu_custom_functions_page2:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
143 movlw d'154' ; start of custom function descriptors
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
144 movwf customfunction_temp1
7
5c4ba624165d cf32 bug fixed
heinrichsweikamp
parents: 0
diff changeset
145 bsf customfunction_page ; Use Page II...
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
146 bra menu_custom_functions0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
147
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
148 menu_custom_functions:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
149 movlw d'36' ; start of custom function descriptors
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
150 movwf customfunction_temp1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
151 bcf customfunction_page ; Use Page I...
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
152
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
153 menu_custom_functions0:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
154 bsf leftbind
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
155 call PLED_ClearScreen
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
156 movlw d'1'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
157 movwf menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
158
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
159 bcf menubit4
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
160 bcf cursor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
161 bcf sleepmode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
162 clrf decodata+0 ; here: # of CustomFunction
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
163 clrf cf32_x4 ; here: # of CustomFunction*4
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
164 bcf first_FA ; here: =1: -, =0: +
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
165 bcf second_FA ; here: =1: stepsize 1, =0: stepsize 10
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
166
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
167 call PLED_topline_box
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
168 WIN_INVERT .1 ; Init new Wordprocessor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
169
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
170 btfss customfunction_page ;
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
171 bra menu_custom_functions10
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
172 DISPLAYTEXT .186 ; Custom FunctionsII
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
173 bra menu_custom_functions11
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
174
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
175 menu_custom_functions10:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
176 DISPLAYTEXT .27 ; Custom FunctionsI
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
177
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
178 menu_custom_functions11:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
179 WIN_INVERT .0 ; Init new Wordprocessor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
180
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
181 menu_custom_functions1:
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 100
diff changeset
182 call PLED_standard_color ; Trash EEADRH...
29
c6cab044a338 1.61beta rc2
heinrichsweikamp
parents: 27
diff changeset
183
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 100
diff changeset
184 movlw d'1' ; So restore it !
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 100
diff changeset
185 btfss customfunction_page ; Use Page II ?
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 100
diff changeset
186 movlw d'0' ; NO: this is page 1.
7
5c4ba624165d cf32 bug fixed
heinrichsweikamp
parents: 0
diff changeset
187 movwf EEADRH
5c4ba624165d cf32 bug fixed
heinrichsweikamp
parents: 0
diff changeset
188
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
189 clrf timeout_counter2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
190 bcf menubit2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
191 bcf menubit3
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
192 WIN_LEFT .20
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
193 WIN_TOP .35
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
194 lfsr FSR2,letter
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
195 movff decodata+0,lo ; decodata == CF number % 32
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
196
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
197 movlw d'0'
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
198 btfsc customfunction_page ; Add offset for display in CF menu II
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
199 movlw d'32'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
200 addwf lo,F
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
201
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
202 output_99x
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 100
diff changeset
203 STRCAT_PRINT ": "
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
204
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
205 movf customfunction_temp1,W ; start of custom function descriptors
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
206 addwf decodata+0,W ; add # of current custom function, place result in wreg
174
53b16a746166 Multi-lang
JeanDo
parents: 167
diff changeset
207 call displaytext_1_low ; shows descriptor
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
208
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
209 ; Read default, type and min/max from reset table.
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
210 rcall cf_read_default
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
211
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
212 movf cf_type,W ; Is it a ON/OFF flag ?
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
213 xorlw CF_BOOL
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
214 bnz menu_custom_functions10a ; Not a binary CF selected
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
215
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
216 menu_custom_functions10c:
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
217 ; Erase unused lines when editing boolean...
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
218 WIN_LEFT .20
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
219 WIN_TOP .65
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
220 lfsr FSR2,letter ; Make a string of 8 spaces
84
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
221 call cf_fill_line
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
222 call word_processor ; Clear +/- line
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
223
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
224 WIN_TOP .95
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
225 call word_processor ; Clear 1/10 line
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
226
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
227 bra menu_custom_functions10b
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
228
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
229 menu_custom_functions10a:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
230 WIN_LEFT .20
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
231 WIN_TOP .65
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 100
diff changeset
232 STRCPY "+/-: "
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
233 movlw '+'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
234 btfsc first_FA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
235 movlw '-'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
236 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
237 call word_processor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
238
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
239 WIN_TOP .95
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 100
diff changeset
240 STRCPY "1/10: 1"
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
241 movlw '0'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
242 btfsc second_FA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
243 movwf POSTINC2
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 100
diff changeset
244 STRCAT_PRINT " "
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
245
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
246 menu_custom_functions10b:
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
247 WIN_LEFT .20
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
248 WIN_TOP .125
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
249 lfsr FSR2,letter
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
250 OUTPUTTEXT d'89' ;"Default:"
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
251
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
252 call display_customfunction ; Typed display.
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
253
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
254 WIN_LEFT .20
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
255 WIN_TOP .155
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
256 lfsr FSR2,letter
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
257 OUTPUTTEXT d'97' ; "Current:"
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
258
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
259 movf cf32_x4,W
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
260 addlw 0x82
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
261 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
262 call read_eeprom ; Lowbyte
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
263 movff EEDATA,lo
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
264 movff EEDATA, cf_value ; Backup low 8bit value.
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
265
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
266 movf cf32_x4,W
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
267 addlw 0x83
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
268 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
269 call read_eeprom ; Highbyte
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
270 movff EEDATA,hi
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
271
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 100
diff changeset
272 call PLED_standard_color ; Changed by color swatches, but trash EEADRH...
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
273 call display_customfunction
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
274
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
275 ; End of mask: min/max and the exit line...
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
276 rcall display_minmax
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
277 DISPLAYTEXT .11 ; Exit
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
278
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
279 call wait_switches ; Waits until switches are released, resets flag if button stays pressed!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
280 call PLED_menu_cursor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
281
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
282 customfunctions_loop:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
283 call check_switches_logbook
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
284
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
285 btfsc menubit3
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
286 bra customfunctions2 ; Move cursor or generate next page
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
287
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
288 btfsc menubit2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
289 bra do_customfunction ; call subfunction
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
290
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
291 btfsc divemode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
292 goto restart ; dive started during cf menu
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
293
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
294 btfsc onesecupdate
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
295 call timeout_surfmode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
296
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
297 btfsc onesecupdate
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
298 call set_dive_modes
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
299
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
300 bcf onesecupdate ; end of 1sek. tasks
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
301
335
d36fe3651d56 Updated to 1.91beta
JeanDo
parents: 309
diff changeset
302 btfsc uart_dump_screen ; Dumps screen contains ?
d36fe3651d56 Updated to 1.91beta
JeanDo
parents: 309
diff changeset
303 call dump_screen ; Yes!
d36fe3651d56 Updated to 1.91beta
JeanDo
parents: 309
diff changeset
304
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
305 btfsc sleepmode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
306 bra exit_customfunctions
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
307
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
308 bra customfunctions_loop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
309
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
310 customfunctions2:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
311 incf menupos,F
90
6655b1c59adc FIX new cf menu BOOL mode: should skip lines 2&3.
JeanDo
parents: 86
diff changeset
312 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
313 xorlw CF_BOOL
6655b1c59adc FIX new cf menu BOOL mode: should skip lines 2&3.
JeanDo
parents: 86
diff changeset
314 bnz customfunctions2a ; NO : don't skip lines 2/3.
84
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
315
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
316 movlw d'4' ; Just after increment,
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
317 cpfsgt menupos ; Is current position < 4 ?
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
318 movwf menupos ; NO: skip set to 4.
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
319
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
320 customfunctions2a:
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
321 movlw d'7'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
322 cpfseq menupos ; =7?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
323 bra customfunctions3 ; No
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
324 movlw d'1'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
325 movwf menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
326
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
327 customfunctions3:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
328 clrf timeout_counter2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
329 call PLED_menu_cursor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
330
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
331 call wait_switches ; Waits until switches are released, resets flag if button stays pressed!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
332
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
333 bcf menubit3 ; clear flag
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
334 bra customfunctions_loop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
335
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
336 ;-----------------------------------------------------------------------------
94
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
337 ; Read default value, type, and constraints
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
338 ;
94
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
339 ; Input: customfunction_page, cf32_x4
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
340 ; Output: hi:lo, cf_type, cf_min, cf_max.
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
341 ; Trashes: TBLPTR
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
342
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
343 cf_read_default:
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
344 movlw LOW(cf_default_table0) ; Get 24bit PROM pointer. SKIP
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
345 movwf TBLPTRL
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
346 movlw HIGH(cf_default_table0)
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
347 movwf TBLPTRH
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
348 movlw UPPER(cf_default_table0)
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
349 movwf TBLPTRU
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
350
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
351 movlw 0
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
352 btfsc customfunction_page ; Page II CF# ?
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
353 movlw 0x80 ; YES: add 128 to ptr.
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
354 addwf cf32_x4,W ; Add 4 x (CF index modulus 32)
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
355 addwf TBLPTRL,F ; And to a 8+16 add into TBLPTR
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
356 movlw 0 ; (keep carry)
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
357 addwfc TBLPTRH,F ; Propagate to 16bit (but not 24bits).
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
358
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
359 tblrd*+
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
360 movff TABLAT,lo ; Low byte --> lo
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
361 tblrd*+
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
362 movff TABLAT,hi ; High byte --> hi
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
363 btfss hi,7 ; 15bit ?
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
364 clrf hi ; NO: clear extra type flags
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
365 bcf hi,7 ; clear 15bit flag
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
366
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
367 movff TABLAT,cf_type ; type (high byte) --> cf_type
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
368
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
369 tblrd*+
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
370 movff TABLAT,cf_min ; Then get optional min/max
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
371 tblrd*+
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
372 movff TABLAT,cf_max
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
373
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
374 return
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
375
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
376 ;-----------------------------------------------------------------------------
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
377 ; Display a 8/15bit value, plus optional min and max bound.
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
378 ; Input : hi:lo = data to display.
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
379 ; cf_type = the type.
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
380 ; cf_min, cf_max : the optional min/max.
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
381 ; FSR2 = current string pointer.
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
382 ; Trash : hi:lo (when displaying min/max)
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
383
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
384 display_customfunction:
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
385 movff EEADRH, FSR1H ; Backup...
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
386
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
387 rcall display_formated
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 100
diff changeset
388 incf WREG ; Color swatch drawn ?
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 100
diff changeset
389 bz display_customfunction_1 ; YES: skip line fill...
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 100
diff changeset
390
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
391 rcall cf_fill_line
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
392 call word_processor
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
393
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 100
diff changeset
394 display_customfunction_1:
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
395 movff FSR1H, EEADRH
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
396 return
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
397
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 ; Display optional min/max values.
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
400 ; 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
401 ; Trashed: hi:lo while display min and max values.
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
402 display_minmax:
99
39d325b2a5f9 FIX bad warning for 15bits CF values
JeanDo
parents: 97
diff changeset
403 ; Min/max unsupported for 15bit values yet...
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
404 movff EEADRH, FSR1H ; Backup...
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
405
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
406 ; Display min line
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
407 WIN_TOP .65
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
408 WIN_LEFT .100
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
409 lfsr FSR2, letter
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
410
100
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
411 btfsc cf_type,7 ; A 15bit value ?
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
412 bra cf_no_min ; Don't display, hence clear line...
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
413
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
414 btfss cf_type, CF_MIN_BIT ; A min value exists ?
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
415 bra cf_no_min
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
416
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
417 movf cf_min,W ; Retrieve current 8b value
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
418 subwf cf_value,W ; Compute (lo-min)
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
419 bc cf_min_passed ; Ok if CARRY, ie. min >= lo
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
420 call PLED_warnings_color
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
421 WIN_INVERT 1
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
422 cf_min_passed:
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
423
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 100
diff changeset
424 STRCAT "> " ; A min value follows
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
425 movff cf_min, lo
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
426 rcall display_formated
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
427
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
428 cf_no_min:
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
429 rcall cf_fill_line ; Fill buffer
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
430 lfsr FSR2, letter+.7 ; Limit to 8 chars btw.
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
431 call word_processor
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
432
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
433 ; Display max line
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
434 WIN_TOP .95
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
435 call PLED_standard_color
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
436 WIN_INVERT 0
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
437 lfsr FSR2, letter
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
438
100
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
439 btfsc cf_type,7 ; A 15bit value ?
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
440 bra cf_no_max ; Don't display, hence clear line too...
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
441
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
442 btfss cf_type, CF_MAX_BIT ; A max value exists ?
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
443 bra cf_no_max
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
444
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
445 movf cf_value,W ; Retrieve current max bound
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
446 subwf cf_max,W ; Compute (max-lo)
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
447 bc cf_max_passed ; Ok if no carry, ie. max <= lo
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
448 call PLED_warnings_color
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
449 WIN_INVERT 1
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
450 cf_max_passed:
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
451
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 100
diff changeset
452 STRCAT "< " ; A max value follows
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
453 movff cf_max, lo
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
454 rcall display_formated
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
455
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
456 cf_no_max:
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
457 rcall cf_fill_line ; Fill buffer
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
458 lfsr FSR2, letter+.7 ; Limit to 8 chars btw.
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
459 call word_processor
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
460
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
461 cf_minmax_done:
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
462 call PLED_standard_color
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
463 WIN_INVERT 0
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
464 movff FSR1H, EEADRH
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
465 return
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
466
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
467 ;-----------------------------------------------------------------------------
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
468 ; Display a single 8/15 bit value, according to cf_type.
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
469 ; Input : hi:lo = data to display.
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
470 ; cf_type = the type.
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
471 ; cf_min, cf_max : the optional min/max.
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
472 ; FSR2 = current string pointer.
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
473 display_formated:
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
474
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
475 ;---- decode type --------------------------------------------------------
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
476 movf cf_type,W ; Just set N/Z flags
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
477 bn cf_type_neg ; Keep 15bits value in old format.
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
478 andlw CF_TYPES ; Look just at types
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
479 bz cf_type_00 ; 8bit standard mode
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
480
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
481 ; Jump table: ; test the value with cleared flags...
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
482 dcfsnz WREG
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
483 bra cf_type_01
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
484 dcfsnz WREG
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
485 bra cf_type_02
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
486 dcfsnz WREG
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
487 bra cf_type_03
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
488 dcfsnz WREG
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
489 bra cf_type_04
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
490 dcfsnz WREG
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
491 bra cf_type_05
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
492 dcfsnz WREG
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
493 bra cf_type_06
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
494 dcfsnz WREG
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
495 bra cf_type_07
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
496 bra cf_type_00 ; Default to 8bit mode...
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
497
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
498 cf_type_01: ; Type == 1 is CF_PERCENT mode
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
499 bcf leftbind
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
500 output_8
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 100
diff changeset
501 PUTC '%'
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
502 retlw 0
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
503
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
504 cf_type_02: ; Type == 2 is CF_DECI mode.
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
505 clrf hi
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
506 bsf leftbind
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
507 output_16dp 4
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
508 retlw 0
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
509
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
510 cf_type_03: ; Type == 3 is CF_CENTI mode.
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
511 clrf hi
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
512 bsf leftbind
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
513 output_16dp 3
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
514 retlw 0
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
515
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
516 cf_type_04: ; Type == 4 is CF_MILI mode
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
517 output_16dp 2
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
518 retlw 0
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
519
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
520 cf_type_05: ; Type == 5 is CF_BOOL mode.
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
521 movf lo,W ; Get flag value...
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
522 bz cf_type_off
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
523 OUTPUTTEXT d'130' ; ON
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
524 retlw 0
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
525
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
526 cf_type_off:
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
527 OUTPUTTEXT d'131' ; OFF
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
528 retlw 0
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
529
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
530 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
531 clrf hi
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
532 call convert_time ; Convert to min:sec into hi:low.
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 100
diff changeset
533 movff lo,TABLAT ; Save seconds for later.
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
534 movff hi,lo ; Get minutes
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
535 bsf leftbind ; Skip leading space(s).
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
536 output_8 ; Print them
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 100
diff changeset
537 PUTC ':' ; Separator
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 100
diff changeset
538 movff TABLAT,lo ; Get back seconds
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
539 output_99x ; lo in 2 digits with trailing zeros.
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
540 retlw 0
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
541
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
542 cf_type_07: ; Type == 7 is CF_COLOR swatch.
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
543 bcf leftbind ; Keep leading space (better alignement)
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
544 output_8
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 100
diff changeset
545 STRCAT_PRINT " "
84
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
546
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
547 movf lo,W ; Get color.
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 100
diff changeset
548 call PLED_set_color
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 100
diff changeset
549 movlw .23
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 100
diff changeset
550 movff WREG,win_height ; row bottom (0-239)
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
551 movlw .110
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 100
diff changeset
552 movff WREG,win_leftx2 ; column left (0-159)
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 100
diff changeset
553 movlw .148-.110+1
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 100
diff changeset
554 movff WREG,win_width ; column right (0-159)
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
555
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
556 call PLED_box
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
557 retlw -1 ; wp already done. Skip it...
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
558
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
559 cf_type_00: ; 8bit mode. Or unrecognized type...
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
560 clrf hi
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
561 bsf leftbind
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
562
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
563 cf_type_neg: ; 15bit mode.
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
564 bcf hi,7
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
565 output_16
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
566 retlw 0
84
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
567
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
568 ;-----------------------------------------------------------------------------
84
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
569
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
570 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
571 movf FSR2L,W ; How many chars lefts ?
164
999abb01c78f + Change data allocation scheme
JeanDo
parents: 123
diff changeset
572 sublw letter + .18 ; Remaining chars to fill: (letter + 18) - PTR
84
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
573 btfsc STATUS,N ; Add chars until none left...
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
574 return
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 100
diff changeset
575 PUTC ' '
84
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
576 bra cf_fill_line
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
577
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
578 ;-----------------------------------------------------------------------------
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
579
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
580 do_customfunction:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
581 CLRF EEADRH
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
582 movlw d'1'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
583 btfsc customfunction_page
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
584 movwf EEADRH ; Reset EEADRH correct (Was adjusted in check_timeout...)
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
585
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
586 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
587 bra next_customfunction
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
588 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
589 bra toggle_plusminus
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
590 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
591 bra toggle_oneorten
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
592 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
593 bra restore_cfn_value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
594 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
595 bra adjust_cfn_value
84
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
596
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
597 ;-----------------------------------------------------------------------------
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
598
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
599 exit_customfunctions:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
600 movlw d'2' ; Return to correct list entry
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
601 btfss customfunction_page
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
602 movlw d'1'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
603 movwf menupos ;
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
604 clrf EEADRH ; Clear EEADRH !
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
605 goto setup_menu2 ; exit...
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
606
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
607 ;-----------------------------------------------------------------------------
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
608
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
609 next_customfunction:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
610 incf decodata+0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
611 btfsc decodata+0,5 ;>31?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
612 clrf decodata+0 ;Yes, so reset to zero
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
613
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
614 movf decodata+0,W
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
615 mullw d'4'
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
616 movff PRODL, cf32_x4 ; 12bit address for correct addressing
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
617
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
618 movlw d'1'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
619 movwf menupos
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
620 bra menu_custom_functions1 ; also debounces switches
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
621
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
622 ;-----------------------------------------------------------------------------
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
623
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
624 toggle_plusminus:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
625 btg first_FA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
626 movlw d'2'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
627 movwf menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
628 bra menu_custom_functions1 ; also debounces switches
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
629
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
630 ;-----------------------------------------------------------------------------
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
631
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
632 toggle_oneorten:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
633 btg second_FA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
634 movlw d'3'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
635 movwf menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
636 bra menu_custom_functions1 ; also debounces switches
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
637
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
638 ;-----------------------------------------------------------------------------
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
639
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
640 restore_cfn_value:
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
641 rcall cf_read_default ; hi:lo is trashed by min/max display.
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
642
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
643 movf cf32_x4,W ; store default value
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
644 addlw 0x82
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
645 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
646 movff lo,EEDATA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
647 call write_eeprom ; Lowbyte
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
648 movf cf32_x4,W
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
649 addlw 0x83
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
650 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
651 movff hi,EEDATA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
652 call write_eeprom ; Highbyte
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
653
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
654 movlw d'4'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
655 movwf menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
656 bra menu_custom_functions1 ; also debounces switches
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
657
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
658 ;-----------------------------------------------------------------------------
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
659 ; Adjust current value.
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
660 adjust_cfn_value:
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
661 movf cf32_x4,W ; get current value
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
662 addlw 0x82
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
663 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
664 call read_eeprom ; Lowbyte
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
665 movff EEDATA,lo
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
666 movf cf32_x4,W
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
667 addlw 0x83
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
668 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
669 call read_eeprom ; Highbyte
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
670 movff EEDATA,hi
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
671
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
672 movf cf_type,W
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
673 xorlw CF_BOOL
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
674 bnz adjust_cfn_value1
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
675
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
676 btg lo,0 ; Change lower bit.
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
677 bra adjust_cfn_value3 ; Store result
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
678
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
679 adjust_cfn_value1:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
680 movlw d'1'
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
681 btfsc second_FA ; -10?
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
682 movlw d'10'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
683
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
684 btfss first_FA ; Minus?
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
685 bra adjust_cfn_value2 ; No, Plus
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
686
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
687 subwf lo,F ; substract value
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
688 movlw d'0'
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
689 btfsc cf_type,7 ; 8Bit value
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
690 subwfb hi,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
691
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
692 movlw b'01111111'
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
693 btfsc hi,7 ; >32768?
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
694 movwf hi
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
695
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
696 bra adjust_cfn_value3
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
697
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
698 adjust_cfn_value2:
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
699 addwf lo,F ; add value
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
700 movlw d'0'
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
701 btfsc cf_type,7 ; 8Bit value?
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
702 addwfc hi,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
703
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
704 btfsc hi,7 ; >32768?
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
705 clrf hi
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
706
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
707 adjust_cfn_value3:
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
708 movf cf32_x4,W ; Store current value
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
709 addlw 0x82
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
710 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
711 movff lo,EEDATA
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
712 call write_eeprom ; Lowbyte
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
713 movf cf32_x4,W
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
714 addlw 0x83
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
715 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
716 movff hi,EEDATA
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
717 call write_eeprom ; Highbyte
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
718 movlw d'5'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
719 movwf menupos
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
720 bra menu_custom_functions1 ; also debounces switches
94
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
721
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
722 ;-----------------------------------------------------------------------------
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
723 ; Check all CF values that have max and min constraints.
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
724 ; Input: cf_checker_counter.
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
725 ; Output: Pop warning with the first CF number if bad.
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
726 ; cf_checker_counter incremented.
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
727 ; Trashes: TBLPTR, EEADR, PROD
100
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
728 ;
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
729 ; Note: the trick here is to do two sweep over the 64 CF values, to make sure
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
730 ; they are all ok.
94
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
731
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
732 check_customfunctions:
100
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
733 ; Did we finished the two sweeps ?
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
734 btfsc cf_checker_counter,7 ; Already at position 128 ?
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
735 return ; YES: just do nothing.
94
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
736
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
737 ; Setup cf32_x4 and cf page bit:
100
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
738 movf cf_checker_counter,W
94
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
739 rlcf WREG ; x4
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
740 rlcf WREG
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
741 bcf customfunction_page
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
742 btfsc WREG,7
100
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
743 bsf customfunction_page ; Setup CF page bit.
94
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
744 andlw 4*.31
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
745 movwf cf32_x4
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
746
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
747 ; Do the check
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
748 rcall check_one_cf
100
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
749 iorwf WREG ; Test return value.
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
750 bz check_failed ; 0 == FAILED.
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
751
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
752 ; Passed: Simple loop until 128 is reached:
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
753 incf cf_checker_counter ; Next CF to check.
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
754 bra check_customfunctions ; And loop until 128 reached (ie twice)
94
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
755
100
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
756 check_failed:
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
757 movlw .63 ; Make sure number is back to range 0..63
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
758 andwf cf_checker_counter,F
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
759
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
760 ; Went wrong: draw the warning line...
309
2f21f7a77608 moved cf warning to upper right corner
heinrichsweikamp
parents: 174
diff changeset
761 WIN_TOP .0
2f21f7a77608 moved cf warning to upper right corner
heinrichsweikamp
parents: 174
diff changeset
762 WIN_LEFT .125
100
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
763 WIN_FONT FT_SMALL
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
764 WIN_INVERT .1 ; Init new Wordprocessor
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
765 call PLED_warnings_color
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
766
309
2f21f7a77608 moved cf warning to upper right corner
heinrichsweikamp
parents: 174
diff changeset
767 STRCPY "CF"
100
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
768 movff cf_checker_counter,lo
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
769 output_99x
309
2f21f7a77608 moved cf warning to upper right corner
heinrichsweikamp
parents: 174
diff changeset
770 STRCAT_PRINT "!"
94
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
771
100
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
772 ; When failed, increment counter modulo 64, to restart checks.
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
773 incf cf_checker_counter,W
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
774 andlw .63 ; Modulo 64
94
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
775 movwf cf_checker_counter
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
776 return
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
777
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
778 ; Check one CF value ---------------------------------------------------------
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
779 check_one_cf:
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
780 rcall cf_read_default ; Sets hi:lo, cf_type, cf_min, cf_max.
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
781
100
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
782 btfsc cf_type,7 ; A 15bit type ?
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
783 bra check_cf_check ; Then we have to check it...
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
784
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
785 movf cf_type,W ; 8bit MIN or MAX set ?
94
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
786 andlw (CF_MIN + CF_MAX)
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
787 bnz check_cf_check ; yes: do something.
100
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
788 retlw -1 ; no: no problem then.
94
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
789
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
790 ; It does have bound:
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
791 check_cf_check:
100
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
792 movf cf_checker_counter,W ; Get current CF number
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
793 andlw .63 ; Keep range 0..63
94
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
794
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
795 btfss cf_type,7 ; 15 or 8 bit value ?
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
796 bra cf_check_8bit
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
797
99
39d325b2a5f9 FIX bad warning for 15bits CF values
JeanDo
parents: 97
diff changeset
798 ; Implement the 15bit check, even if not displayed...
167
cb055a7d75f3 + Use overlay local vars.
JeanDo
parents: 164
diff changeset
799 rcall getcustom15 ; Read into hi:lo
94
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
800
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
801 movf cf_min,W ; Compute (bound-value) -> hi:lo
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
802 subwf lo,F
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
803 movf cf_max,W
100
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
804 bcf WREG,7 ; Clear min/max bit
94
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
805 subwfb hi,F
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
806
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
807 movf lo,W ; Is it a 0 result ?
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
808 iorwf hi,W
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
809 bnz cf_15_not_equal ; NO: check sign.
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
810 retlw -1 ; YES: then it is ok.
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
811
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
812 cf_15_not_equal:
99
39d325b2a5f9 FIX bad warning for 15bits CF values
JeanDo
parents: 97
diff changeset
813 btfss cf_max,7 ; Checking min or max ?
94
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
814 btg hi,6 ; exchange wanted sign
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
815
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
816 btfss hi,6 ; Is sign correct ?
100
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
817 retlw 0 ; NO: return failed.
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
818 retlw -1 ; YES: return passed.
94
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
819
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
820 ; Do a 8bit check
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
821 cf_check_8bit:
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
822 rcall getcustom8_1 ; Read into WREG
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
823 movwf lo ; Save it.
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
824
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
825 btfss cf_type,CF_MIN_BIT
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
826 bra check_no_min
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
827
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
828 cpfsgt cf_min ; Compare to cf_min
100
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
829 bra check_no_min ; PASSED: continue.
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
830 retlw 0 ; NO: return failed.
94
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
831
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
832 check_no_min:
100
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
833 btfss cf_type,CF_MAX_BIT ; Is there a MAX bound ?
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
834 retlw -1 ; No check: return OK.
94
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
835
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
836 movf lo,W ; Compute value-max
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
837 cpfslt cf_max
100
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
838 retlw -1 ; Bound met: return OK.
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
839 retlw 0 ; NO: return failed.