Mercurial > public > mk2
comparison code_part1/OSTC_code_asm_part1/menu_settime.asm @ 0:96a35aeda5f2
Initial setup
author | heinrichsweikamp |
---|---|
date | Tue, 12 Jan 2010 15:05:59 +0100 |
parents | |
children | c97c5514b165 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:96a35aeda5f2 |
---|---|
1 | |
2 ; OSTC - diving computer code | |
3 ; Copyright (C) 2008 HeinrichsWeikamp GbR | |
4 | |
5 ; This program is free software: you can redistribute it and/or modify | |
6 ; it under the terms of the GNU General Public License as published by | |
7 ; the Free Software Foundation, either version 3 of the License, or | |
8 ; (at your option) any later version. | |
9 | |
10 ; This program is distributed in the hope that it will be useful, | |
11 ; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 ; GNU General Public License for more details. | |
14 | |
15 ; You should have received a copy of the GNU General Public License | |
16 ; along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | |
18 | |
19 ; menu "Set Time" | |
20 ; written by: Matthias Heinrichs, info@heinrichsweikamp.com | |
21 ; written: 5/19/06 | |
22 ; last updated: 080904 | |
23 ; known bugs: | |
24 ; ToDo: | |
25 | |
26 | |
27 menu_settime: | |
28 call PLED_ClearScreen | |
29 | |
30 bcf set_minutes | |
31 bcf menubit4 | |
32 bcf cursor | |
33 clrf timeout_counter2 | |
34 bcf menubit2 | |
35 bcf menubit3 | |
36 bcf sleepmode | |
37 bcf set_year | |
38 bcf set_day | |
39 bcf set_month | |
40 clrf menupos2 | |
41 | |
42 call PLED_topline_box | |
43 WIN_INVERT .1 ; Init new Wordprocessor | |
44 DISPLAYTEXT .29 ; Set Time | |
45 WIN_INVERT .0 ; Init new Wordprocessor | |
46 DISPLAYTEXT .22 ; Time: | |
47 DISPLAYTEXT .23 ; Date: | |
48 | |
49 call set_time_refresh | |
50 | |
51 DISPLAYTEXT .24 ; Set Hours | |
52 | |
53 bcf switch_left | |
54 bcf switch_right | |
55 | |
56 settime_loop: | |
57 btfsc switch_left | |
58 call add_hours_or_minutes_or_date | |
59 | |
60 btfsc switch_right | |
61 call set_time_next_or_exit | |
62 | |
63 btfsc menubit4 | |
64 bra set_time_done | |
65 | |
66 btfsc onesecupdate | |
67 call timeout_surfmode | |
68 | |
69 btfsc onesecupdate | |
70 call set_dive_modes | |
71 | |
72 bcf onesecupdate | |
73 | |
74 btfsc sleepmode | |
75 bra exit_settime | |
76 | |
77 btfsc divemode | |
78 goto restart | |
79 | |
80 bra settime_loop | |
81 | |
82 set_time_refresh: | |
83 WIN_LEFT .70 | |
84 WIN_TOP .65 | |
85 lfsr FSR2,letter | |
86 movff hours,lo | |
87 output_99x | |
88 movlw ':' | |
89 movwf POSTINC2 | |
90 movff mins,lo | |
91 output_99x | |
92 movlw ' ' | |
93 movwf POSTINC2 | |
94 movlw ' ' | |
95 movwf POSTINC2 | |
96 call word_processor | |
97 | |
98 set_date_refresh: | |
99 WIN_LEFT .70 | |
100 WIN_TOP .95 | |
101 lfsr FSR2,letter | |
102 movff month,convert_value_temp+0 | |
103 movff day,convert_value_temp+1 | |
104 movff year,convert_value_temp+2 | |
105 call PLED_convert_date ; converts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2 | |
106 movlw ' ' | |
107 movwf POSTINC2 | |
108 movlw ' ' | |
109 movwf POSTINC2 | |
110 call word_processor | |
111 return | |
112 | |
113 | |
114 set_time_done: ; Check date | |
115 movff month,lo ; new month | |
116 dcfsnz lo,F | |
117 movlw .31 | |
118 dcfsnz lo,F | |
119 movlw .28 | |
120 dcfsnz lo,F | |
121 movlw .31 | |
122 dcfsnz lo,F | |
123 movlw .30 | |
124 dcfsnz lo,F | |
125 movlw .31 | |
126 dcfsnz lo,F | |
127 movlw .30 | |
128 dcfsnz lo,F | |
129 movlw .31 | |
130 dcfsnz lo,F | |
131 movlw .31 | |
132 dcfsnz lo,F | |
133 movlw .30 | |
134 dcfsnz lo,F | |
135 movlw .31 | |
136 dcfsnz lo,F | |
137 movlw .30 | |
138 dcfsnz lo,F | |
139 movlw .31 | |
140 cpfsgt day ; day ok? | |
141 bra set_time_done2 ; OK | |
142 movlw .1 ; not OK, set to 1st | |
143 movwf day | |
144 | |
145 set_time_done2: | |
146 WIN_LEFT .32 | |
147 WIN_TOP .155 | |
148 movlw d'8' | |
149 movwf temp1 | |
150 call PLED_display_clear_common_y1 | |
151 | |
152 movlw d'5' | |
153 movwf wait_temp | |
154 clrf secs | |
155 bcf onesecupdate | |
156 | |
157 set_time_done_loop | |
158 btfss onesecupdate | |
159 bra set_time_done_loop | |
160 bcf onesecupdate | |
161 | |
162 call set_date_refresh | |
163 | |
164 WIN_LEFT .70 | |
165 WIN_TOP .65 | |
166 lfsr FSR2,letter | |
167 movff hours,lo | |
168 output_99x | |
169 movlw ':' | |
170 movwf POSTINC2 | |
171 movff mins,lo | |
172 output_99x | |
173 movlw ':' | |
174 movwf POSTINC2 | |
175 movff secs,lo | |
176 output_99x | |
177 movlw ' ' | |
178 movwf POSTINC2 | |
179 call word_processor | |
180 | |
181 decfsz wait_temp,F | |
182 bra set_time_done_loop | |
183 exit_settime: ;Exit | |
184 movlw d'1' | |
185 movwf menupos | |
186 goto more_menu2 | |
187 | |
188 | |
189 set_time_next_or_exit: | |
190 btfsc set_year | |
191 bsf menubit4 ; quit settime | |
192 incf menupos2,F | |
193 movff menupos2,menupos3 | |
194 | |
195 dcfsnz menupos3,F | |
196 bsf set_minutes | |
197 dcfsnz menupos3,F | |
198 bsf set_month | |
199 dcfsnz menupos3,F | |
200 bsf set_day | |
201 dcfsnz menupos3,F | |
202 bsf set_year | |
203 | |
204 WIN_LEFT .32 | |
205 WIN_TOP .155 | |
206 lfsr FSR2,letter | |
207 OUTPUTTEXT .94 ; Set | |
208 | |
209 movff menupos2,menupos3 | |
210 decfsz menupos3,F | |
211 bra set_time_next_or_exit2 | |
212 OUTPUTTEXT .90 ; Minutes | |
213 bra set_time_next_or_exit5 | |
214 set_time_next_or_exit2: | |
215 decfsz menupos3,F | |
216 bra set_time_next_or_exit3 | |
217 OUTPUTTEXT .91 ; Month | |
218 bra set_time_next_or_exit5 | |
219 set_time_next_or_exit3: | |
220 decfsz menupos3,F | |
221 bra set_time_next_or_exit4 | |
222 OUTPUTTEXT .92 ; Day | |
223 bra set_time_next_or_exit5 | |
224 set_time_next_or_exit4: | |
225 OUTPUTTEXT .93 ; Year | |
226 | |
227 set_time_next_or_exit5: | |
228 call word_processor | |
229 call wait_switches ; Waits until switches are released, resets flag if button stays pressed! | |
230 return | |
231 | |
232 | |
233 add_hours_or_minutes_or_date: | |
234 bcf switch_right | |
235 clrf secs | |
236 | |
237 btfsc set_year | |
238 bra add_year | |
239 | |
240 btfsc set_day | |
241 bra add_day | |
242 | |
243 btfsc set_month | |
244 bra add_month | |
245 | |
246 btfsc set_minutes | |
247 bra add_minutes | |
248 ; Also Stunden erhöhen | |
249 add_hours: | |
250 incf hours,F | |
251 movlw d'23' | |
252 cpfsgt hours | |
253 bra set_time_refresh_x | |
254 clrf hours | |
255 bra set_time_refresh_x | |
256 add_minutes: | |
257 incf mins,F | |
258 movlw d'59' | |
259 cpfsgt mins | |
260 bra set_time_refresh_x | |
261 clrf mins | |
262 bra set_time_refresh_x | |
263 add_day: | |
264 incf day,F | |
265 movlw d'31' | |
266 cpfsgt day | |
267 bra set_time_refresh_x | |
268 movlw d'1' | |
269 movwf day | |
270 bra set_time_refresh_x | |
271 add_month: | |
272 incf month,F | |
273 movlw d'12' | |
274 cpfsgt month | |
275 bra set_time_refresh_x | |
276 movlw d'1' | |
277 movwf month | |
278 bra set_time_refresh_x | |
279 add_year: | |
280 incf year,F | |
281 movlw d'20' ; calendar until 2020 | |
282 cpfsgt year | |
283 bra set_time_refresh_x | |
284 movlw d'8' | |
285 movwf year ; Set Year to 2008 | |
286 | |
287 set_time_refresh_x: | |
288 call set_time_refresh | |
289 call wait_switches ; Waits until switches are released, resets flag if button stays pressed! | |
290 return |