📄 ncrt0.a30
字号:
;*************************************************************************** ;; C COMPILER for R8C/Tiny, M16C/60,30,20,10; COPYRIGHT(C) 1999(2000-2004) RENESAS TECHNOLOGY CORPORATION; AND RENESAS SOLUTIONS CORPORATION ALL RIGHTS RESERVED;;; ncrt0.a30 : NC30 startup program;; This program is applicable when using the basic I/O library;; $Id: ncrt0.a30,v 1.27 2004/03/08 04:13:56 muranaka Exp $;;***************************************************************************;---------------------------------------------------------------------; HEEP SIZE definition;---------------------------------------------------------------------;HEAPSIZE .equ 10000hHEAPSIZE .equ 10000h ;64k bytes 20.10.2005 SY;---------------------------------------------------------------------; STACK SIZE definition;---------------------------------------------------------------------STACKSIZE .equ 300h;---------------------------------------------------------------------; INTERRUPT STACK SIZE definition;---------------------------------------------------------------------ISTACKSIZE .equ 300h;---------------------------------------------------------------------; INTERRUPT VECTOR ADDRESS definition;---------------------------------------------------------------------VECTOR_ADR .equ 0ffd00hSVECTOR_ADR .equ 0ffe00h;---------------------------------------------------------------------; Section allocation;--------------------------------------------------------------------- .list OFF .include sect30.inc .list ON;---------------------------------------------------------------------; SBDATA area definition;--------------------------------------------------------------------- .glb __SB____SB__ .equ data_SE_top;====================================================================; Initialize Macro declaration;---------------------------------------------------------------------N_BZERO .macro TOP_ ,SECT_ mov.b #00H, R0L mov.w #(TOP_ & 0FFFFH), A1 mov.w #sizeof SECT_ , R3 sstr.b .endmN_BCOPY .macro FROM_,TO_,SECT_ mov.w #(FROM_ & 0FFFFH),A0 mov.b #(FROM_ >>16),R1H mov.w #TO_ ,A1 mov.w #sizeof SECT_ , R3 smovf.b .endmBZERO .macro TOP_,SECT_ push.w #sizeof SECT_ >> 16 push.w #sizeof SECT_ & 0ffffh pusha TOP_ >>16 pusha TOP_ & 0ffffh .stk 8 .glb _bzero .call _bzero,G jsr.a _bzero .endmBCOPY .macro FROM_ ,TO_ ,SECT_ push.w #sizeof SECT_ >> 16 push.w #sizeof SECT_ & 0ffffh pusha TO_ >>16 pusha TO_ & 0ffffh pusha FROM_ >>16 pusha FROM_ & 0ffffh .stk 12 .glb _bcopy .call _bcopy,G jsr.a _bcopy .endm;; for M16C/60,30,20,10 series;; .glb __BankSelect;__BankSelect .equ 0BH;---------------------------------------------------------------; special page definition;---------------------------------------------------------------; macro define for special page;;Format:; SPECIAL number;SPECIAL .macro NUM .org 0FFFFEH-(NUM*2) .glb __SPECIAL_@NUM .word __SPECIAL_@NUM & 0FFFFH.endm;====================================================================; Interrupt section start;--------------------------------------------------------------------- .insf start,S,0 .glb start .section interruptstart:;---------------------------------------------------------------------; after reset,this program will start;--------------------------------------------------------------------- ldc #istack_top,isp ;set istack pointer mov.b #02h,0ah ;Unluck the protect ;mov.b #00h,04h ;first set R/W Mode into /RD,/BHE,/WR ==>PM0 mov.b #01h,04h ;set processor mode to memory expantion ==>PM0 mov.b #00h,05h ;disable internal expantion, no wait ==>PM1 mov.b #00h,0ah ;Luck the protect
mov.b #01h,08h ;CS0 output
;mov.b #02h,1Bh ;CS0 3 wait state..cool ;mov.b #0Fh,08h ;All Chip selects enabled with wait
;mov.b #0AAh,1Bh ;All Software wait States 3 wait state..cool ;mov.b #55h,1Bh ;All Software wait States 2 wait state..cool ;mov.b #00h,1Bh ;All Software wait States 1 wait state..cool ldc #0080h,flg ;IPL=0, I=0, IntStack=USR=User Stack Pointer ldc #stack_top, sp ;set stack pointer ldc #data_SE_top, sb ;set sb register ldintb #VECTOR_ADR;====================================================================; NEAR area initialize.;--------------------------------------------------------------------; bss zero clear;-------------------------------------------------------------------- N_BZERO bss_SE_top,bss_SE N_BZERO bss_SO_top,bss_SO N_BZERO bss_NE_top,bss_NE N_BZERO bss_NO_top,bss_NO;---------------------------------------------------------------------; initialize data section;--------------------------------------------------------------------- N_BCOPY data_SEI_top,data_SE_top,data_SE N_BCOPY data_SOI_top,data_SO_top,data_SO N_BCOPY data_NEI_top,data_NE_top,data_NE N_BCOPY data_NOI_top,data_NO_top,data_NO;====================================================================; FAR area initialize.;---------------------------------------------------------------------; bss zero clear;---------------------------------------------------------------------; BZERO bss_FE_top,bss_FE; BZERO bss_FO_top,bss_FO;---------------------------------------------------------------------; Copy edata_E(O) section from edata_EI(OI) section;--------------------------------------------------------------------- BCOPY data_FEI_top,data_FE_top,data_FE BCOPY data_FOI_top,data_FO_top,data_FO ldc #stack_top,sp .stk -40;====================================================================; heap area initialize;--------------------------------------------------------------------- .glb __mbase .glb __mnext .glb __msize mov.w #(heap_top&0FFFFH), __mbase mov.w #(heap_top>>16), __mbase+2 mov.w #(heap_top&0FFFFH), __mnext mov.w #(heap_top>>16), __mnext+2 mov.w #(HEAPSIZE&0FFFFH), __msize mov.w #(HEAPSIZE>>16), __msize+2;====================================================================; Initialize standard I/O;---------------------------------------------------------------------; .glb _init; .call _init,G; jsr.a _init;====================================================================; Call main() function;--------------------------------------------------------------------- ldc #0h,fb ; for debuger .glb _main jsr.a _main;====================================================================; exit() function;--------------------------------------------------------------------- .glb _exit .glb $exit_exit: ; End program$exit: jmp _exit .einsf;====================================================================; dummy interrupt function;--------------------------------------------------------------------- .glb dummy_intdummy_int: reit .end;***************************************************************************;; C COMPILER for R8C/Tiny, M16C/60,30,20,10; COPYRIGHT(C) 1999(2000-2004) RENESAS TECHNOLOGY CORPORATION; AND RENESAS SOLUTIONS CORPORATION ALL RIGHTS RESERVED;;***************************************************************************
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -