$NOMOD51
NAME    ?C_STARTUP

EXTRN CODE (?C_START)
PUBLIC  ?C_STARTUP

CLKCON	EQU		0B2H

EXTRN	IDATA	(STACK)

                CSEG    AT      1000H
?C_STARTUP:     LJMP    STARTUP1


?C_C51STARTUP	SEGMENT		CODE
				RSEG		?C_C51STARTUP
STARTUP1:
                MOV		SP, #STACK-1
				NOP
                ;此处在全局变量初始化之前，可清除ram
                ;清除idata
                MOV R0,#0x08
FOR_EACH_IDATA:
                MOV @R0,#0x00
                INC R0
                CJNE R0,#STACK,FOR_EACH_IDATA
                ;清除xdata
                CLR A
                MOV DPTR,#0x0000
FOR_EACH_XDATA:
                MOVX @DPTR,A
                INC DPTR
                MOV R0,DPL
                MOV R1,DPH
                CJNE R0,#0xDC,FOR_EACH_XDATA
                CJNE R1,#0x07,FOR_EACH_XDATA
                NOP
				LJMP	?C_START
                END