2 ;------------------------------------------------------------------------------
\r
3 ; This file is part of the C51 Compiler package
\r
4 ; Copyright (c) 1988-2005 Keil Elektronik GmbH and Keil Software, Inc.
\r
7 ; *** <<< Use Configuration Wizard in Context Menu >>> ***
\r
8 ;------------------------------------------------------------------------------
\r
9 ; STARTUP.A51: This code is executed after processor reset.
\r
11 ; To translate this file use A51 with the following invocation:
\r
15 ; To link the modified STARTUP.OBJ file to your application use the following
\r
18 ; Lx51 your object file list, STARTUP.OBJ controls
\r
20 ;------------------------------------------------------------------------------
\r
22 ; User-defined <h> Power-On Initialization of Memory
\r
24 ; With the following EQU statements the initialization of memory
\r
25 ; at processor reset can be defined:
\r
27 ; <o> IDATALEN: IDATA memory size <0x0-0x100>
\r
28 ; <i> Note: The absolute start-address of IDATA memory is always 0
\r
29 ; <i> The IDATA space overlaps physically the DATA and BIT areas.
\r
32 ; <o> XDATASTART: XDATA memory start address <0x0-0xFFFF>
\r
33 ; <i> The absolute start address of XDATA memory
\r
36 ; <o> XDATALEN: XDATA memory size <0x0-0xFFFF>
\r
37 ; <i> The length of XDATA memory in bytes.
\r
40 ; <o> PDATASTART: PDATA memory start address <0x0-0xFFFF>
\r
41 ; <i> The absolute start address of PDATA memory
\r
44 ; <o> PDATALEN: PDATA memory size <0x0-0xFF>
\r
45 ; <i> The length of PDATA memory in bytes.
\r
49 ;------------------------------------------------------------------------------
\r
51 ;<h> Reentrant Stack Initialization
\r
53 ; The following EQU statements define the stack pointer for reentrant
\r
54 ; functions and initialized it:
\r
56 ; <h> Stack Space for reentrant functions in the SMALL model.
\r
57 ; <q> IBPSTACK: Enable SMALL model reentrant stack
\r
58 ; <i> Stack space for reentrant functions in the SMALL model.
\r
59 IBPSTACK EQU 0 ; set to 1 if small reentrant is used.
\r
60 ; <o> IBPSTACKTOP: End address of SMALL model stack <0x0-0xFF>
\r
61 ; <i> Set the top of the stack to the highest location.
\r
62 IBPSTACKTOP EQU 0xFF +1 ; default 0FFH+1
\r
65 ; <h> Stack Space for reentrant functions in the LARGE model.
\r
66 ; <q> XBPSTACK: Enable LARGE model reentrant stack
\r
67 ; <i> Stack space for reentrant functions in the LARGE model.
\r
68 XBPSTACK EQU 0 ; set to 1 if large reentrant is used.
\r
69 ; <o> XBPSTACKTOP: End address of LARGE model stack <0x0-0xFFFF>
\r
70 ; <i> Set the top of the stack to the highest location.
\r
71 XBPSTACKTOP EQU 0xFFFF +1 ; default 0FFFFH+1
\r
74 ; <h> Stack Space for reentrant functions in the COMPACT model.
\r
75 ; <q> PBPSTACK: Enable COMPACT model reentrant stack
\r
76 ; <i> Stack space for reentrant functions in the COMPACT model.
\r
77 PBPSTACK EQU 0 ; set to 1 if compact reentrant is used.
\r
79 ; <o> PBPSTACKTOP: End address of COMPACT model stack <0x0-0xFFFF>
\r
80 ; <i> Set the top of the stack to the highest location.
\r
81 PBPSTACKTOP EQU 0xFF +1 ; default 0FFH+1
\r
84 ;------------------------------------------------------------------------------
\r
86 ; Memory Page for Using the Compact Model with 64 KByte xdata RAM
\r
87 ; <e>Compact Model Page Definition
\r
89 ; <i>Define the XDATA page used for PDATA variables.
\r
90 ; <i>PPAGE must conform with the PPAGE set in the linker invocation.
\r
92 ; Enable pdata memory page initalization
\r
93 PPAGEENABLE EQU 0 ; set to 1 if pdata object are used.
\r
95 ; <o> PPAGE number <0x0-0xFF>
\r
96 ; <i> uppermost 256-byte address of the page used for PDATA variables.
\r
99 ; <o> SFR address which supplies uppermost address byte <0x0-0xFF>
\r
100 ; <i> most 8051 variants use P2 as uppermost address byte
\r
101 PPAGE_SFR DATA 0A0H
\r
104 ;------------------------------------------------------------------------------
\r
106 ; Standard SFR Symbols
\r
116 ?C_C51STARTUP SEGMENT CODE
\r
117 ?STACK SEGMENT IDATA
\r
122 EXTRN CODE (?C_START)
\r
126 ?C_STARTUP: LJMP STARTUP1
\r
133 MOV R0,#IDATALEN - 1
\r
135 IDATALOOP: MOV @R0,A
\r
140 MOV DPTR,#XDATASTART
\r
141 MOV R7,#LOW (XDATALEN)
\r
142 IF (LOW (XDATALEN)) <> 0
\r
143 MOV R6,#(HIGH (XDATALEN)) +1
\r
145 MOV R6,#HIGH (XDATALEN)
\r
148 XDATALOOP: MOVX @DPTR,A
\r
154 IF PPAGEENABLE <> 0
\r
155 MOV PPAGE_SFR,#PPAGE
\r
159 MOV R0,#LOW (PDATASTART)
\r
160 MOV R7,#LOW (PDATALEN)
\r
162 PDATALOOP: MOVX @R0,A
\r
168 EXTRN DATA (?C_IBP)
\r
170 MOV ?C_IBP,#LOW IBPSTACKTOP
\r
174 EXTRN DATA (?C_XBP)
\r
176 MOV ?C_XBP,#HIGH XBPSTACKTOP
\r
177 MOV ?C_XBP+1,#LOW XBPSTACKTOP
\r
181 EXTRN DATA (?C_PBP)
\r
182 MOV ?C_PBP,#LOW PBPSTACKTOP
\r
187 ; This code is required if you use L51_BANK.A51 with Banking Mode 4
\r
189 ; <q> Select Bank 0 for L51_BANK.A51 Mode 4
\r
191 ; <i> Initialize bank mechanism to code bank 0 when using L51_BANK.A51 with Banking Mode 4.
\r
192 EXTRN CODE (?B_SWITCH0)
\r
193 CALL ?B_SWITCH0 ; init bank mechanism to code bank 0
\r