3 ;;; Copyright 2003,2004 Free Software Foundation, Inc.
5 ;;; This file is part of GNU Radio
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.
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.
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.
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.
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
36 ;; sfr that sets upper address byte of MOVX using @r0 or @r1
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.
44 ;; We zero XSEG and all of the internal ram to ensure
45 ;; a known good state for uninitialized variables.
47 ; _mcs51_genRAMCLEAR() start
52 mov r1,#((l_XSEG + 255) >> 8)
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
67 ;; R0 and A contain 0. This loop will execute 256 times.
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)
76 push dpl ; restore our return address
79 mov dpl,#0 ; indicate that data init is still required