OpenCores
URL https://opencores.org/ocsvn/gecko3/gecko3/trunk

Subversion Repositories gecko3

[/] [gecko3/] [trunk/] [GECKO3COM/] [gecko3com-fw/] [firmware/] [src/] [_startup.a51] - Blame information for rev 9

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 9 nussgipfel
;;; -*- asm -*-
2
;;;
3
;;; Copyright 2003,2004 Free Software Foundation, Inc.
4
;;;
5
;;; This file is part of GNU Radio
6
;;;
7
;;; GNU Radio is free software; you can redistribute it and/or modify
8
;;; it under the terms of the GNU General Public License as published by
9
;;; the Free Software Foundation; either version 3, or (at your option)
10
;;; any later version.
11
;;;
12
;;; GNU Radio 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.
16
;;;
17
;;; You should have received a copy of the GNU General Public License
18
;;; along with GNU Radio; see the file COPYING.  If not, write to
19
;;; the Free Software Foundation, Inc., 51 Franklin Street,
20
;;; Boston, MA 02110-1301, USA.
21
 
22
 
23
;;; The default external memory initialization provided by sdcc is not
24
;;; appropriate to the FX2.  This is derived from the sdcc code, but uses
25
;;; the FX2 specific _MPAGE sfr.
26
 
27
 
28
        ;; .area XISEG   (XDATA)  ; the initialized external data area
29
        ;; .area XINIT   (CODE)   ; the code space consts to init XISEG
30
        .area XSEG    (XDATA)     ; zero initialized xdata
31
        .area USBDESCSEG (XDATA)  ; usb descriptors
32
 
33
 
34
        .area CSEG    (CODE)
35
 
36
        ;; sfr that sets upper address byte of MOVX using @r0 or @r1
37
        _MPAGE  =       0x0092
38
 
39
__sdcc_external_startup::
40
        ;; This system is now compiled with the --no-xinit-opt
41
        ;; which means that any initialized XDATA is handled
42
        ;; inline by code in the GSINIT segs emitted for each file.
43
        ;;
44
        ;; We zero XSEG and all of the internal ram to ensure
45
        ;; a known good state for uninitialized variables.
46
 
47
;       _mcs51_genRAMCLEAR() start
48
        mov     r0,#l_XSEG
49
        mov     a,r0
50
        orl     a,#(l_XSEG >> 8)
51
        jz      00002$
52
        mov     r1,#((l_XSEG + 255) >> 8)
53
        mov     dptr,#s_XSEG
54
        clr     a
55
 
56
00001$: movx    @dptr,a
57
        inc     dptr
58
        djnz    r0,00001$
59
        djnz    r1,00001$
60
 
61
        ;; We're about to clear internal memory.  This will overwrite
62
        ;; the stack which contains our return address.
63
        ;; Pop our return address into DPH, DPL
64
00002$: pop     dph
65
        pop     dpl
66
 
67
        ;; R0 and A contain 0.  This loop will execute 256 times.
68
        ;;
69
        ;; FWIW the first iteration writes direct address 0x00,
70
        ;; which is the location of r0.  We get lucky, we're
71
        ;; writing the correct value (0)
72
 
73
00003$: mov     @r0,a
74
        djnz    r0,00003$
75
 
76
        push    dpl             ; restore our return address
77
        push    dph
78
 
79
        mov     dpl,#0          ; indicate that data init is still required
80
        ret

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.