annotate code_part1/OSTC_code_asm_part1/menu_battery.asm @ 105:64109f6fb3d1

added END to GasSetup, small fixes
author heinrichsweikamp
date Sun, 19 Dec 2010 14:27:30 +0100
parents 96a35aeda5f2
children 6a94f96e9cea
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
2 ; OSTC - diving computer code
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
3 ; Copyright (C) 2008 HeinrichsWeikamp GbR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
4
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
5 ; This program is free software: you can redistribute it and/or modify
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
6 ; it under the terms of the GNU General Public License as published by
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
7 ; the Free Software Foundation, either version 3 of the License, or
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
8 ; (at your option) any later version.
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
9
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
10 ; This program is distributed in the hope that it will be useful,
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
11 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
12 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
13 ; GNU General Public License for more details.
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
14
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
15 ; You should have received a copy of the GNU General Public License
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
16 ; along with this program. If not, see <http://www.gnu.org/licenses/>.
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
17
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
18
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
19 ; Submenu battery state
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
20 ; written by: Matthias Heinrichs, info@heinrichsweikamp.com
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
21 ; written: 05/15/08
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
22 ; last updated: 05/15/08
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
23 ; known bugs:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
24 ; ToDo:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
25
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
26 menu_battery_state:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
27 call PLED_ClearScreen
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
28 call PLED_topline_box
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
29 WIN_INVERT .1 ; Init new Wordprocessor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
30 DISPLAYTEXT .114 ; Battery Information
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
31 WIN_INVERT .0 ; Init new Wordprocessor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
32
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
33 WIN_TOP .35
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
34 WIN_LEFT .0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
35 WIN_FONT FT_SMALL
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
36
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
37 lfsr FSR2,letter
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
38 OUTPUTTEXT .115 ; Cycles:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
39 read_int_eeprom d'50' ; Get charge cycles
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
40 movff EEDATA,lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
41 read_int_eeprom d'51'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
42 movff EEDATA,hi
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
43 bsf leftbind
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
44 output_16
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
45 movlw ' '
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
46 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
47 movlw '('
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
48 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
49 read_int_eeprom d'52' ; Get complete cycles
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
50 movff EEDATA,lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
51 read_int_eeprom d'53'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
52 movff EEDATA,hi
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
53 bsf leftbind
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
54 output_16
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
55 movlw ')'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
56 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
57 call word_processor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
58
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
59 WIN_TOP .65
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
60 lfsr FSR2,letter
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
61 OUTPUTTEXT .117 ; Last Complete at:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
62 read_int_eeprom d'47' ; Month
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
63 movff EEDATA,convert_value_temp+0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
64 read_int_eeprom d'48' ; Day
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
65 movff EEDATA,convert_value_temp+1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
66 read_int_eeprom d'49' ; Year
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
67 movff EEDATA,convert_value_temp+2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
68 call PLED_convert_date ; coverts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
69 call word_processor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
70
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
71 WIN_TOP .95
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
72 lfsr FSR2,letter
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
73 OUTPUTTEXT .118 ; Lowest Battery:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
74 read_int_eeprom d'40' ; Batt LOW
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
75 movff EEDATA,lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
76 read_int_eeprom d'41' ; Batt HIGH
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
77 movff EEDATA,hi
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
78 movlw d'1'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
79 movwf ignore_digits
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
80 bsf leftbind
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
81 output_16dp d'2'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
82 bcf leftbind
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
83 movlw 'V'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
84 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
85 call word_processor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
86
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
87 WIN_TOP .125
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
88 lfsr FSR2,letter
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
89 OUTPUTTEXT .119 ; Lowest Battery at:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
90 read_int_eeprom d'42' ; Month
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
91 movff EEDATA,convert_value_temp+0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
92 read_int_eeprom d'43' ; Day
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
93 movff EEDATA,convert_value_temp+1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
94 read_int_eeprom d'44' ; Year
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
95 movff EEDATA,convert_value_temp+2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
96 call PLED_convert_date ; coverts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
97 call word_processor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
98
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
99 WIN_TOP .155
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
100 lfsr FSR2,letter
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
101 OUTPUTTEXT .120 ; Temp min:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
102 read_int_eeprom d'54' ; TEMP_min LOW
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
103 movff EEDATA,lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
104 read_int_eeprom d'55' ; TEMP_min HIGH
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
105 movff EEDATA,hi
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
106 movlw d'3'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
107 movwf ignore_digits
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
108 bsf leftbind ; left orientated output
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
109 output_16dp d'2'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
110 bcf leftbind
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
111 movlw '°'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
112 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
113 movlw ' '
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
114 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
115 movlw '('
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
116 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
117 read_int_eeprom d'56' ; Month
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
118 movff EEDATA,convert_value_temp+0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
119 read_int_eeprom d'57' ; Day
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
120 movff EEDATA,convert_value_temp+1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
121 read_int_eeprom d'58' ; Year
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
122 movff EEDATA,convert_value_temp+2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
123 call PLED_convert_date ; coverts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
124 movlw ')'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
125 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
126 movlw ' '
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
127 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
128 call word_processor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
129
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
130 WIN_TOP .185
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
131 lfsr FSR2,letter
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
132 OUTPUTTEXT .121 ; Temp max:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
133 read_int_eeprom d'59' ; TEMP_max LOW
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
134 movff EEDATA,lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
135 read_int_eeprom d'60' ; TEMP_max HIGH
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
136 movff EEDATA,hi
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
137 movlw d'3'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
138 movwf ignore_digits
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
139 bsf leftbind ; left orientated output
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
140 output_16dp d'2'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
141 bcf leftbind
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
142 movlw '°'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
143 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
144 movlw ' '
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
145 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
146 movlw '('
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
147 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
148 read_int_eeprom d'61' ; Month
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
149 movff EEDATA,convert_value_temp+0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
150 read_int_eeprom d'62' ; Day
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
151 movff EEDATA,convert_value_temp+1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
152 read_int_eeprom d'63' ; Year
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
153 movff EEDATA,convert_value_temp+2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
154 call PLED_convert_date ; coverts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
155 movlw ')'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
156 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
157 movlw ' '
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
158 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
159 call word_processor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
160
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
161 menu_battery_state5:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
162 btfss SWITCH2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
163 bra menu_battery_state5
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
164
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
165 bcf switch_left
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
166 bcf switch_right
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
167 bcf menubit2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
168 menu_battery_state_loop:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
169 call check_switches_logbook
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
170
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
171 btfsc menubit2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
172 bra menu_battery_state_exit ; Exit
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
173
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
174 btfsc divemode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
175 goto restart ; dive started!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
176
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
177 btfsc onesecupdate
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
178 call timeout_surfmode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
179
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
180 btfsc onesecupdate
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
181 call set_dive_modes
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
182
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
183 bcf onesecupdate ; 1 sec. functions done
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
184
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
185 btfsc sleepmode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
186 bra menu_battery_state_exit
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
187
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
188 bra menu_battery_state_loop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
189
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
190 menu_battery_state_exit: ; exit...
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
191 movlw d'3'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
192 movwf menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
193 goto more_menu2