⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 startup.lst

📁 采用ST的UPSD33XX系列单片机的双串口
💻 LST
📖 第 1 页 / 共 4 页
字号:
                       414     ;===============================================================================
                       415     ; Startup relocatable CODE segment name is set here.
                       416     ?PR?C51_STARTUP?  SEGMENT  CODE
                       417     
                       418        NAME STARTUP
                       419     
                       420     ;-----------------------------------------------------
                       421     ; Debug IRQ vector (only needed when using trace mode) 
                       422     ; DO NOT MODIFY
                       423     ;-----------------------------------------------------
------                 424        CSEG    AT      063H       ; debug interrupt vector
0063    00             425                NOP						; Leave this 3 byte sequence
0064    00             426                NOP						; it is used by RIDE debugger
0065    32             427                RETI
                       428     
                       429     
                       430     ;-------------------------------------------------------------------------------
                       431     ; By design, all code for the 8051 MUST start at location 0000h.  In special cases
                       432     ; it is desirable to change this location.  For instance, to make a monitor
                       433     ; resident at location 8000h.  When you do this other considerations are required.
                       434     ; For instance, the location of interrupts must be considered.
                       435     ;
                       436     ; 1.  Set the CODE segment defined above to begin at location 0x0000.  To change
                       437     ;     the location of where you want your startup vector to be located you would
                       438     ;     modify this value.  Note:  That there are considerations beyond just simple
                       439     ;     code locations if you do this.  Consequently this action is NOT RECOMMENDED!
                       440     
------                 441        CSEG    AT 0000H
                       442     
                       443     ;-------------------------------------------------------------------------------
                       444     ; 2.  Make the label public and jump to it.  This permits the vector to live at
                       445     ;     the CSEG location defined above, and the rest of the code to be relocated
                       446     ;     as required by the linker to resolve it's instructions and directives.
                       447     
                       448        PUBLIC   ?C_START
                       449     
0000    020000   F     450        LJMP  ?C_START  ;(** For 751 use **) you must change the LJMP to an AJMP
                       451     
                       452     ;-------------------------------------------------------------------------------
                       453     ; 3.  Set the C51_STARTUP segment to be relocatable
                       454     ;     Define LX51 Start up Macro Area that inits MCU
                       455     
------                 456        RSEG  ?PR?C51_STARTUP?
                       457     
                       458     ?C_START: 
                       459     
                       460     ;>>>>>>LX51_STARTUP_MICRO_SPECIFIC
                       461     ;NOTE - Ride will add and remove initialization code here.
                       462     ;DO NOT EDIT this block of code!
                       463     ; Call external "C" Function to init uPSD device in file upsd_init.c
                       464     EXTRN         CODE (UPSD_INIT)
0000    758100   F     465     MOV   SP, #_STACK            ; Setup SP (linker defines location)
0003    120000   F     466     CALL  UPSD_INIT              ; Call C function to init uPSD
                       467     
                       468     ;<<<<<<LX51_STARTUP_MICRO_SPECIFIC
                       469     
                       470     
                       471     ;-------------------------------------------------------------------------------
                       472     ; 4.  Stack definition and initialization:
                       473     ; The "STACK" is not actually defined anywhere.  It is always located in IDATA
                       474     ; space.  It is always only 1 byte long.  And it always GROWS UP.  The stack has
                       475     ; been given the name, "_STACK".  This location, by name, will be adjusted by the
                       476     ; linker to be located on top of all internal memory (registers+DATA+BITS+IDATA)
                       477     ; consumed.
                       478     
0006    758100   F     479        MOV   SP, #_STACK
                       480     
                       481     ;-------------------------------------------------------------------------------
                       482     ; 5.  Initialize the INTERNAL data memory spaces.
                       483     ; First we do the internal memory space.  It must always be initialized, for
                       484     ; all chips, and all memory models.  Internal memory will be initialized with
                       485     ; whatever value is set into A.  Zero is recommended, although other values
                       486     ; could be used for special debugging reasons.
                       487     ;
                       488     ; Note:  This initialization counts DOWN.
                       489     
                       490     IF IDATALEN <> 0
0009    E4             491        CLR   A
000A    78FE           492        MOV   R0, #LOW(IDATALEN - 1)
                       493     
                       494     __INTERNAL_MEM_INIT__: 
