; Various functions: init, (RAM) disk, mmc, timer
;
; Copyright (C) 2010 Sprite_tm
; Copyright (C) 2010 Leo C.
;
; This file is part of avrcpm.
;
; avrcpm is free software: you can redistribute it and/or modify it
; under the terms of the GNU General Public License as published by
; the Free Software Foundation, either version 3 of the License, or
; (at your option) any later version.
;
; avrcpm is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with avrcpm. If not, see .
;
; $Id$
;
#define REFR_PRE 8 /* timer prescale factor 1/8 */
#define REFR_CS 0x02 /* timer clock select for 1/8 */
#define REFR_CNT F_CPU / REFR_RATE / REFR_PRE
.cseg
regval_tab:
.db 0,0
.db 0xFE,0xFC ; _RAS0 _CAS0
.db 0xF8,0xF4 ; _OE _WE
.db 255,0 ; _255 _0
regval_tab_e:
start:
ldi temp,low(RAMEND) ; top of memory
out SPL,temp ; init stack pointer
ldi temp,high(RAMEND) ; top of memory
out SPH,temp ; init stack pointer
; - Load some registers with constant values
ldiw z,regval_tab*2
ldiw y,0
cp_l: lpm xh,z+
st y+,xh
cpi zl,low(regval_tab_e*2)
brne cp_l
; - Kill wdt
wdr
out MCUSR,_0
ldi temp,(1<