Copyright update for 2011
[bcusdk.git] / bcu / lib / initbcu2.s
blobc39aa8c61b266e9b676bacfc188ad180499ce90c
1 # BCU SDK bcu development enviroment
2 # Copyright (C) 2005-2011 Martin Koegler <mkoegler@auto.tuwien.ac.at>
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2 of the License, or
7 # (at your option) any later version.
9 # In addition to the permissions in the GNU General Public License,
10 # you may link the compiled version of this file into combinations
11 # with other programs, and distribute those combinations without any
12 # restriction coming from the use of this file. (The General Public
13 # License restrictions do apply in other respects; for example, they
14 # cover modification of the file, and distribution when not linked into
15 # a combine executable.)
17 # This program is distributed in the hope that it will be useful,
18 # but WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 # GNU General Public License for more details.
22 # You should have received a copy of the GNU General Public License
23 # along with this program; if not, write to the Free Software
24 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 .section .register
27 .global SP
28 SP:
29 .byte 0
32 .section .init
33 .global _initstack
34 .global _initmem
35 _initmem:
36 clra
37 ldx $_bss_size
38 lp1:
39 beq wt1
40 sta %X,_bss_start-1
41 decx
42 bra lp1
43 wt1:
44 ldx $_bss_hi_size
45 lp1a:
46 beq wt1a
47 sta %X,_bss_hi_start-1
48 decx
49 bra lp1a
50 wt1a:
51 ldx $_data_size
52 lp2:
53 beq wt2
54 lda %X,_text_end-1
55 sta %X,_data_start-1
56 decx
57 bra lp2
58 wt2:
59 ldx $_data_hi_size
60 lp2a:
61 beq wt2a
62 lda %X,_data_hi_img-1
63 sta %X,_data_hi_start-1
64 decx
65 bra lp2a
66 wt2a:
67 jmp _initstack
68 _initstack:
69 lda $SPINIT
70 sta SP
71 rts