Files
x1key/src.original/ncrt0.a30
Philip Smart 6ac7fa5563 First push
2022-02-17 13:17:58 +00:00

140 lines
4.7 KiB
Plaintext

;----------------------------------------------------------------------
; |
; |
; |
; DESCRIPTION : Startup Program. (for Assembler language) |
; |
; |
; This file is generated by Renesas Project Generator. |
; |
;----------------------------------------------------------------------
;/*********************************************************************
;*
;* Device : R8C Family
;*
;* File Name : ncrt0.a30
;*
;* Abstract : Startup Program
;*
;* History : 1.01 (2006-11-22)
;*
;* NOTE : THIS IS A TYPICAL EXAMPLE.
;*
;* Copyright (C) 2006 Renesas Electronics Corporation.
;* and Renesas Solutions Corp.
;*
;*********************************************************************/
;---------------------------------------------------------------------
; include files
;---------------------------------------------------------------------
.list OFF
.include nc_define.inc
.include sect30.inc
.list ON
;=====================================================================
; Interrupt section start
;---------------------------------------------------------------------
.glb start
.section interrupt,CODE,ALIGN
.insf start,G,0
start:
;---------------------------------------------------------------------
; after reset,this program will start
;---------------------------------------------------------------------
ldc #((topof istack)+(sizeof istack)),isp ;set istack pointer
mov.b #02h,0ah
mov.b #00h,04h ;set processer mode
mov.b #00h,0ah
.if __STACKSIZE__ != 0
ldc #0080h,flg
ldc #((topof stack)+(sizeof stack)),sp ;set stack pointer
.else
ldc #0000h,flg
.endif
ldc #__SB__,sb ;set sb register
; If the destination is INTBL or INTBH,
; make sure that bytes are transferred in succession.
ldc #((topof vector)>>16)&0FFFFh,INTBH
ldc #(topof vector)&0FFFFh,INTBL
;=====================================================================
; NEAR area initialize.
;---------------------------------------------------------------------
; bss zero clear
;---------------------------------------------------------------------
N_BZERO (topof bss_SE),bss_SE
N_BZERO (topof bss_SO),bss_SO
N_BZERO (topof bss_NE),bss_NE
N_BZERO (topof bss_NO),bss_NO
;---------------------------------------------------------------------
; initialize data section
;---------------------------------------------------------------------
N_BCOPY (topof data_SEI),(topof data_SE),data_SE
N_BCOPY (topof data_SOI),(topof data_SO),data_SO
N_BCOPY (topof data_NEI),(topof data_NE),data_NE
N_BCOPY (topof data_NOI),(topof data_NO),data_NO
;=====================================================================
; heap area initialize
;---------------------------------------------------------------------
.if __HEAPSIZE__ != 0
.glb __mnext
.glb __msize
mov.w #((topof heap_NE)&0FFFFH),__mnext
mov.w #(__HEAPSIZE__&0FFFFH),__msize
.endif
;=====================================================================
; Initialize standard I/O
;---------------------------------------------------------------------
.if __STANDARD_IO__ == 1
.glb __init
.call __init,G
jsr.a __init
.endif
;=====================================================================
; Call main() function
;---------------------------------------------------------------------
ldc #0h,fb ; for debuger
; Remove the comment when you use global class object
; Sections C$INIT will be generated
; .glb __CALL_INIT
; .call __CALL_INIT,G
; jsr.a __CALL_INIT
.glb _main
.call _main,G
jsr.a _main
;=====================================================================
; exit() function
;---------------------------------------------------------------------
.glb _exit
.glb $exit
.glb __exit_loop
_exit:
$exit:
; Remove the comment when you use global class object
; Sections C$INIT will be generated
; .glb __CALL_END
; .call __CALL_END,G
; jsr.a __CALL_END
__exit_loop: ; End program
jmp __exit_loop
.einsf
;=====================================================================
; dummy interrupt function
;---------------------------------------------------------------------
.glb dummy_int
dummy_int:
reit
.end