crt0.s

来自「nucleus 文件系统,内核和彩色图形系统,在小系统上非常好用」· S 代码 · 共 56 行

S
56
字号
;
;       C program assembly startup for an embedded environment.
;       -------------------------------------------------------
;
;       Written by Tomas Evensen 1993-04-17.
;       Copyright 1993 Diab Data AB.
;
	PSECT
	XDEF    start
	ALIGN   4
	nop
start:
;
; insert/modify code here to initialize (if necessary):
; - sp (stack pointer)
; - a5 (data pointer)
; - the cache
; - exception vectors
; - fpu control registers
;
; initialize sp to value from link editor command file
	move.l  #___SP_INIT,a7

; initialize a5 to sdata (provided by linker)
;        move.l  #__SDA_BASE_,a5

; initialize cache
; MC68EC040
;       cinva   bc              ; invalidate cache
;       move.l  #0xe020,d0      ; make first 16 MB copy-back (MC68EC040)
;       movc    d0,dacr0
;       move.l  #0x80008000,d0  ; enable data and instruction caches
;       movc    d0,cacr


	jsr     ___init_main
	move.l  d0,-(a7)
	jsr     _exit           ; will never return
	jsr     _main           ; dummy to pull in main() as soon as possible

	section .init$00,2,C    ; Jeff Barth per Diab instructions 3/9/99
	XDEF    ___init
	ALIGN   4
___init:

	section .fini,2,C
; Return from __init
	rts
	XDEF    ___fini
___fini:

	section .eini,2,C
; Return from ___fini
	rts

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?