annotate code_part1/OSTC_code_asm_part1/menu_custom.asm @ 574:101fec6a6137

New Custom Functions III menu (CF64-CF95)
author heinrichsweikamp
date Sat, 21 Apr 2012 13:58:30 +0200
parents 77c8ff191cd7
children ab2686087bce
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
573
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
20 ; written: 051030
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
21 ; last updated: 120421
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
573
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
45 ;Third Bank of Custom Functions:
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
46 ; The custom functions are stored in the internal EEPROM after 0x280
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
47 ; any custom function occupies 4 byte:
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
48 ; 2 byte (low:high) store the default value, reset from menu "reset"
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
49 ; if bit16=1 then the custrom function is 15bit value, if not it's a 8bit value
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
50 ; 2 byte (low:high) store the actual value
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
51 ; defaults for custom functions are in menu "reset"
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
52 ; get values with GETCUSTOM8 .x with x=0...32 for 8 Bit values (stored in WREG)
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
53 ; or with GETCUSTOM15 .x with x=0...32 for 15 Bit values (stored in lo and hi)
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
54
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
55 ; [jDG] 2010-11-30 More fancy displsy of the various CF types
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
56 ; 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
57 ; 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
58 ; And provides surfacemode checking of all parameters.
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
59
478
fd8266b511cc New SAC (CF56/CF57) in 5..50 l/min range (no more decimal).
JeanDo
parents: 445
diff changeset
60 CF_INT8 EQU 0 ; Default display, 8 or 15 bits values.
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
61 CF_PERCENT EQU 1 ; Displays 110%
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
62 CF_DECI EQU 2 ; Displays 1.6
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
63 CF_CENTI EQU 3 ; Displays 1.50
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
64 CF_MILI EQU 4 ; Displays 1.015
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
65 CF_BOOL EQU 5 ; Displays ON/OFF
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
66 CF_SEC EQU 6 ; Displays 4:00
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
67 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
68 ;
355
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
69 CF_TYPES EQU 0x0F
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
70 CF_MAX_BIT EQU 6 ; Default is the highest safe value.
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
71 CF_MAX EQU (1<<CF_MAX_BIT)
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
72 CF_MIN_BIT EQU 5 ; Default is the lowest safe value.
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
73 CF_MIN EQU (1<<CF_MIN_BIT)
355
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
74 CF_NEG_BIT EQU 4 ; Allow negativ values.
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
75 CF_NEG EQU (1<<CF_NEG_BIT)
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
76 ;
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
77 CF_INT15 EQU 0x80; Default display. Flag for 15bit, typeless values.
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
78
360
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
79 ;=============================================================================
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
80 ; Overlay our tmp data in ACCESS0 bank
573
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
81 CBLOCK tmp ; Into safe (from C library) area.
360
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
82 cf32_x4 ; CF# modulus 32, time 4.
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
83 cf_type ; Type of the edited CF
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
84 cf_default:2
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
85 cf_value:2
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
86 cf_min
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
87 cf_max
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
88 cf_step ; Value ad add/substract: 1, 10, 100
573
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
89 cf_page_number ; CF page number (0: 0-31, 1: 32-63)
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
90 cf_title_text ; # of text for title
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
91 cf_descriptor_text ; # of descriptor text offset
360
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
92 ENDC
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
93
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
94 ;=============================================================================
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
95
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
96 GETCUSTOM8 macro custom8
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
97 movlw custom8
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
98 call getcustom8_1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
99 endm
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
100
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
101 getcustom8_1:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
102 ; # number of requested custom function in wreg
573
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
103 movwf customfunction_temp1
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
104
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
105 clrf EEADRH
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
106 movlw d'31'
573
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
107 cpfsgt customfunction_temp1
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
108 bra getcustom8_3 ; bank 0
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
109
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
110 movlw d'1'
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
111 movwf EEADRH ; bank 1
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
112 movlw d'32'
573
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
113 subwf customfunction_temp1,F
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
114 movlw d'63'
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
115 cpfsgt customfunction_temp1
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
116 bra getcustom8_3 ; bank 1
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
117
573
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
118 movlw d'2'
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
119 movwf EEADRH ; bank 2
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
120 movlw d'64'
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
121 subwf customfunction_temp1,F
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
122 getcustom8_3:
573
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
123 movf customfunction_temp1,W
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
124 mullw d'4'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
125 movf PRODL,W ; x4 for adress
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
126 addlw d'130'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
127 movwf EEADR ; +130 for LOW Byte of value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
128 call read_eeprom ; Lowbyte
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
129 movf EEDATA,W ; copied into wreg
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
130 clrf EEADRH
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
131 return ; return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
132
167
cb055a7d75f3 + Use overlay local vars.
JeanDo
parents: 164
diff changeset
133 GETCUSTOM15 macro number
cb055a7d75f3 + Use overlay local vars.
JeanDo
parents: 164
diff changeset
134 movlw number
cb055a7d75f3 + Use overlay local vars.
JeanDo
parents: 164
diff changeset
135 call getcustom15
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
136 endm
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
137
167
cb055a7d75f3 + Use overlay local vars.
JeanDo
parents: 164
diff changeset
138 global getcustom15
cb055a7d75f3 + Use overlay local vars.
JeanDo
parents: 164
diff changeset
139 getcustom15:
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
140 ; # number of requested custom function in wreg
573
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
141 movwf customfunction_temp1
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
142
573
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
143 clrf EEADRH
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
144 movlw d'31'
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
145 cpfsgt customfunction_temp1
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
146 bra getcustom15_3 ; bank 0
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
147
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
148 movlw d'1'
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
149 movwf EEADRH ; bank 1
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
150 movlw d'32'
573
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
151 subwf customfunction_temp1,F
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
152 movlw d'63'
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
153 cpfsgt customfunction_temp1
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
154 bra getcustom15_3 ; bank 1
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
155
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
156 movlw d'2'
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
157 movwf EEADRH ; bank 2
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
158 movlw d'64'
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
159 subwf customfunction_temp1,F
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
160 getcustom15_3:
573
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
161 movf customfunction_temp1,W
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
162 mullw d'4'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
163 movf PRODL,W ; x4 for adress
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
164 addlw d'130'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
165 movwf EEADR ; +130 for LOW Byte of value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
166 call read_eeprom ; Lowbyte
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
167 movff EEDATA,lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
168 incf EEADR,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
169 call read_eeprom ; Highbyte
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
170 movff EEDATA,hi
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
171 clrf EEADRH
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
172 return ; return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
173
574
101fec6a6137 New Custom Functions III menu (CF64-CF95)
heinrichsweikamp
parents: 573
diff changeset
174 menu_custom_functions_page3:
101fec6a6137 New Custom Functions III menu (CF64-CF95)
heinrichsweikamp
parents: 573
diff changeset
175 movlw .2
101fec6a6137 New Custom Functions III menu (CF64-CF95)
heinrichsweikamp
parents: 573
diff changeset
176 movff WREG,cf_page_number ; CF page number (0: 0-31, 1: 32-63)
101fec6a6137 New Custom Functions III menu (CF64-CF95)
heinrichsweikamp
parents: 573
diff changeset
177 movlw .225
101fec6a6137 New Custom Functions III menu (CF64-CF95)
heinrichsweikamp
parents: 573
diff changeset
178 movff WREG,cf_title_text ; # of text for title
101fec6a6137 New Custom Functions III menu (CF64-CF95)
heinrichsweikamp
parents: 573
diff changeset
179 movlw .193
101fec6a6137 New Custom Functions III menu (CF64-CF95)
heinrichsweikamp
parents: 573
diff changeset
180 movff WREG,cf_descriptor_text ; # of descriptor text offset
101fec6a6137 New Custom Functions III menu (CF64-CF95)
heinrichsweikamp
parents: 573
diff changeset
181 bra menu_custom_functions0
101fec6a6137 New Custom Functions III menu (CF64-CF95)
heinrichsweikamp
parents: 573
diff changeset
182
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
183 menu_custom_functions_page2:
573
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
184 movlw .1
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
185 movff WREG,cf_page_number ; CF page number (0: 0-31, 1: 32-63)
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
186 movlw .186
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
187 movff WREG,cf_title_text ; # of text for title
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
188 movlw .154
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
189 movff WREG,cf_descriptor_text ; # of descriptor text offset
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
190 bra menu_custom_functions0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
191
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
192 menu_custom_functions:
574
101fec6a6137 New Custom Functions III menu (CF64-CF95)
heinrichsweikamp
parents: 573
diff changeset
193 movlw .0
101fec6a6137 New Custom Functions III menu (CF64-CF95)
heinrichsweikamp
parents: 573
diff changeset
194 movff WREG,cf_page_number ; CF page number (0: 0-31, 1: 32-63)
573
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
195 movlw .27
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
196 movff WREG,cf_title_text ; # of text for title
574
101fec6a6137 New Custom Functions III menu (CF64-CF95)
heinrichsweikamp
parents: 573
diff changeset
197 movlw .36
101fec6a6137 New Custom Functions III menu (CF64-CF95)
heinrichsweikamp
parents: 573
diff changeset
198 movff WREG,cf_descriptor_text ; # of descriptor text offset
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
199
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
200 menu_custom_functions0:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
201 bsf leftbind
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
202 call PLED_ClearScreen
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
203 movlw d'1'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
204 movwf menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
205
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
206 bcf menubit4
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
207 bcf cursor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
208 bcf sleepmode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
209 clrf decodata+0 ; here: # of CustomFunction
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
210 clrf cf32_x4 ; here: # of CustomFunction*4
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
211 bcf first_FA ; here: =1: -, =0: +
360
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
212 movlw 1 ; Stepsize: 1, 10, or 100.
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
213 movwf cf_step
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
214
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
215 call PLED_topline_box
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
216 WIN_INVERT .1 ; Init new Wordprocessor
573
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
217 movff cf_title_text,WREG ; Title text in low bank
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
218 call displaytext_1_low
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
219 WIN_INVERT .0 ; Init new Wordprocessor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
220
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
221 menu_custom_functions1:
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 100
diff changeset
222 call PLED_standard_color ; Trash EEADRH...
29
c6cab044a338 1.61beta rc2
heinrichsweikamp
parents: 27
diff changeset
223
573
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
224 movff cf_page_number,EEADRH ; CF page number (0: 0-31, 1: 32-63)
7
5c4ba624165d cf32 bug fixed
heinrichsweikamp
parents: 0
diff changeset
225
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
226 clrf timeout_counter2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
227 bcf menubit2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
228 bcf menubit3
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
229 WIN_LEFT .20
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
230 WIN_TOP .35
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
231 lfsr FSR2,letter
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
232 movff decodata+0,lo ; decodata == CF number % 32
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
233
573
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
234 movff cf_page_number,WREG ; CF page number (0: 0-31, 1: 32-63)
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
235 mullw .32 ; CF page number * 32 -> PRODL:PRODH
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
236 movf PRODL,W
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
237 addwf lo,F ; Add offset for display in CF menu
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
238
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
239 output_99x
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 100
diff changeset
240 STRCAT_PRINT ": "
573
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
241 movff cf_descriptor_text,WREG ; start of custom function descriptors
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
242 addwf decodata+0,W ; add # of current custom function, place result in wreg
174
53b16a746166 Multi-lang
JeanDo
parents: 167
diff changeset
243 call displaytext_1_low ; shows descriptor
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
244
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
245 ; Read default, type and min/max from reset table.
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
246 rcall cf_read_default
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
247
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
248 movf cf_type,W ; Is it a ON/OFF flag ?
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
249 xorlw CF_BOOL
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
250 bnz menu_custom_functions10a ; Not a binary CF selected
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
251
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
252 menu_custom_functions10c:
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
253 ; Erase unused lines when editing boolean...
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
254 WIN_LEFT .20
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
255 WIN_TOP .65
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
256 lfsr FSR2,letter ; Make a string of 8 spaces
84
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
257 call cf_fill_line
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
258 call word_processor ; Clear +/- line
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
259
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
260 WIN_TOP .95
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
261 call word_processor ; Clear 1/10 line
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
262
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
263 bra menu_custom_functions10b
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
264
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
265 menu_custom_functions10a:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
266 WIN_LEFT .20
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
267 WIN_TOP .65
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 100
diff changeset
268 STRCPY "+/-: "
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
269 movlw '+'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
270 btfsc first_FA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
271 movlw '-'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
272 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
273 call word_processor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
274
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
275 WIN_TOP .95
445
6e57b5bb98ce localisation part 1 from Sergei
heinrichsweikamp
parents: 360
diff changeset
276 STRCPY TXT_STEP5
360
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
277 clrf hi
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
278 movff cf_step,lo
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
279 call display_formated ; Typed display, w/o fill line.
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
280 STRCAT_PRINT " " ; 2 spaces for "0.01"->"1"
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
281
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
282 menu_custom_functions10b:
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
283 WIN_LEFT .20
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
284 WIN_TOP .125
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
285 lfsr FSR2,letter
360
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
286 OUTPUTTEXT d'89' ; "Default:"
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
287
360
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
288 movff cf_default+0,lo
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
289 movff cf_default+1,hi
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
290 call display_customfunction ; Typed display.
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
291
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
292 WIN_LEFT .20
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
293 WIN_TOP .155
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
294 lfsr FSR2,letter
360
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
295 OUTPUTTEXT d'97' ; "Current:"
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
296
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
297 movf cf32_x4,W
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
298 addlw 0x82
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
299 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
300 call read_eeprom ; Lowbyte
360
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
301 movff EEDATA,cf_value+0
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
302
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
303 movf cf32_x4,W
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
304 addlw 0x83
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
305 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
306 call read_eeprom ; Highbyte
360
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
307 movff EEDATA,cf_value+1
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
308
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 100
diff changeset
309 call PLED_standard_color ; Changed by color swatches, but trash EEADRH...
360
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
310 movff cf_value+0,lo
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
311 movff cf_value+1,hi
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
312 call display_customfunction
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
313
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
314 ; End of mask: min/max and the exit line...
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
315 rcall display_minmax
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
316 DISPLAYTEXT .11 ; Exit
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
317
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
318 call wait_switches ; Waits until switches are released, resets flag if button stays pressed!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
319 call PLED_menu_cursor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
320
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
321 customfunctions_loop:
337
6bdf80d7276c Added screen dumps of general menus.
JeanDo
parents: 335
diff changeset
322 call check_switches_logbook
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
323
337
6bdf80d7276c Added screen dumps of general menus.
JeanDo
parents: 335
diff changeset
324 btfsc menubit3
6bdf80d7276c Added screen dumps of general menus.
JeanDo
parents: 335
diff changeset
325 bra customfunctions2 ; Move cursor or generate next page
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
326
337
6bdf80d7276c Added screen dumps of general menus.
JeanDo
parents: 335
diff changeset
327 btfsc menubit2
6bdf80d7276c Added screen dumps of general menus.
JeanDo
parents: 335
diff changeset
328 bra do_customfunction ; call subfunction
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
329
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
330 btfsc divemode
337
6bdf80d7276c Added screen dumps of general menus.
JeanDo
parents: 335
diff changeset
331 goto restart ; dive started during cf menu
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
332
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
333 btfsc onesecupdate
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
334 call timeout_surfmode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
335
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
336 btfsc onesecupdate
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
337 call set_dive_modes
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
338
337
6bdf80d7276c Added screen dumps of general menus.
JeanDo
parents: 335
diff changeset
339 bcf onesecupdate ; end of 1sek. tasks
335
d36fe3651d56 Updated to 1.91beta
JeanDo
parents: 309
diff changeset
340
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
341 btfsc sleepmode
337
6bdf80d7276c Added screen dumps of general menus.
JeanDo
parents: 335
diff changeset
342 bra exit_customfunctions
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
343
337
6bdf80d7276c Added screen dumps of general menus.
JeanDo
parents: 335
diff changeset
344 bra customfunctions_loop
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
345
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
346 customfunctions2:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
347 incf menupos,F
90
6655b1c59adc FIX new cf menu BOOL mode: should skip lines 2&3.
JeanDo
parents: 86
diff changeset
348 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
349 xorlw CF_BOOL
6655b1c59adc FIX new cf menu BOOL mode: should skip lines 2&3.
JeanDo
parents: 86
diff changeset
350 bnz customfunctions2a ; NO : don't skip lines 2/3.
84
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
351
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
352 movlw d'4' ; Just after increment,
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
353 cpfsgt menupos ; Is current position < 4 ?
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
354 movwf menupos ; NO: skip set to 4.
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
355
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
356 customfunctions2a:
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
357 movlw d'7'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
358 cpfseq menupos ; =7?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
359 bra customfunctions3 ; No
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
360 movlw d'1'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
361 movwf menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
362
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
363 customfunctions3:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
364 clrf timeout_counter2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
365 call PLED_menu_cursor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
366
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
367 call wait_switches ; Waits until switches are released, resets flag if button stays pressed!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
368
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
369 bcf menubit3 ; clear flag
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
370 bra customfunctions_loop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
371
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
372 ;-----------------------------------------------------------------------------
94
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
373 ; Read default value, type, and constraints
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
374 ;
573
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
375 ; Input: cf32_x4
360
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
376 ; Output: cf_default, cf_type, cf_min, cf_max.
94
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
377 ; Trashes: TBLPTR
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
378
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
379 cf_read_default:
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
380 movlw LOW(cf_default_table0) ; Get 24bit PROM pointer. SKIP
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
381 movwf TBLPTRL
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
382 movlw HIGH(cf_default_table0)
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
383 movwf TBLPTRH
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
384 movlw UPPER(cf_default_table0)
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
385 movwf TBLPTRU
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
386
573
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
387 movff cf_page_number,WREG ; CF page number (0: 0-31, 1: 32-63)
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
388 mullw 0x80 ; CF page number * 0x80 -> PRODL:PRODH
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
389
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
390 movf PRODL,W
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
391 addwf cf32_x4,W ; Add 4 x (CF index modulus 32)
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
392 addwf TBLPTRL,F ; And to a 8+16 add into TBLPTR
573
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
393 movf PRODH,W
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
394 addwfc TBLPTRH,F ; Propagate to 16bit (but not 24bits).
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
395
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
396 tblrd*+
360
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
397 movff TABLAT,cf_default+0 ; Low byte
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
398 tblrd*+
360
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
399 movff TABLAT,cf_default+1 ; High byte
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
400 btfss cf_default+1,7 ; 15bit ?
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
401 clrf cf_default+1 ; NO: clear extra type flags
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
402 bcf cf_default+1,7 ; clear 15bit flag
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
403
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
404 movff TABLAT,cf_type ; type (high byte) --> cf_type
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 tblrd*+
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
407 movff TABLAT,cf_min ; Then get optional min/max
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
408 tblrd*+
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
409 movff TABLAT,cf_max
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
410
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
411 return
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
412
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
413 ;-----------------------------------------------------------------------------
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
414 ; Display a 8/15bit value, plus optional min and max bound.
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
415 ; Input : hi:lo = data to display.
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
416 ; cf_type = the type.
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
417 ; cf_min, cf_max : the optional min/max.
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
418 ; FSR2 = current string pointer.
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
419 ; Trash : hi:lo (when displaying min/max)
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
420
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
421 display_customfunction:
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
422 movff EEADRH, FSR1H ; Backup...
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
423
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
424 rcall display_formated
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 100
diff changeset
425 incf WREG ; Color swatch drawn ?
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 100
diff changeset
426 bz display_customfunction_1 ; YES: skip line fill...
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 100
diff changeset
427
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
428 rcall cf_fill_line
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
429 call word_processor
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
430
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 100
diff changeset
431 display_customfunction_1:
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
432 movff FSR1H, EEADRH
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
433 return
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
434
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
435 ;-----------------------------------------------------------------------------
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
436 ; Display optional min/max values.
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
437 ; 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
438 ; Trashed: hi:lo while display min and max values.
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
439 display_minmax:
99
39d325b2a5f9 FIX bad warning for 15bits CF values
JeanDo
parents: 97
diff changeset
440 ; Min/max unsupported for 15bit values yet...
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
441 movff EEADRH, FSR1H ; Backup...
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
442
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
443 ; Display min line
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
444 WIN_TOP .65
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
445 WIN_LEFT .100
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
446 lfsr FSR2, letter
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
447
100
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
448 btfsc cf_type,7 ; A 15bit value ?
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
449 bra cf_no_min ; Don't display, hence clear line...
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
450
355
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
451 btfss cf_type,CF_MIN_BIT ; A min value exists ?
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
452 bra cf_no_min
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
453
355
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
454 btfss cf_type,CF_NEG_BIT
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
455 bra cf_min_unsigned
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
456
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
457 ; Uses 16bit sub for checking signed min value.
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
458 movff cf_value,sub_a+0 ; A <- value
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
459 clrf sub_a+1
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
460 btfsc cf_value,7 ; extend sign if value < 0
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
461 setf sub_a+1
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
462
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
463 movff cf_min,sub_b+0 ; B <- min (with signed extend)
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
464 setf sub_b+1 ; min have to be negativ.
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
465 call sub16 ; Compute (A-B)
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
466
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
467 btfss neg_flag ; Result < 0 ?
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
468 bra cf_min_passed ; NO
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
469 bra cf_min_failed ; YES
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
470
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
471 cf_min_unsigned:
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
472 movf cf_min,W ; Retrieve current 8b value
355
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
473 subwf cf_value,W ; Compute (value-min)
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
474 bc cf_min_passed ; Ok if CARRY, ie. min >= lo
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
475
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
476 cf_min_failed:
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
477 call PLED_warnings_color
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
478 WIN_INVERT 1
355
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
479
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
480 cf_min_passed:
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 100
diff changeset
481 STRCAT "> " ; A min value follows
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
482 movff cf_min, lo
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
483 rcall display_formated
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
484
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
485 cf_no_min:
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
486 rcall cf_fill_line ; Fill buffer
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
487 lfsr FSR2, letter+.7 ; Limit to 8 chars btw.
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
488 call word_processor
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
489
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
490 ; Display max line
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
491 WIN_TOP .95
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
492 call PLED_standard_color
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
493 WIN_INVERT 0
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
494 lfsr FSR2, letter
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
495
100
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
496 btfsc cf_type,7 ; A 15bit value ?
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
497 bra cf_no_max ; Don't display, hence clear line too...
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
498
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
499 btfss cf_type, CF_MAX_BIT ; A max value exists ?
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
500 bra cf_no_max
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
501
355
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
502 btfss cf_type,CF_NEG_BIT
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
503 bra cf_max_unsigned
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
504
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
505 ; Uses 16bit sub for checking signed min value.
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
506 movff cf_max,sub_a+0 ; A <- max (with signed extend)
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
507 clrf sub_a+1 ; max have to be positiv.
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
508
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
509 movff cf_value,sub_b+0 ; B <- value
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
510 clrf sub_b+1
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
511 btfsc cf_value,7 ; extend sign if value < 0
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
512 setf sub_b+1
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
513 call sub16 ; Compute (A-B)
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
514
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
515 btfss neg_flag ; Result < 0 ?
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
516 bra cf_max_passed ; NO
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
517 bra cf_max_failed ; YES
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
518
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
519 cf_max_unsigned:
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
520 movf cf_value,W ; Retrieve current max bound
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
521 subwf cf_max,W ; Compute (max-lo)
360
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
522 bc cf_max_passed ; Ok if no carry, ie. max <= lo
355
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
523
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
524 cf_max_failed:
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
525 call PLED_warnings_color
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
526 WIN_INVERT 1
355
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
527
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
528 cf_max_passed:
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 100
diff changeset
529 STRCAT "< " ; A max value follows
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
530 movff cf_max, lo
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
531 rcall display_formated
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
532
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
533 cf_no_max:
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
534 rcall cf_fill_line ; Fill buffer
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
535 lfsr FSR2, letter+.7 ; Limit to 8 chars btw.
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
536 call word_processor
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
537
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
538 cf_minmax_done:
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
539 call PLED_standard_color
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
540 WIN_INVERT 0
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
541 movff FSR1H, EEADRH
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
542 return
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
543
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
544 ;-----------------------------------------------------------------------------
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
545 ; Display a single 8/15 bit value, according to cf_type.
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
546 ; Input : hi:lo = data to display.
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
547 ; cf_type = the type.
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
548 ; cf_min, cf_max : the optional min/max.
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
549 ; FSR2 = current string pointer.
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
550 display_formated:
355
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
551 movf cf_type,W ; Just set N flags
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
552 bn cf_type_80 ; Keep 15bits value in old format.
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
553
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
554 ;---- handle signed values -----------------------------------------------
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
555 ; NOTE: only 8bit values can have a negativ flag right now.
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
556 btfss cf_type,CF_NEG_BIT ; Signed value ?
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
557 bra cf_type_unsigned ; NO: display unsigned as-is
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
558
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
559 btfss lo,7 ; Negativ value ?
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
560 bra cf_type_pos ; NO: display positives with a + sign.
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
561
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
562 PUTC '-' ; YES: display with a - sign.
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
563 negf lo ; and correct the said value.
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
564 bra cf_type_unsigned
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
565
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
566 cf_type_pos:
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
567 PUTC '+'
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
568
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
569 ;---- decode type --------------------------------------------------------
355
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
570 cf_type_unsigned:
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
571 ; Jump table: ; test the value with cleared flags...
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
572 movf cf_type,W
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
573 andlw CF_TYPES ; Look just at types
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
574 bz cf_type_00 ; 8bit standard mode
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
575
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
576 dcfsnz WREG
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
577 bra cf_type_01
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
578 dcfsnz WREG
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
579 bra cf_type_02
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
580 dcfsnz WREG
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
581 bra cf_type_03
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
582 dcfsnz WREG
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
583 bra cf_type_04
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
584 dcfsnz WREG
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
585 bra cf_type_05
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
586 dcfsnz WREG
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
587 bra cf_type_06
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
588 dcfsnz WREG
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
589 bra cf_type_07
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
590 bra cf_type_00 ; Default to 8bit mode...
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
591
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
592 cf_type_01: ; Type == 1 is CF_PERCENT mode
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
593 bcf leftbind
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
594 output_8
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 100
diff changeset
595 PUTC '%'
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
596 retlw 0
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
597
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
598 cf_type_02: ; Type == 2 is CF_DECI mode.
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
599 clrf hi
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
600 bsf leftbind
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
601 output_16dp 4
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
602 retlw 0
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
603
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
604 cf_type_03: ; Type == 3 is CF_CENTI mode.
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
605 clrf hi
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
606 bsf leftbind
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
607 output_16dp 3
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
608 retlw 0
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
609
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
610 cf_type_04: ; Type == 4 is CF_MILI mode
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
611 output_16dp 2
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
612 retlw 0
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
613
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
614 cf_type_05: ; Type == 5 is CF_BOOL mode.
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
615 movf lo,W ; Get flag value...
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
616 bz cf_type_off
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
617 OUTPUTTEXT d'130' ; ON
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
618 retlw 0
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
619
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
620 cf_type_off:
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
621 OUTPUTTEXT d'131' ; OFF
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
622 retlw 0
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
623
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
624 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
625 clrf hi
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
626 call convert_time ; Convert to min:sec into hi:low.
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 100
diff changeset
627 movff lo,TABLAT ; Save seconds for later.
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
628 movff hi,lo ; Get minutes
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
629 bsf leftbind ; Skip leading space(s).
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
630 output_8 ; Print them
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 100
diff changeset
631 PUTC ':' ; Separator
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 100
diff changeset
632 movff TABLAT,lo ; Get back seconds
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
633 output_99x ; lo in 2 digits with trailing zeros.
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
634 retlw 0
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
635
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
636 cf_type_07: ; Type == 7 is CF_COLOR swatch.
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
637 bcf leftbind ; Keep leading space (better alignement)
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
638 output_8
360
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
639
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
640 movff win_top,WREG ; Is it the step value ?
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
641 xorlw .95 ; Line for "Step:"
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
642 btfsc STATUS,Z
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
643 retlw -1 ; YES : return
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
644
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 100
diff changeset
645 STRCAT_PRINT " "
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
646 movf lo,W ; Get color.
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 100
diff changeset
647 call PLED_set_color
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 100
diff changeset
648 movlw .23
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 100
diff changeset
649 movff WREG,win_height ; row bottom (0-239)
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
650 movlw .110
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 100
diff changeset
651 movff WREG,win_leftx2 ; column left (0-159)
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 100
diff changeset
652 movlw .148-.110+1
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 100
diff changeset
653 movff WREG,win_width ; column right (0-159)
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
654
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
655 call PLED_box
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
656 retlw -1 ; wp already done. Skip it...
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
657
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
658 cf_type_00: ; 8bit mode. Or unrecognized type...
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
659 clrf hi
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
660 bsf leftbind
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
661
355
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
662 cf_type_80: ; 15bit mode.
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
663 bcf hi,7
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
664 output_16
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
665 retlw 0
84
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
666
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
667 ;-----------------------------------------------------------------------------
84
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
668
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
669 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
670 movf FSR2L,W ; How many chars lefts ?
164
999abb01c78f + Change data allocation scheme
JeanDo
parents: 123
diff changeset
671 sublw letter + .18 ; Remaining chars to fill: (letter + 18) - PTR
84
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
672 btfsc STATUS,N ; Add chars until none left...
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
673 return
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 100
diff changeset
674 PUTC ' '
84
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
675 bra cf_fill_line
79
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
676
69c462400279 Making CF edition esier
JeanDo
parents: 29
diff changeset
677 ;-----------------------------------------------------------------------------
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
678
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
679 do_customfunction:
573
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
680 movff cf_page_number,EEADRH ; CF page number (0: 0-31, 1: 32-63)
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
681
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
682 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
683 bra next_customfunction
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
684 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
685 bra toggle_plusminus
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
686 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
687 bra toggle_oneorten
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
688 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
689 bra restore_cfn_value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
690 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
691 bra adjust_cfn_value
84
0f4c175ef824 FIX flickering in new CF menus
JeanDo
parents: 83
diff changeset
692
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
693 ;-----------------------------------------------------------------------------
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
694
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
695 exit_customfunctions:
573
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
696 movff cf_page_number,menupos ; CF page number (0: 0-31, 1: 32-63)
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
697 incf menupos,F
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
698 clrf EEADRH ; Clear EEADRH !
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
699 goto setup_menu2 ; exit...
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
700
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
701 ;-----------------------------------------------------------------------------
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
702
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
703 next_customfunction:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
704 incf decodata+0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
705 btfsc decodata+0,5 ;>31?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
706 clrf decodata+0 ;Yes, so reset to zero
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
707
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
708 movf decodata+0,W
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
709 mullw d'4'
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
710 movff PRODL, cf32_x4 ; 12bit address for correct addressing
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
711
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
712 movlw d'1'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
713 movwf menupos
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
714 bra menu_custom_functions1 ; also debounces switches
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
715
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
716 ;-----------------------------------------------------------------------------
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
717
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
718 toggle_plusminus:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
719 btg first_FA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
720 movlw d'2'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
721 movwf menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
722 bra menu_custom_functions1 ; also debounces switches
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
723
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
724 ;-----------------------------------------------------------------------------
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
725
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
726 toggle_oneorten:
360
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
727 movlw .10 ; Multiply step by 10,
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
728 mulwf cf_step ; Result in PROD low.
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
729
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
730 movf PRODH,W ; Check 1000
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
731 bz toggle_oneorten_1 ; HIGH(new step) null == no overflow
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
732 movlw .1 ; Cycle to 1.
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
733 movwf cf_step
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
734 bra toggle_oneorten_3
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
735
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
736 toggle_oneorten_1: ; Special case for mm:ss
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
737 movf cf_type,W ; Get type
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
738 andlw CF_TYPES ; w/o min/max/neg flags.
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
739 xorlw CF_SEC ; Check for mm:ss ?
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
740 bnz toggle_oneorten_2 ; no: continue
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
741 movlw .100 ; Step = 100 ?
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
742 xorwf PRODL,W
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
743 bnz toggle_oneorten_2 ; no: continue
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
744 movlw .60 ; yes: replace by 1:00
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
745 movff WREG,cf_step
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
746 bra toggle_oneorten_3 ; Done.
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
747
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
748 toggle_oneorten_2:
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
749 movff PRODL,cf_step ; Just keep result.
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
750 toggle_oneorten_3:
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
751 movlw d'3'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
752 movwf menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
753 bra menu_custom_functions1 ; also debounces switches
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
754
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
755 ;-----------------------------------------------------------------------------
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
756
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
757 restore_cfn_value:
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
758 movf cf32_x4,W ; store default value
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
759 addlw 0x82
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
760 movwf EEADR
360
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
761 movff cf_default+0,EEDATA
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
762 movff cf_default+0,cf_value+0
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
763 call write_eeprom ; Lowbyte
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
764 movf cf32_x4,W
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
765 addlw 0x83
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
766 movwf EEADR
360
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
767 movff cf_default+1,EEDATA
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
768 movff cf_default+1,cf_value+1
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
769 call write_eeprom ; Highbyte
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
770
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
771 movlw d'4'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
772 movwf menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
773 bra menu_custom_functions1 ; also debounces switches
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
774
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
775 ;-----------------------------------------------------------------------------
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
776 ; Adjust current value.
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
777 adjust_cfn_value:
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
778 movf cf32_x4,W ; get current value
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
779 addlw 0x82
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
780 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
781 call read_eeprom ; Lowbyte
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
782 movff EEDATA,lo
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
783 movf cf32_x4,W
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
784 addlw 0x83
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
785 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
786 call read_eeprom ; Highbyte
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
787 movff EEDATA,hi
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
788
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
789 movf cf_type,W
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
790 xorlw CF_BOOL
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
791 bnz adjust_cfn_value1
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
792
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
793 btg lo,0 ; Change lower bit.
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
794 bra adjust_cfn_value3 ; Store result
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
795
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
796 adjust_cfn_value1:
360
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
797 movf cf_step,W ; 1, 10, 100 ?
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
798
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
799 btfss first_FA ; Minus?
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
800 bra adjust_cfn_value2 ; No, Plus
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
801
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
802 subwf lo,F ; substract value
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
803 movlw d'0'
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
804 btfsc cf_type,7 ; 8Bit value
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
805 subwfb hi,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
806
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
807 movlw b'01111111'
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
808 btfsc hi,7 ; >32768?
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
809 movwf hi
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
810
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
811 bra adjust_cfn_value3
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
812
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
813 adjust_cfn_value2:
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
814 addwf lo,F ; add value
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
815 movlw d'0'
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
816 btfsc cf_type,7 ; 8Bit value?
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
817 addwfc hi,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
818
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
819 btfsc hi,7 ; >32768?
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
820 clrf hi
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
821
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
822 adjust_cfn_value3:
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
823 movf cf32_x4,W ; Store current value
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
824 addlw 0x82
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
825 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
826 movff lo,EEDATA
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
827 call write_eeprom ; Lowbyte
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
828 movf cf32_x4,W
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
829 addlw 0x83
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
830 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
831 movff hi,EEDATA
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
832 call write_eeprom ; Highbyte
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
833 movlw d'5'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
834 movwf menupos
86
b40a0a6284da adding custom functions with limits (jeando)
heinrichsweikamp
parents: 84
diff changeset
835 bra menu_custom_functions1 ; also debounces switches
94
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
836
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
837 ;-----------------------------------------------------------------------------
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
838 ; 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
839 ; Input: cf_checker_counter.
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
840 ; 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
841 ; cf_checker_counter incremented.
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
842 ; Trashes: TBLPTR, EEADR, PROD
100
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
843 ;
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
844 ; 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
845 ; they are all ok.
94
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
846
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
847 check_customfunctions:
573
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
848 movlw max_custom_number+1 ; Defined in definitions.asm
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
849 cpfseq cf_checker_counter ; All tested?
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
850 bra check_customfunctions1 ; No, continue
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
851 clrf cf_checker_counter ; clear counter
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
852 return ; YES: just do nothing.
94
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
853
573
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
854 check_customfunctions1:
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
855 ; Setup cf_page_number
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
856 movlw .0
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
857 movff WREG,cf_page_number
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
858 movlw d'31'
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
859 cpfsgt cf_checker_counter
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
860 bra check_customfunctions2 ; CF I
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
861
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
862 movlw .1
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
863 movff WREG,cf_page_number
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
864 movlw d'63'
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
865 cpfsgt cf_checker_counter
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
866 bra check_customfunctions2 ; CF II
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
867
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
868 movlw .2
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
869 movff WREG,cf_page_number ; CF III
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
870
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
871 check_customfunctions2:
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
872 ; Setup cf32_x4
100
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
873 movf cf_checker_counter,W
94
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
874 rlcf WREG ; x4
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
875 rlcf WREG
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
876 andlw 4*.31
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
877 movwf cf32_x4
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
878
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
879 ; Do the check
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
880 rcall check_one_cf
100
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
881 iorwf WREG ; Test return value.
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
882 bz check_failed ; 0 == FAILED.
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
883
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
884 ; Passed: Simple loop until 128 is reached:
573
77c8ff191cd7 Preparations for third bank of Custom Functions
heinrichsweikamp
parents: 478
diff changeset
885 incf cf_checker_counter,F ; Next CF to check.
100
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
886 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
887
100
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
888 check_failed:
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
889 movlw .63 ; Make sure number is back to range 0..63
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
890 andwf cf_checker_counter,F
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
891
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
892 ; Went wrong: draw the warning line...
309
2f21f7a77608 moved cf warning to upper right corner
heinrichsweikamp
parents: 174
diff changeset
893 WIN_TOP .0
2f21f7a77608 moved cf warning to upper right corner
heinrichsweikamp
parents: 174
diff changeset
894 WIN_LEFT .125
100
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
895 WIN_FONT FT_SMALL
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
896 WIN_INVERT .1 ; Init new Wordprocessor
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
897 call PLED_warnings_color
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
898
445
6e57b5bb98ce localisation part 1 from Sergei
heinrichsweikamp
parents: 360
diff changeset
899 STRCPY TXT_CF2
100
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
900 movff cf_checker_counter,lo
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
901 output_99x
309
2f21f7a77608 moved cf warning to upper right corner
heinrichsweikamp
parents: 174
diff changeset
902 STRCAT_PRINT "!"
94
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
903
100
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
904 ; When failed, increment counter modulo 64, to restart checks.
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
905 incf cf_checker_counter,W
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
906 andlw .63 ; Modulo 64
94
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
907 movwf cf_checker_counter
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
908 return
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
909
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
910 ; Check one CF value ---------------------------------------------------------
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
911 check_one_cf:
360
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
912 rcall cf_read_default ; Sets cf_value, cf_type, cf_min, cf_max.
94
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
913
100
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
914 btfsc cf_type,7 ; A 15bit type ?
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
915 bra check_cf_check ; Then we have to check it...
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
916
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
917 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
918 andlw (CF_MIN + CF_MAX)
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
919 bnz check_cf_check ; yes: do something.
100
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
920 retlw -1 ; no: no problem then.
94
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
921
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
922 ; It does have bound:
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
923 check_cf_check:
100
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
924 movf cf_checker_counter,W ; Get current CF number
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
925 andlw .63 ; Keep range 0..63
94
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
926
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
927 btfss cf_type,7 ; 15 or 8 bit value ?
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
928 bra cf_check_8bit
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
929
99
39d325b2a5f9 FIX bad warning for 15bits CF values
JeanDo
parents: 97
diff changeset
930 ; Implement the 15bit check, even if not displayed...
167
cb055a7d75f3 + Use overlay local vars.
JeanDo
parents: 164
diff changeset
931 rcall getcustom15 ; Read into hi:lo
94
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
932
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
933 movf cf_min,W ; Compute (bound-value) -> hi:lo
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
934 subwf lo,F
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
935 movf cf_max,W
100
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
936 bcf WREG,7 ; Clear min/max bit
94
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
937 subwfb hi,F
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
938
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
939 movf lo,W ; Is it a 0 result ?
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
940 iorwf hi,W
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
941 bnz cf_15_not_equal ; NO: check sign.
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
942 retlw -1 ; YES: then it is ok.
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
943
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
944 cf_15_not_equal:
99
39d325b2a5f9 FIX bad warning for 15bits CF values
JeanDo
parents: 97
diff changeset
945 btfss cf_max,7 ; Checking min or max ?
94
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
946 btg hi,6 ; exchange wanted sign
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
947
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
948 btfss hi,6 ; Is sign correct ?
100
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
949 retlw 0 ; NO: return failed.
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
950 retlw -1 ; YES: return passed.
94
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
951
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
952 ; Do a 8bit check
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
953 cf_check_8bit:
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
954 rcall getcustom8_1 ; Read into WREG
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
955 movwf lo ; Save it.
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
956
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
957 btfss cf_type,CF_MIN_BIT
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
958 bra check_no_min
355
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
959
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
960 btfss cf_type,CF_NEG_BIT
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
961 bra check_min_unsigned
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
962
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
963 ; Uses 16bit sub for checking signed min value.
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
964 movff lo,sub_a+0 ; A <- value
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
965 clrf sub_a+1
360
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
966 btfsc lo,7 ; extend sign if value < 0
355
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
967 setf sub_a+1
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
968
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
969 movff cf_min,sub_b+0 ; B <- min (with signed extend)
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
970 setf sub_b+1 ; min have to be negativ.
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
971 call sub16 ; Compute (A-B)
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
972
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
973 btfss neg_flag ; Result < 0 ?
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
974 bra check_no_min ; NO
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
975 retlw 0 ; YES = FAILED
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
976
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
977 check_min_unsigned:
94
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
978 cpfsgt cf_min ; Compare to cf_min
100
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
979 bra check_no_min ; PASSED: continue.
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
980 retlw 0 ; NO: return failed.
94
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
981
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
982 check_no_min:
100
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
983 btfss cf_type,CF_MAX_BIT ; Is there a MAX bound ?
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
984 retlw -1 ; No check: return OK.
355
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
985
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
986 btfss cf_type,CF_NEG_BIT
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
987 bra check_max_unsigned
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
988
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
989 ; Uses 16bit sub for checking signed min value.
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
990 movff cf_max,sub_a+0 ; A <- max (with signed extend)
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
991 clrf sub_a+1 ; max have to be positiv.
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
992
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
993 movff lo,sub_b+0 ; B <- value
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
994 clrf sub_b+1
360
d4ca9196e830 Added 1/10/100 steps for CF menu.
JeanDo
parents: 355
diff changeset
995 btfsc lo,7 ; extend sign if value < 0
355
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
996 setf sub_b+1
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
997 call sub16 ; Compute (A-B)
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
998
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
999 btfss neg_flag ; Result < 0 ?
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
1000 retlw -1 ; NO
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
1001 retlw 0 ; YES
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
1002
f49d6f0fc870 Allow negatif CF:
JeanDo
parents: 337
diff changeset
1003 check_max_unsigned:
94
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
1004 movf lo,W ; Compute value-max
ce3283064cde Check all CF in surfacemode, pop warning is oobounds
JeanDo
parents: 90
diff changeset
1005 cpfslt cf_max
100
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
1006 retlw -1 ; Bound met: return OK.
db4a20b413df Checking all CF values at once.
JeanDo
parents: 99
diff changeset
1007 retlw 0 ; NO: return failed.