annotate src/options.asm @ 629:237931377539

3.07 stable release
author heinrichsweikamp
date Fri, 29 Nov 2019 18:48:11 +0100
parents cd58f7fc86db
children 185ba2f91f59
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
heinrichsweikamp
parents:
diff changeset
1 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
2 ;
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
3 ; File options.asm next combined generation V3.04.3
0
heinrichsweikamp
parents:
diff changeset
4 ;
heinrichsweikamp
parents:
diff changeset
5 ; Manage all options data.
heinrichsweikamp
parents:
diff changeset
6 ;
heinrichsweikamp
parents:
diff changeset
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
heinrichsweikamp
parents:
diff changeset
8 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
9 ; HISTORY
heinrichsweikamp
parents:
diff changeset
10 ; 2011-07-12 : [jDG] Creation.
heinrichsweikamp
parents:
diff changeset
11 ;
heinrichsweikamp
parents:
diff changeset
12
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
13 #include "hwos.inc" ; mandatory header
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
14 #include "strings.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
15 #include "convert.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
16 #include "ghostwriter.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
17 #include "eeprom_rs232.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
18 #include "external_flash.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
19 #include "wait.inc"
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
20 #include "shared_definitions.h"
608
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
21 #include "gaslist.inc"
0
heinrichsweikamp
parents:
diff changeset
22
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
23 extern write_eeprom
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
24 extern read_eeprom
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
25 extern eeprom_serial_save,eeprom_opt_backup
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
26 extern option_table_begin,option_table_end
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
27 extern convert_meter_to_feet
0
heinrichsweikamp
parents:
diff changeset
28
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
29 options CODE
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
30
0
heinrichsweikamp
parents:
diff changeset
31 ;=============================================================================
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
32 ; Reset all options to factory defaults
0
heinrichsweikamp
parents:
diff changeset
33 ;
heinrichsweikamp
parents:
diff changeset
34 ; INPUT: none
heinrichsweikamp
parents:
diff changeset
35 ; OUTPUT: none
heinrichsweikamp
parents:
diff changeset
36 ; TRASH: TBLPTR, TABLAT, WREG, FSR0, FSR1, FSR2
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
37 ;
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
38 global option_reset_all ; reset all options to factory default
0
heinrichsweikamp
parents:
diff changeset
39 option_reset_all:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
40 clrf EEADRH
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
41 read_int_eeprom .2
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
42 tstfsz EEDATA ; number of total dives = 0 ?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
43 bra option_reset_all2 ; NO - skip resetting logbook
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
44 read_int_eeprom .3
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
45 tstfsz EEDATA ; number of total dives = 0 ?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
46 bra option_reset_all2 ; NO - skip resetting logbook
0
heinrichsweikamp
parents:
diff changeset
47
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
48 clrf EEDATA
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
49 write_int_eeprom .4
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
50 write_int_eeprom .5
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
51 write_int_eeprom .6
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
52 write_int_eeprom .2 ; delete total dive counter, too
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
53 write_int_eeprom .3
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
54 call ext_flash_erase_logbook ; complete logbook
0
heinrichsweikamp
parents:
diff changeset
55
heinrichsweikamp
parents:
diff changeset
56 option_reset_all2:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
57 clrf lo
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
58 clrf hi
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
59 call do_logoffset_common_write ; reset logbook offset
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
60 movlw LOW(option_table_begin) ; point to option table begin
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
61 movwf FSR0L
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
62 movlw HIGH(option_table_begin)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
63 movwf FSR0H
0
heinrichsweikamp
parents:
diff changeset
64 option_reset_all_1:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
65 movlw LOW(option_table_end) ; get low byte of end of table address
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
66 cpfseq FSR0L ; does it equal the current pointer position?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
67 bra option_reset_all_2 ; NO - more options to process
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
68 movlw HIGH(option_table_end) ; get high byte of end of table address
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
69 cpfseq FSR0H ; does it equal the current pointer position?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
70 bra option_reset_all_2 ; NO - more options to process
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
71 return ; YES to both - end of option table reached, done
562
8b7ea27ea1fa seperate desat and sat multipliers for GF and Non-GF modes. Set to 100/100 as default in GF mode
heinrichsweikamp
parents: 560
diff changeset
72 option_reset_all_2:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
73 rcall option_reset ; reset one option...
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
74 bra option_reset_all_1 ; ... and loop
0
heinrichsweikamp
parents:
diff changeset
75
heinrichsweikamp
parents:
diff changeset
76 ;=============================================================================
21
79b2084fd75a Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents: 18
diff changeset
77 ; Check all option and reset option if out of min/max boundary
79b2084fd75a Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents: 18
diff changeset
78 ;
79b2084fd75a Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents: 18
diff changeset
79 ; INPUT: none
79b2084fd75a Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents: 18
diff changeset
80 ; OUTPUT: none
79b2084fd75a Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents: 18
diff changeset
81 ; TRASH: TBLPTR, TABLAT, WREG, FSR0, FSR1, FSR2
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
82 ;
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
83 global option_check_all ; check all option and reset option if out of min/max boundary
21
79b2084fd75a Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents: 18
diff changeset
84 option_check_all:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
85 bcf option_repaired ; no option needed repair up to now
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
86 movlw LOW(option_table_begin) ; point to option table begin
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
87 movwf FSR0L
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
88 movlw HIGH(option_table_begin)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
89 movwf FSR0H
21
79b2084fd75a Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents: 18
diff changeset
90 option_check_all_1:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
91 movlw LOW(option_table_end) ; get low byte of end of table address
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
92 cpfseq FSR0L ; does it equal the current pointer position?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
93 bra option_check_all_2 ; NO - more options to process
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
94 movlw HIGH(option_table_end) ; get high byte of end of table address
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
95 cpfseq FSR0H ; does it equal the current pointer position?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
96 bra option_check_all_2 ; NO - more options to process
608
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
97 bra option_check_all_3 ; YES to both - end of option table reached
562
8b7ea27ea1fa seperate desat and sat multipliers for GF and Non-GF modes. Set to 100/100 as default in GF mode
heinrichsweikamp
parents: 560
diff changeset
98 option_check_all_2:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
99 rcall option_check ; check one option...
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
100 bra option_check_all_1 ; ... and loop
608
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
101 option_check_all_3:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
102 bsf is_diluent_menu ; setup checking diluents
608
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
103 call gaslist_cleanup_list ; check and correct multiple or none First diluent
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
104 bcf is_diluent_menu ; setup checking gases
608
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
105 call gaslist_cleanup_list ; check and correct multiple or none First gas
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
106 IFNDEF _gauge_mode
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
107 call option_cleanup_gauge ; check and correct Gauge mode
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
108 ENDIF
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
109 IFDEF _ccr_pscr
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
110 call option_cleanup_oCCRMode ; check and correct CCR / pSCR mode
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
111 ENDIF
608
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
112 call option_cleanup_GF ; check and correct GFlow <= GFhigh
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
113 return ; all done
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
114
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
115
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
116
21
79b2084fd75a Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents: 18
diff changeset
117 ;=============================================================================
0
heinrichsweikamp
parents:
diff changeset
118 ; Read option handle
heinrichsweikamp
parents:
diff changeset
119 ; INPUT: FSR0 = option handle
heinrichsweikamp
parents:
diff changeset
120 ; OUTPUT: FSR1 = address of variable.
heinrichsweikamp
parents:
diff changeset
121 ; TRASH: TBLPTR, TABLAT, WREG, FSR0, FSR1
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
122 ;
0
heinrichsweikamp
parents:
diff changeset
123 option_read:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
124 movff FSR0L,TBLPTRL ; set memory address of option data set, low byte
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
125 movlw HIGH(option_table_begin) ; get table begin address, high byte
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
126 andlw 0xF0 ; keep only the upper nibble
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
127 iorwf FSR0H,W ; add the memory address of the option data set, high byte
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
128 movwf TBLPTRH ; set the resulting memory address, high byte
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
129 movlw UPPER(option_table_begin) ; get table begin address, upper byte
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
130 movwf TBLPTRU ; set memory address of option data set, upper byte
0
heinrichsweikamp
parents:
diff changeset
131
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
132 ; Read type, default and register from table
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
133 tblrd*+
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
134 movff TABLAT,opt_type
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
135 tblrd*+
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
136 movff TABLAT,opt_default
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
137 tblrd*+
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
138 movff TABLAT,opt_inc
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
139 tblrd*+
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
140 movff TABLAT,opt_min
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
141 tblrd*+
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
142 movff TABLAT,opt_max
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
143 tblrd*+
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
144 movff TABLAT,opt_eeprom
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
145 tblrd*+
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
146 movff TABLAT,opt_unit+0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
147 tblrd*+
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
148 movff TABLAT,opt_unit+1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
149 tblrd*+
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
150 movff TABLAT,FSR1L
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
151 tblrd*+
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
152 movff TABLAT,FSR1H
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
153 movff TBLPTRL,FSR0L ; advance handle to next option data set (used for reset_all)
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
154 movff TBLPTRH,FSR0H
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
155 return
21
79b2084fd75a Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents: 18
diff changeset
156
79b2084fd75a Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents: 18
diff changeset
157 ;=============================================================================
79b2084fd75a Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents: 18
diff changeset
158 ; Check one option and reset if it's out of it's min/max boundaries
79b2084fd75a Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents: 18
diff changeset
159 ; INPUT: FSR0 = option handle
79b2084fd75a Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents: 18
diff changeset
160 ; OUTPUT: none
79b2084fd75a Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents: 18
diff changeset
161 ; TRASH: TBLPTR, TABLAT, WREG, FSR1, FSR2, lo
79b2084fd75a Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents: 18
diff changeset
162 ;
79b2084fd75a Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents: 18
diff changeset
163 option_check:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
164 ; Read type, default and register from table
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
165 rcall option_read
21
79b2084fd75a Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents: 18
diff changeset
166
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
167 ; Switch on type
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
168 movf opt_type,W ; get option type
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
169 xorlw .2 ; type == STRING ?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
170 bz option_check_string ; YES
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
171 movf opt_type,W ; get option type (again)
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
172 xorlw .1 ; type == ENUM8 ?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
173 bz option_check_enum8 ; YES - check if lower then max. value only
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
174 ; NO to all - must be integer then
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
175 tstfsz opt_min ; opt_min = 0 ?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
176 bra option_check_both ; NO - check it
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
177 bra option_check_enum8 ; check max only
220
effd7259f5a5 make button sensitivity configurable (cR hardware)
heinrichsweikamp
parents: 185
diff changeset
178
effd7259f5a5 make button sensitivity configurable (cR hardware)
heinrichsweikamp
parents: 185
diff changeset
179 option_check_both:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
180 decf opt_min,W ; check against minimum value
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
181 cpfsgt INDF1 ; bigger than opt_min - 1 ?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
182 bra option_check_reset ; NO - reset option
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
183 option_check_enum8: ; check against maximum value
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
184 infsnz opt_max,W ; max = 255?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
185 return ; YES - ignore the max. test
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
186 cpfslt INDF1 ; NO - smaller then opt_max + 1 ?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
187 bra option_check_reset ; NO - reset option
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
188 return ; YES - within range, return
21
79b2084fd75a Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents: 18
diff changeset
189
79b2084fd75a Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents: 18
diff changeset
190 option_check_reset:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
191 movff opt_default,INDF1 ; reset option to default
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
192 bsf option_repaired ; flag that an option was repaired
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
193 return ; done
21
79b2084fd75a Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents: 18
diff changeset
194
79b2084fd75a Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents: 18
diff changeset
195 option_check_string:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
196 return
21
79b2084fd75a Reset options to default if they are not within the allowed min/max values
heinrichsweikamp
parents: 18
diff changeset
197
0
heinrichsweikamp
parents:
diff changeset
198 ;=============================================================================
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
199 ; Reset an option to its default value
0
heinrichsweikamp
parents:
diff changeset
200 ; INPUT: FSR0 = option handle
heinrichsweikamp
parents:
diff changeset
201 ; OUTPUT: none
heinrichsweikamp
parents:
diff changeset
202 ; TRASH: TBLPTR, TABLAT, WREG, FSR1, FSR2
heinrichsweikamp
parents:
diff changeset
203 ;
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
204 global option_reset ; reset FSR0 option to factory default
0
heinrichsweikamp
parents:
diff changeset
205 option_reset:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
206 ; Read type, default and register from table
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
207 rcall option_read ; read option data
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
208 movf opt_type,W ; get option type
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
209 xorlw 2 ; Type == STRING ?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
210 bz opt_reset_string ; YES - special copy
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
211 movff opt_default,INDF1 ; NO - just a 8 bit indirect copy
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
212 return
0
heinrichsweikamp
parents:
diff changeset
213 opt_reset_string:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
214 movff FSR1L,FSR2L ; set string destination address
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
215 movff FSR1H,FSR2H ; ...
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
216 movff opt_default+0,FSR1L ; get handle to multi-lingual text in FSR1
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
217 movff opt_default+1,FSR1H ; ...
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
218 movff TBLPTRL,opt_backup_tbl+0 ; TBLPTR trashed by text routine...
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
219 movff TBLPTRH,opt_backup_tbl+1 ; ...
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
220 movff TBLPTRU,opt_backup_tbl+2 ; ...
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
221 call strcat_text ; copy translated text to FSR2
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
222 movff opt_backup_tbl+0,TBLPTRL ; restore TBLPTR
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
223 movff opt_backup_tbl+1,TBLPTRH ; ...
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
224 movff opt_backup_tbl+2,TBLPTRU ; ...
0
heinrichsweikamp
parents:
diff changeset
225
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
226 return
0
heinrichsweikamp
parents:
diff changeset
227
heinrichsweikamp
parents:
diff changeset
228 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
229 ; Save all options to EEPROM
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
230 ;
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
231 global option_save_all ; save options to EEPROM
0
heinrichsweikamp
parents:
diff changeset
232 option_save_all:
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
233 bcf PIR3,RC2IE
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
234 ;---- Save option serial into EEPROM to detect reset and new version
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
235 movlw LOW(eeprom_serial_save)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
236 movwf EEADR
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
237 movlw HIGH(eeprom_serial_save)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
238 movwf EEADRH
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
239 movlw LOW(eeprom_opt_serial)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
240 movwf EEDATA
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
241 call write_eeprom
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
242 incf EEADR,F
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
243 movlw HIGH(eeprom_opt_serial)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
244 movwf EEDATA
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
245 call write_eeprom
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
246
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
247 ;---- Save all options
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
248 movlw LOW(option_table_begin)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
249 movwf FSR0L
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
250 movlw HIGH(option_table_begin)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
251 movwf FSR0H
0
heinrichsweikamp
parents:
diff changeset
252
heinrichsweikamp
parents:
diff changeset
253 option_save_all_1:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
254 movlw LOW(option_table_end)
562
8b7ea27ea1fa seperate desat and sat multipliers for GF and Non-GF modes. Set to 100/100 as default in GF mode
heinrichsweikamp
parents: 560
diff changeset
255 cpfseq FSR0L
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
256 bra option_save_all_2 ; not yet done...
562
8b7ea27ea1fa seperate desat and sat multipliers for GF and Non-GF modes. Set to 100/100 as default in GF mode
heinrichsweikamp
parents: 560
diff changeset
257 movlw HIGH(option_table_end)
8b7ea27ea1fa seperate desat and sat multipliers for GF and Non-GF modes. Set to 100/100 as default in GF mode
heinrichsweikamp
parents: 560
diff changeset
258 cpfseq FSR0H
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
259 bra option_save_all_2 ; not yet done...
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
260 bsf PIR3,RC2IE
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
261 return ; all done
562
8b7ea27ea1fa seperate desat and sat multipliers for GF and Non-GF modes. Set to 100/100 as default in GF mode
heinrichsweikamp
parents: 560
diff changeset
262 option_save_all_2:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
263 rcall option_save ; save one option...
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
264 bra option_save_all_1 ; ...and loop
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
265
0
heinrichsweikamp
parents:
diff changeset
266
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
267 global option_save
0
heinrichsweikamp
parents:
diff changeset
268 option_save:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
269 rcall option_read
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
270 incf opt_eeprom,W ; should we save it ?
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
271 btfsc STATUS,Z ; EEPROM address is FFh ?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
272 return ; YES - nothing to do
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
273 movf opt_eeprom,W ; compute backup address in EEPROM
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
274 addlw LOW(eeprom_opt_backup) ; add offset
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
275 movwf EEADR
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
276 movlw HIGH(eeprom_opt_backup)
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
277 btfsc STATUS,C ; > 256 ?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
278 addlw .1 ; YES - +1
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
279 movwf EEADRH
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
280 movf opt_type,W ; get option type
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
281 xorlw 2 ; option type is string ?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
282 bz option_save_string ; YES
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
283 movff INDF1,EEDATA ; NO - one byte to be saved to EEPROM
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
284 btfss EEADRH,1 ; - EEADR:EEADRH < 512 ?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
285 call write_eeprom ; YES - write
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
286 return ; (NO) - done
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
287 option_save_string:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
288 movff POSTINC1,EEDATA ; write one byte
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
289 btfss EEADRH,1 ; EEADR:EEADRH < 512 ?
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
290 call write_eeprom ; YES - write
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
291 infsnz EEADR,F ; (NO) - increment EEPROM address
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
292 incf EEADRH,F ; - ...
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
293 decfsz opt_max ; - decrement string length, done?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
294 bra option_save_string ; NO - loop
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
295 return ; YES
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
296
0
heinrichsweikamp
parents:
diff changeset
297 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
298
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
299 global option_restore_all ; restore options from EEPROM
0
heinrichsweikamp
parents:
diff changeset
300 option_restore_all:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
301 ;---- Read option serial from EEPROM
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
302 movlw LOW(eeprom_serial_save)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
303 movwf EEADR
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
304 movlw HIGH(eeprom_serial_save)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
305 movf EEADRH
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
306 call read_eeprom
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
307 movlw LOW(eeprom_opt_serial)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
308 xorwf EEDATA,W
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
309 bnz option_restore_bad ; auto reset if changed
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
310 incf EEADR,F
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
311 call read_eeprom
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
312 movlw HIGH(eeprom_opt_serial)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
313 xorwf EEDATA,W
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
314 bz option_restore_ok ; auto reset if changed
0
heinrichsweikamp
parents:
diff changeset
315
heinrichsweikamp
parents:
diff changeset
316 option_restore_bad:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
317 call option_reset_all ; reset RAM contains
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
318 goto option_save_all ; then save to EEPROM
0
heinrichsweikamp
parents:
diff changeset
319
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
320 ;---- Proper restore
0
heinrichsweikamp
parents:
diff changeset
321 option_restore_ok:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
322 movlw LOW(option_table_begin)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
323 movwf FSR0L
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
324 movlw HIGH(option_table_begin)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
325 movwf FSR0H
0
heinrichsweikamp
parents:
diff changeset
326
heinrichsweikamp
parents:
diff changeset
327 option_restore_all_1:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
328 movlw LOW(option_table_end)
562
8b7ea27ea1fa seperate desat and sat multipliers for GF and Non-GF modes. Set to 100/100 as default in GF mode
heinrichsweikamp
parents: 560
diff changeset
329 cpfseq FSR0L
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
330 bra option_restore_all_2 ; not yet done...
562
8b7ea27ea1fa seperate desat and sat multipliers for GF and Non-GF modes. Set to 100/100 as default in GF mode
heinrichsweikamp
parents: 560
diff changeset
331 movlw HIGH(option_table_end)
8b7ea27ea1fa seperate desat and sat multipliers for GF and Non-GF modes. Set to 100/100 as default in GF mode
heinrichsweikamp
parents: 560
diff changeset
332 cpfseq FSR0H
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
333 bra option_restore_all_2 ; not yet done...
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
334 return ; all done
562
8b7ea27ea1fa seperate desat and sat multipliers for GF and Non-GF modes. Set to 100/100 as default in GF mode
heinrichsweikamp
parents: 560
diff changeset
335 option_restore_all_2:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
336 rcall option_restore ; Restore one option
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
337 bra option_restore_all_1 ; and loop
0
heinrichsweikamp
parents:
diff changeset
338
heinrichsweikamp
parents:
diff changeset
339 option_restore:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
340 rcall option_read
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
341 incf opt_eeprom,W ; shall we save it ?
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
342 btfsc STATUS,Z ; EEPROM address is FFh ?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
343 return ; YES - nothing to do.
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
344 movf opt_eeprom,W ; compute backup address in EEPROM
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
345 addlw LOW(eeprom_opt_backup) ; add offset
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
346 movwf EEADR
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
347 movlw HIGH(eeprom_opt_backup)
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
348 btfsc STATUS,C ; > 256 ?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
349 addlw .1 ; YES - +1
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
350 movwf EEADRH
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
351 movf opt_type,W ; get option type
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
352 xorlw 2 ; Option type is string?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
353 bz option_restore_string ; YES
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
354 call read_eeprom ; read one byte from EEPROM
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
355 movff EEDATA, INDF1 ; restore option register
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
356 return
0
heinrichsweikamp
parents:
diff changeset
357 option_restore_string:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
358 call read_eeprom ; read one byte, and...
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
359 movff EEDATA,POSTINC1 ; ... restore it
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
360 infsnz EEADR,F
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
361 incf EEADRH,F
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
362 decfsz opt_max ; decrement string length
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
363 bra option_restore_string ; loop while not finished
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
364 return
0
heinrichsweikamp
parents:
diff changeset
365
heinrichsweikamp
parents:
diff changeset
366 ;=============================================================================
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
367 ; Increment an option, based on type, and boundary
0
heinrichsweikamp
parents:
diff changeset
368 ; INPUT: FSR0 = option handle
heinrichsweikamp
parents:
diff changeset
369 ; OUTPUT: none
heinrichsweikamp
parents:
diff changeset
370 ; TRASH: TBLPTR, TABLAT, WREG, FSR0, FSR1
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
371 ;
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
372 global option_inc ; increment FSR0 option
0
heinrichsweikamp
parents:
diff changeset
373 option_inc:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
374 ; read type, default and register from table
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
375 rcall option_read
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
376
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
377 ; switch on type
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
378 movf opt_type,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
379 bz option_inc_uint8
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
380 dcfsnz WREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
381 bra option_inc_enum8
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
382 dcfsnz WREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
383 bra option_inc_string
0
heinrichsweikamp
parents:
diff changeset
384
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
385 option_inc_uint8: ; default type too...
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
386 movf INDF1,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
387 addwf opt_inc,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
388 cpfslt opt_max
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
389 bra option_inc_uint8_0
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
390 movf opt_min,W
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
391 option_inc_uint8_0:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
392 movwf INDF1
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
393 option_inc_uint8_1:
533
dfac393b2199 CHANGE: CCR Calibration gas range limited to O2% 21-25 and 95-100 to save button presses
heinrichsweikamp
parents: 418
diff changeset
394 ; Now some rather crude hack into this routine to make CCR Calibration more convenient:
608
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
395 movlw .149 ; EEPROM address of option CalGasO2
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
396 cpfseq opt_eeprom ; editing CalGasO2 right now?
608
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
397 bra option_inc_uint8_2 ; NO - check next option
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
398 movff opt_dive_mode,WREG ; YES - get dive mode: 0=OC, 1=CC, 2=Gauge, 3=Apnea, 4=pSCR
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
399 decfsz WREG,W ; - in CCR mode?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
400 return ; NO - done
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
401 movlw .26 ; YES -
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
402 cpfseq INDF1 ; - option value = 26 ?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
403 return ; NO - done
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
404 movlw .95 ; YES - advance it to 95
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
405 movwf INDF1 ; - store it
533
dfac393b2199 CHANGE: CCR Calibration gas range limited to O2% 21-25 and 95-100 to save button presses
heinrichsweikamp
parents: 418
diff changeset
406 return
608
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
407 option_inc_uint8_2:
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
408 movlw .12 ; EEPROM address of option opt_GF_low
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
409 cpfseq opt_eeprom ; editing opt_GF_low right now?
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
410 bra option_inc_uint8_3 ; NO - check next option
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
411 movff opt_GF_high,WREG ; get value of associated GF high into WREG
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
412 cpfsgt INDF1 ; GF low > GF high?
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
413 return ; NO - setting ok, done
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
414 movff opt_min,INDF1 ; YES - wrap around to minimum value
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
415 return ; - done
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
416 option_inc_uint8_3:
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
417 movlw .13 ; EEPROM address of option opt_GF_high
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
418 cpfseq opt_eeprom ; editing opt_GF_high right now?
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
419 bra option_inc_uint8_4 ; NO - check next option
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
420 movff opt_GF_low,WREG ; get value of associated GF low into WREG
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
421 cpfslt INDF1 ; GF high < GF low?
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
422 return ; NO - setting ok, done
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
423 movwf INDF1 ; YES - rise GF high to GF low
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
424 return ; - done
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
425 option_inc_uint8_4:
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
426 movlw .17 ; EEPROM address of option opt_aGF_low
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
427 cpfseq opt_eeprom ; editing opt_aGF_low right now?
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
428 bra option_inc_uint8_5 ; NO - check next option
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
429 movff opt_aGF_high,WREG ; get value of associated GF high into WREG
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
430 cpfsgt INDF1 ; GF low > GF high?
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
431 return ; NO - setting ok, done
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
432 movff opt_min,INDF1 ; YES - wrap around to minimum value
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
433 return ; - done
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
434 option_inc_uint8_5:
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
435 movlw .18 ; EEPROM address of option opt_aGF_high
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
436 cpfseq opt_eeprom ; editing opt_aGF_high right now?
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
437 bra option_inc_uint8_6 ; NO - check next option
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
438 movff opt_aGF_low,WREG ; get value of associated GF low into WREG
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
439 cpfslt INDF1 ; GF high < GF low?
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
440 return ; NO - setting ok, done
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
441 movwf INDF1 ; YES - rise GF high to GF low
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
442 return ; - done
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
443 option_inc_uint8_6:
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
444 return ; all done
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
445
0
heinrichsweikamp
parents:
diff changeset
446
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
447 option_inc_enum8: ; always +1
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
448 incf INDF1,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
449 cpfsgt opt_max
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
450 clrf WREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
451 movwf INDF1
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
452 option_inc_enum8_1:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
453 IFDEF _ccr_pscr
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
454 ; Now some rather crude hack into this routine to unify CCR & pSCR mode setting
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
455 movlw .25 ; EEPROM address of option oCCRMode
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
456 cpfseq opt_eeprom ; editing oCCRMode right now?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
457 bra option_inc_enum8_2 ; NO - check next option
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
458 IFDEF _external_sensor
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
459 btfsc analog_o2_input ; YES - does hosting OSTC have an analog interface?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
460 bra option_inc_enum8_1a ; YES - setting 'sensor' allowed
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
461 btfsc optical_input ; does hosting OSTC have an optical interface?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
462 bra option_inc_enum8_1a ; YES - setting 'sensor' allowed
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
463 ENDIF ; _external_sensor
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
464 movf INDF1,W ; NO to both - get mode (=0: fixed SP, =1: Sensor, =2: AutoSP)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
465 xorlw .1 ; - in sensor mode?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
466 bnz option_inc_enum8_1a ; NO - continue with next check
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
467 incf INDF1,F ; YES - advance option value to AutoSP
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
468 option_inc_enum8_1a:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
469 movff opt_dive_mode,WREG ; get dive mode: 0=OC, 1=CCR, 2=Gauge, 3=Apnea, 4=pSCR
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
470 xorlw .4 ; in pSCR mode?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
471 bnz option_inc_enum8_1_exit ; NO - done
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
472 bcf INDF1,1 ; YES - clear bit 1 because opt_ccr_mode may only be 0 or 1 (reverts AutoSP to calculated SP)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
473 option_inc_enum8_1_exit:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
474 return ; done
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
475 ENDIF ; _ccr_pscr
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
476 option_inc_enum8_2:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
477 ; (unused)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
478 option_inc_enum8_3:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
479 ; Now some rather crude hack to correct opt_TR_mode in dependency of opt_dive_mode
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
480 movlw .8 ; EEPROM address of option opt_dive_mode
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
481 cpfseq opt_eeprom ; editing opt_dive_mode right now?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
482 bra option_inc_enum8_4 ; NO - check next option
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
483 movf INDF1,W ; YES - get option value: 0=OC, 1=CCR, 2=Gauge, 3=Apnea, 4=pSCR
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
484 xorlw .1 ; in CCR mode?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
485 bnz option_inc_enum8_3a ; NO - in some other mode
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
486 IFNDEF _ccr_pscr
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
487 incf INDF1,f ; YES - no CCR mode compiled in, advance to gauge mode
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
488 bra option_inc_enum8_3a ; - check if gauge mode is available
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
489 ENDIF ; _ccr_pscr
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
490 IFDEF _rx_functions
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
491 global option_cleanup_oTrMode_CCR ; embedded clean-up entry-point
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
492 option_cleanup_oTrMode_CCR: ; entry point from cleanup during restart
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
493 movff opt_TR_mode,WREG ; get TR mode
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
494 xorlw .2 ; mode = 2 (ind.double)?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
495 bnz option_inc_enum8_3_exit ; NO - done
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
496 bra option_inc_enum8_3_reset ; YES - revert mode to 1 (on)
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
497 ENDIF ; _rx_functions
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
498 option_inc_enum8_3a: ; any mode other than CCR
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
499 IFNDEF _gauge_mode
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
500 movf INDF1,W ; get option value: 0=OC, 1=CCR, 2=Gauge, 3=Apnea, 4=pSCR
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
501 xorlw .2 ; in Gauge mode?
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
502 bnz option_inc_enum8_3b ; NO - in some other mode
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
503 incf INDF1,f ; YES - no Gauge mode compiled in, advance to Apnea mode
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
504 bra option_inc_enum8_3_exit ; - done (Apnea mode is always available)
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
505 ENDIF ; _gauge_mode
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
506 option_inc_enum8_3b:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
507 IFNDEF _ccr_pscr
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
508 movf INDF1,W ; get option value: 0=OC, 1=CCR, 2=Gauge, 3=Apnea, 4=pSCR
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
509 xorlw .4 ; in pSCR mode?
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
510 bnz option_inc_enum8_3c ; NO - in some other mode
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
511 clrf INDF1 ; YES - no pSCR mode compiled in, advance to 0 "OC"
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
512 bra option_inc_enum8_3_exit ; - done
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
513 ENDIF ; _ccr_pscr
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
514 option_inc_enum8_3c:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
515 global option_cleanup_oTrMode_no_CCR ; embedded clean-up entry-point
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
516 option_cleanup_oTrMode_no_CCR: ; entry point from cleanup during restart
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
517 movff opt_TR_mode,WREG ; get TR mode
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
518 xorlw .3 ; mode = 3 (CCR Dil+O2)?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
519 bnz option_inc_enum8_3_exit ; NO - done
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
520 option_inc_enum8_3_reset: ; YES - revert to mode 1 (on)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
521 movlw .1 ; load coding of mode "on"
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
522 movff WREG,opt_TR_mode ; write to option
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
523 option_inc_enum8_3_exit:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
524 return ; done
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
525
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
526 option_inc_enum8_4:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
527 IFDEF _rx_functions
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
528 ; Now some rather crude hack to advance opt_TR_mode in dependency of opt_dive_mode
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
529 movlw .222 ; EEPROM address of option opt_TR_mode
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
530 cpfseq opt_eeprom ; editing opt_TR_mode right now?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
531 bra option_inc_enum8_5 ; NO - check next option
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
532 movff opt_dive_mode,WREG ; YES - get dive mode: 0=OC, 1=CCR, 2=Gauge, 3=Apnea, 4=pSCR
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
533 decfsz WREG,W ; dive mode = 1 CCR?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
534 bra option_inc_enum8_4a ; NO - in any other mode
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
535 movf INDF1,W ; YES - get option value (TR mode)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
536 xorlw .2 ; - mode = 2 (ind.double)?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
537 bnz option_inc_enum8_4_exit ; NO - done
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
538 incf INDF1,F ; YES - advance option value to 3 (CCR Dil+O2)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
539 bra option_inc_enum8_4_exit ; - done
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
540 option_inc_enum8_4a: ; any mode other than CCR
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
541 movf INDF1,W ; get option value (TR mode)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
542 xorlw .3 ; mode = 3 (CCR Dil+O2)?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
543 bnz option_inc_enum8_4_exit ; NO - done
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
544 clrf INDF1 ; YES - advance option value to 0 "off"
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
545 option_inc_enum8_4_exit:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
546 return ; done
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
547 ENDIF ; _rx_functions
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
548 option_inc_enum8_5:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
549 return
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
550
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
551
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
552 option_inc_string: ; no editing available
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
553 return
0
heinrichsweikamp
parents:
diff changeset
554
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
555
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
556 IFNDEF _gauge_mode
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
557 option_cleanup_gauge:
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
558 movff opt_dive_mode,WREG ; get dive mode into WREG (0=OC, 1=CCR, 2=Gauge, 3=Apnea, 4=pSCR)
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
559 xorlw .2 ; in Gauge mode?
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
560 bnz option_cleanup_gauge_1 ; NO - done
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
561 banksel opt_dive_mode ; YES - setting not allowed, select options bank
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
562 clrf opt_dive_mode ; - reset to OC mode
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
563 banksel common ; - back to bank common
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
564 option_cleanup_gauge_1:
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
565 return ; done
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
566 ENDIF
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
567
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
568
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
569 IFDEF _ccr_pscr
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
570 global option_cleanup_oCCRMode
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
571 global option_cleanup_oCCRMode_pSCR
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
572 global option_cleanup_oCCRMode_CCR
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
573 option_cleanup_oCCRMode: ; in pSCR mode, revert AutoSP (2) to calculated SP (0), in pSCR and CCR revert Sensor to fixed SP if no sensor interface available
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
574 movff opt_dive_mode,WREG ; get dive mode into WREG (0=OC, 1=CCR, 2=Gauge, 3=Apnea, 4=pSCR)
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
575 xorlw .4 ; in pSCR mode?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
576 bnz option_cleanup_oCCRMode_CCR ; NO - check if sensor is available on hosting OSTC
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
577 option_cleanup_oCCRMode_pSCR: ; jump-in from start.asm if known to be in pSCR mode
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
578 banksel opt_ccr_mode ; YES - select options bank
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
579 bcf opt_ccr_mode,1 ; - clear bit 1 because opt_ccr_mode may only be 0 or 1 (reverts AutoSP to calculated SP, keeps sensor)
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
580 banksel common ; - back to bank common
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
581 bsf option_repaired ; - flag that an option was repaired
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
582 option_cleanup_oCCRMode_CCR: ; continue from above & jump-in from start.asm if known to be in CCR mode
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
583 IFDEF _external_sensor
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
584 btfsc analog_o2_input ; analog interface available?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
585 return ; YES - setting 'sensor' allowed
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
586 btfsc optical_input ; does hosting OSTC have an optical interface?
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
587 return ; YES - setting 'sensor' allowed
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
588 ENDIF
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
589 movff opt_ccr_mode,WREG ; NO to both - get CCR mode
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
590 xorlw .1 ; - coding for sensor
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
591 tstfsz WREG ; - CCR mode = sensor?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
592 return ; NO - setting allowed
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
593 banksel opt_ccr_mode ; YES - setting not allowed, select options bank
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
594 clrf opt_ccr_mode ; - revert setting to 0 (fixed or calculated SP)
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
595 banksel common ; - back to bank common
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
596 bsf option_repaired ; - flag that an option was repaired
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
597 return ; - done
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
598 ENDIF ; _ccr_pscr
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
599
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
600
608
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
601 option_cleanup_GF:
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
602 ; cleanup normal GF
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
603 movff opt_GF_high,WREG ; copy normal GF high to WREG
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
604 movff opt_GF_low,mpr ; copy normal GF low to mpr
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
605 cpfsgt mpr ; GF low > GF high ?
608
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
606 bra option_cleanup_GF_2 ; NO - option ok, check next option
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
607 movwf mpr ; YES - copy GF high to mpr
608
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
608 movlw .100 ; - load GF low limit of 100% into WREG
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
609 cpfsgt mpr ; - mpr > 100 ?
608
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
610 bra option_cleanup_GF_1 ; NO - correct GF low to GF high
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
611 movwf mpr ; YES - correct GF low to 100%
608
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
612 option_cleanup_GF_1:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
613 movff mpr,opt_GF_low ; store corrected GF low
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
614 bsf option_repaired ; flag that an option was repaired
608
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
615 option_cleanup_GF_2:
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
616 ; cleanup alternative GF
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
617 movff opt_aGF_high,WREG ; copy alternative GF high to WREG
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
618 movff opt_aGF_low,mpr ; copy alternative GF low to mpr
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
619 cpfsgt mpr ; GF low > GF high ?
608
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
620 bra option_cleanup_GF_4 ; NO - option ok, check next option
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
621 movwf mpr ; YES - copy GF high to mpr
608
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
622 movlw .100 ; - load GF low limit of 100% into WREG
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
623 cpfsgt mpr ; - mpr > 100 ?
608
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
624 bra option_cleanup_GF_3 ; NO - correct GF low to GF high
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
625 movwf mpr ; YES - correct GF low to 100%
608
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
626 option_cleanup_GF_3:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
627 movff mpr,opt_aGF_low ; store corrected GF low
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
628 bsf option_repaired ; flag that an option was repaired
608
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
629 option_cleanup_GF_4:
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
630 return ; done
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
631
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
632
0
heinrichsweikamp
parents:
diff changeset
633 ;=============================================================================
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
634 ; Strcat option into FSR2 buffer
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
635 ;
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
636 global option_draw ; STRCAT FRS0 option
0
heinrichsweikamp
parents:
diff changeset
637 option_draw:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
638 ; Read type, default and register from table
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
639 rcall option_read
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
640
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
641 ; Switch on type
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
642 movf opt_type,W
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
643 bz option_draw_uint8 ; type0 = INT8
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
644 dcfsnz WREG
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
645 bra option_draw_enum8 ; type1 = ENUM
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
646 dcfsnz WREG
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
647 bra option_draw_string ; type2 = string
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
648 dcfsnz WREG
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
649 bra option_draw_uint8_depth ; type3 = INT8 with automatic display in meters or feet
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
650 return ; unknown, return
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
651
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
652 option_draw_string:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
653 movff POSTINC1,POSTINC2
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
654 decfsz opt_max
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
655 bra option_draw_string
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
656 return
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
657
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
658 option_draw_uint8_depth:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
659 TSTOSS opt_units ; using metric units (0=m, 1=ft)?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
660 bra option_draw_uint8 ; YES - handle with standard output
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
661 movff INDF1,lo ; NO - imperial, get value to lo
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
662 call convert_meter_to_feet ; - convert value in lo from meter to feet
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
663 bsf leftbind ; - print with left alignment
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
664 output_16_3 ; - display only last three digits from a 16 bit value (0-999)
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
665 bcf leftbind ; - back to normal alignment
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
666 STRCAT_TEXT tFeets ; - print unit
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
667 bra option_draw_uint8_common ; - continue with common part
0
heinrichsweikamp
parents:
diff changeset
668
heinrichsweikamp
parents:
diff changeset
669 option_draw_uint8:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
670 movff INDF1,lo ; draw value
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
671 bsf leftbind
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
672 output_8
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
673 bcf leftbind
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
674 clrf INDF2 ; make sure to close string
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
675 movf opt_unit+0,W ; is there a unit to append?
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
676 iorwf opt_unit+1,W
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
677 rcall option_draw_unit ; YES
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
678 option_draw_uint8_common:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
679 movf opt_default,W ; get default value
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
680 cpfseq lo ; compare with current value, equal?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
681 bra option_draw_uint8_2 ; NO - not default, add *
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
682 return ; YES - default, done
0
heinrichsweikamp
parents:
diff changeset
683 option_draw_uint8_2:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
684 PUTC "*" ; print "*"
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
685 return ; done
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
686
0
heinrichsweikamp
parents:
diff changeset
687 option_draw_unit:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
688 movff opt_unit+0,FSR1L
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
689 movff opt_unit+1,FSR1H
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 562
diff changeset
690 goto strcat_text
0
heinrichsweikamp
parents:
diff changeset
691
heinrichsweikamp
parents:
diff changeset
692
heinrichsweikamp
parents:
diff changeset
693 ;---- Draw an enumerated value (set of translated strings)
heinrichsweikamp
parents:
diff changeset
694 option_draw_enum8:
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
695 movff INDF1,lo ; memorize current value
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
696 movf INDF1,W ; copy current value to WREG
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
697 cpfsgt opt_max ; max value (= highest usable value + 1) > current value?
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
698 clrf WREG ; NO - to avoid printing rubbish, reset to first value
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
699 addwf WREG ; current value *= 2
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
700 addwf opt_inc,W ; base text + 2 * current value
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
701 movwf FSR1L ; load FSR0
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
702 movlw .0 ; propagate carry...
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
703 addwfc opt_min,W ; ...
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
704 movwf FSR1H ; ...into FSR1
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
705 call strcat_text ; print text
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
706 movf opt_default,W ; get default value
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
707 cpfseq lo ; compare with memorized current value, equal?
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
708 bra option_draw_enum8_1 ; NO - not default, add *
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
709 return ; YES - default, done
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
710 option_draw_enum8_1:
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
711 PUTC "*" ; print "*"
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
712 return ; done
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
713
0
heinrichsweikamp
parents:
diff changeset
714
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
715 ;-----------------------------------------------------------------------------
0
heinrichsweikamp
parents:
diff changeset
716
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
717 END