000C    F6             495        MOV   @R0, A
000D    D8FD           496        DJNZ  R0, __INTERNAL_MEM_INIT__
                       497     ENDIF
                       498     
                       499     ;-------------------------------------------------------------------------------
                       500     ; 6.  Initialize the EXTERNAL data memory spaces.
                       501     ; We initialize the XDATA memory counting up from XDATASTART.  Note that
                       502     ; PDATA is the same location as XDATA.
                       503     ;
                       504     ; (** For 751 use **) CUT FROM HERE ---------- vvvvvvv  ----------
                       505     ; Either EXPLICITLY do not use XDATA in your code, or comment out or remove
                       506     ; the entire XDATA initialization section to make absolutely sure it is NOT used.
                       507     ;
                       508     ; Note:  This initialization counts UP.
                       509     ;
                       510     IF XDATALEN <> 0
                                  MOV   DPTR, #XDATASTART    ; set to lowest address, start there
                                  MOV   R1, #LOW(XDATALEN)   ; get the low byte of the length
                               
                                IF (LOW (XDATALEN)) <> 0
                                  MOV   R0, #(HIGH XDATALEN) + 1   ; add one for physical -> logical value
                                ELSE
                                  MOV   R0, #HIGH (XDATALEN)       ; if 0, then it doesn't matter
                                ENDIF
                               
                                  CLR   A                 ; or use a special value for debugging purposes
                               
                               FILLXD:
                                  MOVX  @DPTR, A          ; write the value contained in A through DPTR
                                  INC   DPTR              ; point to the next higher byte location
                                  DJNZ  R1, FILLXD        ; loop until filled, fall through to outer loop on 0
                                  PET_THE_DOG             ; if needed, put the watch dog service routine here
                                  DJNZ  R0,FILLXD         ;
                               ENDIF
                       529     
                       530     
                       531     ;-------------------------------------------------------------------------------
                       532     ; 7.  Initialization of all global and static variables.
                       533     
                       534     IF INIDATA <> 0
                       535     EXTRN   CODE (?C_INITSEGSTART)      ; Data used to initialize.
                       536     
                       537      IF XSTACK <> 0
                                 EXTRN   XDATA (_XSTK0)
                                ENDIF
                       540     
  00D1                 541     F1 BIT   0D1H                       ; F1 bit of PSW definition.
                       542     
000F    900000   F     543        MOV   DPTR, #?C_INITSEGSTART     ; Base address.
                       544     
                       545     __PAQ__: 
                       546        ;------------------------------
                       547        ; Read identification byte (nb)
                       548        ;------------------------------
0012    E4             549        CLR   A
0013    93             550        MOVC  A, @A+DPTR
0014    7002           551        JNZ   __INIDATA_LABEL__          ; Zero is the end of the initialization.
                       552     
                       553     $IF( INTERNAL_XRAM_LIKE_8XC592 )
                                  MOV   P2, #0FFH
                               $ELSE
                       556      $IF( XSTACK )
                                  MOV   P2, #HIGH(_XSTK0)
                                $ENDIF
                       559     $ENDIF
                       560     
0016    804E           561        SJMP  __END_OF_INIT__
                       562     
                       563     __INIDATA_LABEL__: 
                       564        ;---------------------------------------------------------
                       565        ; LSB indicates internal memory (0) or external memory (1)
                       566        ;---------------------------------------------------------
0018    C3             567        CLR   C
0019    13             568        RRC   A
001A    92D5           569        MOV   F0, C
                       570        ;---------------------------------------------------------------------
                       571        ; Bit 1 indicates full zero init (1) or init with different values (0)
                       572        ;---------------------------------------------------------------------
001C    C3             573        CLR   C
001D    13             574        RRC   A
001E    92D1           575        MOV   F1, C
                       576        ;------------------------------------------------------
                       577        ; The others bits indicate the number of bytes to read
                       578        ;------------------------------------------------------
0020    FF             579        MOV   R7, A
0021    A3             580        INC   DPTR
0022    E4             581        CLR   A
0023    93             582        MOVC  A, @A+DPTR        ; Read low byte of address to initialize.
0024    F8             583        MOV   R0, A
0025    B0D5           584        ANL   C, /F0            ; Verify if it is not a bit initialization.
0027    4021           585        JC    __BIT_INIT__
0029    30D505         586        JNB   F0, __INIT_LOOP__

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -