version 4.2.0
[fx2fw-sdcc] / startup.a51
index 84ec4df..eb12b81 100644 (file)
 ;;; -*- asm -*-\r
-\r
 ;;;\r
-\r
 ;;;-----------------------------------------------------------------------------\r
-\r
 ;;; Startup code\r
-\r
 ;;;-----------------------------------------------------------------------------\r
-\r
 ;;; Code taken from USRP2 firmware (GNU Radio Project), version 3.0.2,\r
-\r
 ;;; Copyright 2003 Free Software Foundation, Inc.\r
-\r
 ;;;-----------------------------------------------------------------------------\r
-\r
 ;;; This code is part of usbjtag. usbjtag is free software; you can redistribute\r
-\r
 ;;; it and/or modify it under the terms of the GNU General Public License as\r
-\r
 ;;; published by the Free Software Foundation; either version 2 of the License,\r
-\r
 ;;; or (at your option) any later version. usbjtag is distributed in the hope\r
-\r
 ;;; that it will be useful, but WITHOUT ANY WARRANTY; without even the implied\r
-\r
 ;;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-\r
 ;;; GNU General Public License for more details.  You should have received a\r
-\r
 ;;; copy of the GNU General Public License along with this program in the file\r
-\r
 ;;; COPYING; if not, write to the Free Software Foundation, Inc., 51 Franklin\r
-\r
 ;;; St, Fifth Floor, Boston, MA  02110-1301  USA\r
-\r
 ;;;-----------------------------------------------------------------------------\r
 \r
-\r
-\r
 ;;; The default external memory initialization provided by sdcc is not\r
-\r
 ;;; appropriate to the FX2.  This is derived from the sdcc code, but uses \r
-\r
 ;;; the FX2 specific _MPAGE sfr.\r
 \r
 \r
-\r
-\r
-\r
         ;; .area XISEG   (XDATA)  ; the initialized external data area\r
-\r
         ;; .area XINIT   (CODE)          ; the code space consts to init XISEG\r
-\r
         .area XSEG    (XDATA)          ; zero initialized xdata\r
-\r
         .area USBDESCSEG (XDATA)  ; usb descriptors\r
 \r
 \r
-\r
-        \r
-\r
         .area CSEG    (CODE)\r
 \r
-\r
-\r
         ;; sfr that sets upper address byte of MOVX using @r0 or @r1\r
-\r
         _MPAGE        =        0x0092\r
 \r
-\r
-\r
 __sdcc_external_startup::\r
-\r
         ;; This system is now compiled with the --no-xinit-opt \r
-\r
         ;; which means that any initialized XDATA is handled\r
-\r
         ;; inline by code in the GSINIT segs emitted for each file.\r
-\r
         ;; \r
-\r
         ;; We zero XSEG and all of the internal ram to ensure \r
-\r
         ;; a known good state for uninitialized variables.\r
 \r
-\r
-\r
 ;        _mcs51_genRAMCLEAR() start\r
-\r
         mov        r0,#l_XSEG\r
-\r
         mov        a,r0\r
-\r
         orl        a,#(l_XSEG >> 8)\r
-\r
         jz        00002$\r
-\r
         mov        r1,#((l_XSEG + 255) >> 8)\r
-\r
         mov        dptr,#s_XSEG\r
-\r
         clr     a\r
-\r
         \r
-\r
 00001$:        movx        @dptr,a\r
-\r
         inc        dptr\r
-\r
         djnz        r0,00001$\r
-\r
         djnz        r1,00001$\r
-\r
         \r
-\r
         ;; We're about to clear internal memory.  This will overwrite\r
-\r
         ;; the stack which contains our return address.\r
-\r
         ;; Pop our return address into DPH, DPL\r
-\r
 00002$:        pop        dph\r
-\r
         pop        dpl\r
-\r
         \r
-\r
         ;; R0 and A contain 0.  This loop will execute 256 times.\r
-\r
         ;; \r
-\r
         ;; FWIW the first iteration writes direct address 0x00,\r
-\r
         ;; which is the location of r0.  We get lucky, we're \r
-\r
         ;; writing the correct value (0)\r
-\r
         \r
-\r
 00003$:        mov        @r0,a\r
-\r
         djnz        r0,00003$\r
 \r
-\r
-\r
         push        dpl                ; restore our return address\r
-\r
         push        dph\r
 \r
-\r
-\r
         mov        dpl,#0                ; indicate that data init is still required\r
-\r
         ret\r
-\r