3 ; Copyright (C) 2010 Leo C.
5 ; This file is part of avrcpm.
7 ; avrcpm is free software: you can redistribute it and/or modify it
8 ; under the terms of the GNU General Public License as published by
9 ; the Free Software Foundation, either version 3 of the License, or
10 ; (at your option) any later version.
12 ; avrcpm is distributed in the hope that it will be useful,
13 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ; GNU General Public License for more details.
17 ; You should have received a copy of the GNU General Public License
18 ; along with avrcpm. If not, see <http://www.gnu.org/licenses/>.
34 ; don't change order here, clock put/get depends on it.
35 cntms_out: ; register for ms
37 utime_io: ; register for uptime.
44 .equ timer_size = timer_top - timer_base
46 .equ utofs = cnt_1ms-cntms_out
47 .equ timerofs = cnt_1ms-timer_ms
52 .byte 6 ;Format (bin): Y M D H M S
53 .equ clkofs = clock-clk_out
57 ; ------------- system timer 1ms ---------------
60 ; Timer/Counter1 Compare Match B interrupt
74 #if DRAM_8BIT /* Implies software uart */
100 ldi zl,high(1000) ;doesn't change flags
146 ldiw z,dayspm_tab*2 - 1
147 lds temp,clock+1 ;month
150 lpm zh,z ;days this month
152 brne syscl_clknf ;february, may be leap year
153 lds zl,(clock+0) ;year
188 .db 31,28,31,30,31,30
189 .db 31,31,30,31,30,31
191 ; ----------------------------------------------
198 sts delay_timer1,temp
200 lds temp,delay_timer1
205 ; ----------------------------------------------
211 brcs clkget_end ;Port number in range?
213 breq clkget_copy ;lowest byte requestet, latch clock
215 brsh clkget_end ;Port number to high?
239 brcs clkput_end ;Port number in range?
242 breq clkput_copy ;lowest byte requestet, latch clock
244 brsh clkput_end ;Port number to high?
266 ; ----------------------------------------------
271 subi temp2,TIMER_MSECS
272 brcs utimget_end ;Port number in range?
274 breq utimget_copy ;lowest byte requestet, latch clock
276 brsh utimget_end ;Port number to high?
301 brcs utput__end ;Port number in range?
306 cpi temp,starttimercmd
308 cpi temp,quitTimerCmd
310 cpi temp,printTimerCmd
325 breq utput__copy ;lowest byte requestet, latch clock
327 brsh utput__end ;Port number to high?
372 ; put ms on stack (16 bit)
407 printstring "Timer running. Elapsed: "
439 printstring "Uptime: "
453 ; vim:set ts=8 noet nowrap