;*************************************************************************** ; ; C COMPILER for M16C/80 ; Copyright 1999 MITSUBISHI ELECTRIC CORPORATION ; AND MITSUBISHI ELECTRIC SEMICONDUCTOR SYSTEMS CORPORATION ; All Rights Reserved. ; ; ncrt0.a30 : NC308 startup program ; ; This program is applicable when using the basic I/O library ; ; $Id: ncrt0.a30,v 1.4 2000/06/23 12:24:23 muramatu Exp $ ; ;*************************************************************************** HEAPSIZE .equ 0h ;--------------------------------------------------------------------- ; STACK SIZE definition ;--------------------------------------------------------------------- STACKSIZE .equ 300h ;--------------------------------------------------------------------- ; INTERRUPT STACK SIZE definition ;--------------------------------------------------------------------- ISTACKSIZE .equ 300h ;--------------------------------------------------------------------- ; INTERRUPT VECTOR ADDRESS definition ;--------------------------------------------------------------------- ;VECTOR_ADR .equ 0fff000h ; Emu VECTOR_ADR .equ 0fefd00h ; Normal ;--------------------------------------------------------------------- ; Section allocation ;--------------------------------------------------------------------- .list OFF .include sect308.inc .list ON ;--------------------------------------------------------------------- ; SBDATA area definition ;--------------------------------------------------------------------- .glb __SB__ __SB__ .equ data_SE_top ;==================================================================== ; Initialize Macro declaration ;--------------------------------------------------------------------- BZERO .macro TOP_ ,SECT_ mov.b #00H, R0L mov.l #TOP_, A1 mov.w #sizeof SECT_ , R3 sstr.b .endm BCOPY .macro FROM_,TO_,SECT_ mov.l #FROM_ ,A0 mov.l #TO_ ,A1 mov.w #sizeof SECT_ , R3 smovf.b .endm ;==================================================================== ; Interrupt section start ;--------------------------------------------------------------------- .insf start,S,0 .glb start .section interrupt start: ;--------------------------------------------------------------------- ; after reset,this program will start ;--------------------------------------------------------------------- ldc #istack_top, isp ;set istack pointer ; data,adr mov.b #03h,0ah ;protect register mov.b #12h,0ch ;clock divisor register mcd -> divisor no mov.b #03h,0ah ;protect register mov.b #01h,04h ;set processer mode 0 ->pm0 mov.b #03h,0ah ;protect register mov.b #0c1h,05h ;set processor mode 1 ->pm1 mov.b #03h,0ah ;protect register ; mov.b #00h,06h ;set sytem clock controll register cm0 mov.b #40h,06h ;set sytem clock controll register cm0, reset bei wdc mov.b #00h,0ah ;protect register mov.b #00h,0bh ;external data bus width conrol register ->ds mov.b #0aah,08h ;ext Mem 2 Waitstates -> 70ns (wcr) ;display interface 2 Waitstates -> 70ns ldc #0080h, flg ldc #stack_top, sp ;set stack pointer ldc #data_SE_top, sb ;set sb register ldc #VECTOR_ADR,intb ;==================================================================== ; NEAR area initialize. ;-------------------------------------------------------------------- ; bss zero clear ;-------------------------------------------------------------------- BZERO bss_SE_top,bss_SE BZERO bss_SO_top,bss_SO BZERO bss_NE_top,bss_NE BZERO bss_NO_top,bss_NO ;--------------------------------------------------------------------- ; initialize data section ;--------------------------------------------------------------------- BCOPY data_SEI_top,data_SE_top,data_SE BCOPY data_SOI_top,data_SO_top,data_SO BCOPY data_NEI_top,data_NE_top,data_NE 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 ;==================================================================== ; heap area initialize ;--------------------------------------------------------------------- .glb __mbase .glb __mnext .glb __msize mov.l #(heap_top&0FFFFFFH), __mbase mov.l #(heap_top&0FFFFFFH), __mnext mov.l #(HEAPSIZE&0FFFFFFH), __msize ;==================================================================== ; 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 ;--------------------------------------------------------------------- dummy_int: reit .end ;*************************************************************************** ; ; C COMPILER for M16C/80 ; Copyright 1999 MITSUBISHI ELECTRIC CORPORATION ; AND MITSUBISHI ELECTRIC SEMICONDUCTOR SYSTEMS CORPORATION ; All Rights Reserved. ; ;***************************************************************************