]> git.gag.com Git - fw/sdcc/blob - device/lib/mcs51/crtxinit.asm
* src/SDCCglue.c (emitMaps): allow public sfr variables
[fw/sdcc] / device / lib / mcs51 / crtxinit.asm
1 ; /*-------------------------------------------------------------------------
2
3 ;   crtxinit.asm :- C run-time: copy XINIT to XISEG
4
5 ;    This library is free software; you can redistribute it and/or modify it
6 ;    under the terms of the GNU Library General Public License as published by the
7 ;    Free Software Foundation; either version 2, or (at your option) any
8 ;    later version.
9 ;    
10 ;    This library 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 Library General Public License for more details.
14 ;    
15 ;    You should have received a copy of the GNU Library General Public License
16 ;    along with this program; if not, write to the Free Software
17 ;    Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 ;    
19 ;    In other words, you are welcome to use, share and improve this program.
20 ;    You are forbidden to forbid anyone else to use, share and improve
21 ;    what you give them.   Help stamp out software-hoarding!  
22 ; -------------------------------------------------------------------------*/
23
24         .area CSEG    (CODE)
25         .area GSINIT0 (CODE)
26         .area GSINIT1 (CODE)
27         .area GSINIT2 (CODE)
28         .area GSINIT3 (CODE)
29         .area GSINIT4 (CODE)
30         .area GSINIT5 (CODE)
31         .area GSINIT  (CODE)
32         .area GSFINAL (CODE)
33         
34         .area GSINIT3 (CODE)
35   
36 __mcs51_genXINIT::
37         mov     r1,#l_XINIT
38         mov     a,r1
39         orl     a,#(l_XINIT >> 8)
40         jz      00003$
41         mov     r2,#((l_XINIT+255) >> 8)
42         mov     dptr,#s_XINIT
43         mov     r0,#s_XISEG
44         mov     __PAGESFR,#(s_XISEG >> 8)
45 00001$: clr     a
46         movc    a,@a+dptr
47         movx    @r0,a
48         inc     dptr
49         inc     r0
50         cjne    r0,#0,00002$
51         inc     __PAGESFR
52 00002$: djnz    r1,00001$
53         djnz    r2,00001$
54         mov     __PAGESFR,#0xFF
55 00003$:
56