📄 cstartup.s31
字号:
;------------------------------------------------------------------------
; |
; FILE :cstartup.s31 |
; DATE :Wed, Jan 14, 2009 |
; DESCRIPTION :cstartup file |
; CPU GROUP :38D2 |
; |
; This file is generated by Renesas Project Generator (Ver.4.9). |
; |
;------------------------------------------------------------------------
;/*******************************************************************************
; *
; file name : cstartup.s31 *
; *
; Version : 1.0 ( 2005-11-01 ) *
; *
; Copyright(C) 2005. Renesas Technology Corp., All rights reserved. *
; *
; note: *
; This file containes the 740 C startup routine and must *
; usually be tailored to suit your system. *
; You probably want to set up the mode register and you may have *
; to change the interrupt vectors and reset vector. *
;********************************************************************************/
;/*
; note:
; This data is a freeware.
; RENESAS TECHNOLOGY CORPORATION assumes no responsibility for any damage
; that occurred by this data.
;*/
#include "mcu_def.inc"
;; ==========================================================================;
; Turning off 'interruptable ISRs' ;
;; ==========================================================================;
; Do this if you need the extra byte(s)
;
; 1. Uncomment the define below
; 2. Assemble this file
; 3. Include the result in your linker command file:
; -C cstartup.r31
;
; Variable '?IES_USAGE' and its initialization will no longer
; be included.
;; ==========================================================================;
;#define NO_INTERRUPTABLE_ISR
NAME CSTARTUP
EXTERN main ; where to begin execution
EXTERN __low_level_init
DEFFN __low_level_init(32768,0,0,0)
EXTERN exit ; where to go when program is done
DEFFN exit(32770,0,0,0)
PUBLIC ?INTERRUPT_EXPR_STACK ; Start address for interrupt
PUBLIC ?CSTARTUP_INTVEC ; start (base address) of interrupt vector
PUBLIC ?CSTARTUP_RESETVEC ; Location of reset vector
; ==========================================================================;
; CSTACK - The C stack segment ;
; ;
; Please, see in the link file lnk*.xcl how to increment ;
; the stack size without having to reassemble cstartup.s31 ! ;
; ==========================================================================;
RSEG CSTACK:ROOT
BLKB 0
; ==========================================================================;
; EXPR_STACK - The expression stack segment ;
; ;
; Please, see in the link file lnk*.xcl how to increment ;
; the stack size without having to reassemble cstartup.s31 ! ;
; ==========================================================================;
RSEG EXPR_STACK:ROOT
BLKB 0
; ==========================================================================;
; INT_EXPR_STACK - The interrupt expression stack segment ;
; ;
; Please, see in the link file lnk*.xcl how to increment ;
; the stack size without having to reassemble cstartup.s31 ! ;
; ==========================================================================;
RSEG INT_EXPR_STACK:ROOT
BLKB 0
#ifndef NO_INTERRUPTABLE_ISR
; ==========================================================================;
; ?IES_USAGE - Determines if the IES is setup and used. ;
; ;
; This variable is used for interrupt functions when compiling ;
; with the '-h' option. ;
; ==========================================================================;
RSEG ZPAGE
PUBLIC ?IES_USAGE
?IES_USAGE:
BLKB 1
#endif
; ==========================================================================;
; This will insert the information needed by interrupts who use ;
; the interrupt expression stack. Do not alter it! ;
; ==========================================================================;
RSEG CONST
?INTERRUPT_EXPR_STACK:
BYTE SFE(INT_EXPR_STACK)
; ==========================================================================;
; Forward declarations of segment used during initialization ;
; ==========================================================================;
RSEG Z_UDATA
RSEG Z_IDATA
RSEG Z_CDATA
RSEG N_UDATA
RSEG N_IDATA
RSEG N_CDATA
RSEG ECSTR
RSEG RF_STACK
RSEG CCSTR
RSEG CONST
RSEG CSTR
; ==========================================================================;
; RCODE - where the execution actually begins ;
; ==========================================================================;
RSEG RCODE:ROOT
init_C
CLD ; set default mode
CLT
LDM #CPUM_INIT, 3BH ; set stack page
LDX #LOW (SFE(CSTACK)-1) ; set up stack pointer
TXS
#ifndef NO_INTERRUPTABLE_ISR
; ==========================================================================;
; Initialize ?IES_USAGE: ;
; 1 IES not used ;
; 0 First use of IES, need to setup IES ;
; <0 IES already setup and used ;
; ==========================================================================;
LDA #1
STA zp:?IES_USAGE
#endif
; ==========================================================================;
; If hardware must be initiated from assembly or if interrupts ;
; should be on when reaching main, this is the place to insert ;
; such code. ;
; ;
; NOTE: You probably want to initialize the mode register here. ;
; ==========================================================================;
; ==========================================================================;
; Call __low_level_init to perform initialization before ;
; initializing segments and calling main. ;
; If the function returns 0 no segment initialization should ;
; take place. ;
; ;
; Link with your own version of __low_level_init to override ;
; the default action: to do nothing but return 1. ;
; ==========================================================================;
LDX #SFE(EXPR_STACK) ; set up expression stack
JSR __low_level_init
TAY ; test return value
BEQ skip_seg_init
; ==========================================================================;
; If it is not a requirement that static/global data is set ;
; to zero or to some explicit value at startup, the following ;
; line refering to seg_init can be deleted, or commented. ;
; ==========================================================================;
JSR seg_init ; initialize data segments
LDX #SFE(EXPR_STACK) ; set up expression stack (again)
; as seg_init destroys it
skip_seg_init
; ==========================================================================;
; Set up expression stack ;
; ==========================================================================;
expr_stack_start EQU SFE(EXPR_STACK)
LIMIT expr_stack_start,0,100h,"Expression stack out of range"
LDX #expr_stack_start & 255 ; load initial expr stack pointer
JSR main ; execute main()
; ==========================================================================;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -