USB-BDI
|
00001 ;;; -*- asm -*- 00002 ;;; 00003 ;;; Copyright 2003,2004 Free Software Foundation, Inc. 00004 ;;; 00005 ;;; This file is part of GNU Radio 00006 ;;; 00007 ;;; GNU Radio is free software; you can redistribute it and/or modify 00008 ;;; it under the terms of the GNU General Public License as published by 00009 ;;; the Free Software Foundation; either version 2, or (at your option) 00010 ;;; any later version. 00011 ;;; 00012 ;;; GNU Radio is distributed in the hope that it will be useful, 00013 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 ;;; GNU General Public License for more details. 00016 ;;; 00017 ;;; You should have received a copy of the GNU General Public License 00018 ;;; along with GNU Radio; see the file COPYING. If not, write to 00019 ;;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00020 ;;; Boston, MA 02111-1307, USA. 00021 00022 00023 ;;; The default external memory initialization provided by sdcc is not 00024 ;;; appropriate to the FX2. This is derived from the sdcc code, but uses 00025 ;;; the FX2 specific _MPAGE sfr. 00026 00027 00028 ;; .area XISEG (XDATA) ; the initialized external data area 00029 ;; .area XINIT (CODE) ; the code space consts to init XISEG 00030 .area XSEG (XDATA) ; zero initialized xdata 00031 .area USBDESCSEG (XDATA) ; usb descriptors 00032 00033 00034 .area CSEG (CODE) 00035 00036 ;; sfr that sets upper address byte of MOVX using @r0 or @r1 00037 _MPAGE = 0x0092 00038 00039 __sdcc_external_startup:: 00040 ;; This system is now compiled with the --no-xinit-opt 00041 ;; which means that any initialized XDATA is handled 00042 ;; inline by code in the GSINIT segs emitted for each file. 00043 ;; 00044 ;; We zero XSEG and all of the internal ram to ensure 00045 ;; a known good state for uninitialized variables. 00046 00047 ; _mcs51_genRAMCLEAR() start 00048 mov r0,#l_XSEG 00049 mov a,r0 00050 orl a,#(l_XSEG >> 8) 00051 jz 00002$ 00052 mov r1,#((l_XSEG + 255) >> 8) 00053 mov dptr,#s_XSEG 00054 clr a 00055 00056 00001$: movx @dptr,a 00057 inc dptr 00058 djnz r0,00001$ 00059 djnz r1,00001$ 00060 00061 ;; We're about to clear internal memory. This will overwrite 00062 ;; the stack which contains our return address. 00063 ;; Pop our return address into DPH, DPL 00064 00002$: pop dph 00065 pop dpl 00066 00067 ;; R0 and A contain 0. This loop will execute 256 times. 00068 ;; 00069 ;; FWIW the first iteration writes direct address 0x00, 00070 ;; which is the location of r0. We get lucky, we're 00071 ;; writing the correct value (0) 00072 00073 00003$: mov @r0,a 00074 djnz r0,00003$ 00075 00076 push dpl ; restore our return address 00077 push dph 00078 00079 mov dpl,#0 ; indicate that data init is still required 00080 ret