📄 startup.lst
字号:
MACRO ASSEMBLER STARTUP 08/25/05 17:07:04 PAGE 1
WIN32 MACRO ASSEMBLER MA51 V06.04.14OBJECT MODULE PLACED IN E:\UPSD\COM\STARTUP.OBJ
ASSEMBLER INVOKED BY: MA51.EXE E:\UPSD\COM\STARTUP.A51 OJ(E:\UPSD\COM\STARTUP.OBJ) PIN(D:\CIRCUITSOFT\RIDE\INC;D:\CIRCUITSOFT\RIDE\INC\51) PIN(D:\CIRCUITSOFT\RIDE\INC\51\ST\UPSD3354DV-40\) EP LINES SYNTAX(ASM51) PR(E:\UPSD\COM\STARTUP.LST) XR DB PW(80) RB(0)
LOC OBJ LINE SOURCE
1 ;-------------------------------------------------------------------------------
2 ; Copyright (c) Raisonance S.A. 1989 - 2003
3 ; This is the 'C' language "STARTUP" routine for RC51
4 ;
5 ; File name: STARTUP.A51
6 ;
7 ; Purpose: To provide the initial starting code for the 8051 from
8 ; power-up to the initial execution of the main() routine.
9 ;
10 ; Scope: This file contains all the code and information required
11 ; to accomplish "Purpose". It is applicable to all memory
12 ; models and initialization concepts EXCEPT the "Tiny"
13 ; model. This file, assembled in the appropriate memory model,
14 ; is automatically linked in by the linker when it encounters
15 ; a "main" symbol in the object modules to be linked.
16 ;
17 ; The routine will be executed each time the controller
18 ; experiences a "power-on" condition.
19 ;
20 ; If you wish to use this startup routine with your assembly
21 ; code too, you should add a "main" label in your code.
22 ;
23 ; Considerations: The values selected are intended for a standard 8051 controller.
24 ; In most cases these will work well for must other processors
25 ; under most conditions. The ranges for initialization, or the
26 ; initialization values can be changed or modified as needed.
27 ;
28 ; Other micros: The most common change to this module will be to accommodate
29 ; the Philips '751 chips with their restricted internal memory
30 ; space, and the lack of LJMP or LCALL instructions. The
31 ; locations in this module that may need changing are marked
32 ; with: (** For 751 use **)
33 ;
34 ; Caveats: It is possible to modify this file and effect the execution
35 ; the target processor in many ways. Often settings and
36 ; selections have effects on each other. Some many not be
37 ; compatible. This startup routine is provided "as is". If
38 ; you change it to meet some design objective you are responsible
39 ; to know the outcome of your selections, and their effect upon
40 ; the target system.
41 ;
42 ;-------------------------------------------------------------------------------
43 ; NOTE: YOU SHOULD ALTER THIS FILE ONLY AFTER YOU HAVE BUILT AND TESTED YOUR
44 ; CODE, AND YOU'RE CONVINCED THAT YOU CAN MAKE IT RUN OR WORK BETTER BY DOING
45 ; SO. IF YOU ONLY NEED SOME SPECIFIC INITIALIZATIONS, IT IS RECOMMENDED THAT
46 ; YOU DO THEM IN THE FIRST FEW LINES OF YOUR MAIN() ROUTINE. MODIFY THIS FILE
47 ; ONLY AS A LAST RESORT.
48 ;-------------------------------------------------------------------------------
49
50 $INCLUDE( UPSD3300.INC ) ; uPSD3300 Assembly Equates
298
299 EXTRN IDATA ( _STACK )
300 EXTRN CODE ( MAIN ) ; main routine called at the end of this startup.
301 EXTRN DATA ( HPD_ADDR ) ; HPD_ADDR is supposed to be P2 address...
302 EXTRN NUMBER ( _INITP2? ) ; Initial value for P2
303
304 ;-------------------------------------------------------------------------------
305 ; The next section contains the starting address and length of each of the data
306 ; segments. Note that you must use these labels given below, as Raisonance 51
307 ; toolchain understands them and uses them to modify actual values in the module.
308 ;
309 ; The IDATA information and setup:
310 ; Initialize the values for the IDATA space. By default IDATA starts at
311 ; location 0, and goes to top of internal memory. On the 8051 that's 128 bytes
312 ; (0x7F), on other derivatives it may be up to 256 bytes (0xFF). On some it can
313 ; be as little as 64 bytes. Since it will always start at location 0x0000, we
314 ; will permit the linker to manage this variable.
315 ; NOTE: IDATA space physically overlaps both the DATA, REGISTER, and BIT spaces.
316 ; At a very minimum, the user is admonished to initialize at least the first 8
317 ; bytes (Register bank 0) and at least one additional byte for the stack.
318
0000 319 IDATASTART EQU 000H ; a default value and is added only for completeness.
00FF 320 IDATALEN EQU 0FFH ; typical length is 256 bytes.
321 ;
322 ; (** For 751 use **) you may need to adjust the IDATALEN value
323 ;
324 ; Note: The entire internal address space is IDATA space! The lower
325 ; 128 bytes is also DATA space. Both DATA and IDATA physically
326 ; overlap the BIT area. So initializing either of these spaces
327 ; will initialize the BIT area as well. Given the nature of the
328 ; 8051 DATA space initializations are best done as IDATA accesses.
329 ;
330 ; The PDATA information and setup:
331 ; Since PDATA resides in XDATA space it is included for reference only. Note that
332 ; you must use (and correctly initialize) P2 in order to succeed with PDATA accesses.
333 ; The value for P2 is in PAGES of 256 bytes, and is dependent upon the address
334 ; selected for that page.
335
0000 336 PDATASTART EQU 000H ; this is the default value.
0000 337 PDATALEN EQU 000H ; typical length is 256 bytes.
338
339 ;
340 ; The XDATA information and setup:
341 ; If your application has non-standard address ranges for XDATA this is where you
342 ; will need to alter the values. The length and location of XDATA space can vary
343 ; according to the chip and/or hardware design. If reentrant functions are used,
344 ; this space should be initialized. But this is entirely dependent upon system
345 ; and program design requirements. By default, XDATA space IS NOT initialized.
346 ; To force initialization you should make the XDATA length value non-zero.
347
0000 348 XDATASTART EQU 000H ; the start address of XDATA space
0000 349 XDATALEN EQU 000H ; typically we don't need to initialize xdata space
350
351 ; ANSI 'C' language specification requires initialization of global and static
352 ; variables. This is done at the end of this startup. However, if for any reason
353 ; you do not want this initialization, turn INIDATA to zero.
354 ;-------------------------------------------------------------------------------
355 ;
356 ; Advanced details:
357 ; To initialize static and global variables, RC51 generates a partial segment
358 ; with the name ?C_INITSEGSTART. The contents of this segment are:
359 ; (nb = number of bytes)
360 ; 0 - nb * 4 + bit 0 if in data memory
361 ; + bit 1 if in xdata memory
362 ; + bit 2 if zero initialization
363 ; Note: if bit 0 and bit 1 of nb are zero, it is a bit initialization
364 ; else we are in a data, idata or xdata initialization
365 ; 1 - Low byte of address to initialize
366 ; 2 - High byte of address to initialize
367 ; 3 - data (limited to 127 bytes)
368 ;
369 ; LX51 chains the partial segments into the final segment, and adds a NULL
370 ; termination.
371 ;
372 ;-------------------------------------------------------------------------------
373
0001 374 INIDATA EQU 001H ; allow global and static variable initialization.
375
376 ;
377 ; This selection permits or denies the initialization of chip I/O registers. By
378 ; default, I/O initialization is OFF. On critical programs eliminating this step
379 ; can save a few bytes of code. Typically chip I/O is initialized early in the
380 ; MAIN() routine. To do this initialization in this startup routine, make the
381 ; variable non-zero. You may insert additional initialization requirements into
382 ; the code section controlled by this directive. For instance, you could put
383 ; initialization of a watchdog timer into this section.
384
0001 385 INITIO EQU 001H ; make non-zero to permit I/O initialization
00E8 386 TIM1_INIT EQU 0E8H ; timer 1 initialization value for 9600 baud
387
388 ;-------------------------------------------------------------------------------
389 ; Watch dog timer macro:
390 ; In some instances when many initializations are performed it may be necessary
391 ; to service the watch dog timer. The actual code needed to accomplish this
392 ; will be dependent upon the actual device in use, and it's operating
393 ; characteristics. This is a template for such a watch dog timer function.
394
395 PET_THE_DOG MACRO
396 ; ENTER YOUR WATCHDOG SERVICE CODE HERE.
397 ENDM
398
399 ;
400 ; To use this macro, place it into the code stream at the location where it may
401 ; need to be called.
402
403 ;-------------------------------------------------------------------------------
404 ; The next section contains the EXTERNAL stack initialization directive.
405
0000 406 XSTACK EQU 000H ; make non-zero to use external stack
0000 407 XSTACKLEN SET 000H ; an initial length for the external stack
408
409 ;-------------------------------------------------------------------------------
410 ; Miscellaneous directives.
411
0000 412 INTERNAL_XRAM_LIKE_8XC592 EQU 000H ; make non-zero to use internal XRAM.
413
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -