📄 startup_i0.a30
字号:
;""FILE COMMENT""**************************************************************
; System Name : This program is only for education.
; File Name : startup_i0.a30
; Contents : Practice 8-A startup program -for INT0 interrupt sample-
; Model : OAKS16-LCD Board
; CPU : M16C/60 Serials
; Assembler : NC30WA(V.4.00 Release 2 - Entry)
; Linker : (ln30) for M16C Family Version 4.00.01
; OS : No use
; Programer : RENESAS Semiconductor Training Center
; Note : For OAKS16-M30620FCAFP(M16C/62group,16MHz)
;******************************************************************************
; COPYRIGHT(C) 2003 RENESAS TECHNOLOGY CORPORATION ALL RIGHTS RESERVED
; AND RENESAS SOLUTIONS CORPORATION ALL RIGHTS RESERVED
;******************************************************************************
; History : ---
;""FILE COMMENT END""**********************************************************
;==============================================================================
; section assignment
;==============================================================================
.include sect_i0.inc ; section defining file
;==============================================================================
; SFR definition for M16C/60 serials
;==============================================================================
.include target.inc ; SFR defining file
; for M16C/60 serials
;==============================================================================
; macro definition
;==============================================================================
;-------------------------------------------------------------------------------
; macro definition for clearing static variable area without initial value (for far)
; if _bzero is used, you must link nc30lib.lib.
;-------------------------------------------------------------------------------
BZERO .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
add.b #08,SP
.endm
;-------------------------------------------------------------------------------
; macro definition for transfering initial values into static variable area
; with initial value (for far area)
; if _bcopy is used, you must link nc30lib.lib.
;-------------------------------------------------------------------------------
BCOPY .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
add.b #12,SP
.endm
;==============================================================================
; startup program area
;==============================================================================
.section startup ; startup program area
;
.glb start
.glb _main
.glb _exit
.glb $exit
start: ; start address of startup program
ldc #STACK_INI,ISP ; initialize ISP
;===== when write flash memory, please delete the following comment ";".=============
;
; ----- initialization of processor mode register -----
; bset prc1 ; processor mode register 0,1
; ; write-enabled
; mov.b #00000000B,pm0 ; single-chip mode
; mov.b #00000000B,pm1 ; non-expansion, no wait
; bclr prc1 ; processor mode register 0,1
; ; write-inhibited
; ----- initialization of system clock control register -----
; bset prc0 ; system clock control register 0,1
; ; write-enabled
; mov.b #00001000B,cm0 ; main clock is set to on
; mov.b #00100000B,cm1 ; no division for main clock
; bclr prc0 ; system clock control register 0,1
; ; 1write-inhibited
;===============================================================================
ldc #0H,FLG ; initialize FLG register
ldc #0H,FB ; initialize FB register
ldc #data_FE_top,SB ; initialize SB register
; (for compiler)
ldintb #0FA000H ; initialize INTB register
;
jsr PORTINI ; set non-connection port
jsr RAMCLR ; clear data area
jsr DATINI ; transfer initial value to data area
;
fset I ; enable interrupt (for KD30)
;
jsr _main ; call main()
;
_exit: ; end of program
$exit:
jmp _exit ; jump to exit()
;""SUBR COMMENT""**************************************************************
; ID : ---
; Subroutine name : RAMCLR
; Function : clear data area
; : (for the static variable area without initial value)
; Input : No
; Output : No
; Called subroutine : No
; Stack : 0 byte
; Causion : use macro BZERO
; History : ---
;""SUBR COMMENT END""**********************************************************
RAMCLR:
BZERO bss_FE_top,bss_FE
BZERO bss_FO_top,bss_FO
RAMCLR_END:
rts
;""SUBR COMMENT""**************************************************************
; ID : ---
; Subroutine name : DATINI
; Function : transfer initial value to data area
; : (for static variable area with initial value)
; Input : No
; Output : No
; Called subroutine : No
; Stack : 0 byte
; Causion : use macro BCOPY
; History : ---
;""SUBR COMMENT END""**********************************************************
DATINI:
BCOPY data_FEI_top,data_FE_top,data_FE
BCOPY data_FOI_top,data_FO_top,data_FO
DATINI_END:
rts
;""SUBR COMMENT""**************************************************************
; ID : ---
; Subroutine name : PORTINI
; Function : set non-connection port to Output
; :
; Input : No
; Output : No
; Called subroutine : No
; Stack : 0byte
; Causion : ---
; History : ---
;""SUBR COMMENT END""**********************************************************
PORTINI:
mov.b #0FEH,pd0 ; set non-connection port to Output
mov.b #0FFH,pd1 ;
mov.b #0FFH,pd2 ;
mov.b #080H,pd4 ;
mov.b #0DEH,pd5 ;
mov.b #013H,pd6 ;
mov.b #0D3H,pd8 ;
mov.b #0FFH,pd9 ;
mov.b #0FEH,pd10 ;
PORTINI_END:
rts
.end
;******************************************************************************
; end of file
;******************************************************************************
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -