⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 crt0.s

📁 DC记录卡读取程序
💻 S
字号:
! crt0.o for Dreamcast! Based on the old serial example by Marcus Comstedt! Modified for VMULoad to bootstrap the program into!   lower memory! Note: The linker thinks we go at 0x8c004000, so we! have to offset any fixed up addresses (fun =). We're! _really_ running at 0x8c010000. This ought to be corrected! by the bootstrap at "start" though..globl start.textstart:	! Before anything else happens, we have to make	! sure we're running at 0x8c004000 instead of the	! normal 0x8c010000. This lets us load programs there.	! PC constants are PC-relative so they're ok to use here.	mov.l	from_addr, r1	mov.l	to_addr, r2	mov.l	cnt, r3copy_loop:	mov.l	@r1+,r0	mov.l	r0,@r2	dt	r3	bf/s	copy_loop	add	#4,r2	mov.l	start_addr,r0	jmp	@r0	nop	.align 4from_addr:	.long	0x8c010000to_addr:	.long	0x8c004000start_addr:	.long	real_startcnt:	.long	0xc000/4real_start:	! First, make sure to run in the P2 area	mov.l	setup_cache_addr,r0	mov.l	p2_mask,r1	or	r1,r0	jmp	@r0	nopsetup_cache:	! Now that we are in P2, it's safe	! to enable the cache	mov.l	ccr_addr,r0	mov.w	ccr_data,r1	mov.l	r1,@r0	! After changing CCR, eight instructions	! must be executed before it's safe to enter	! a cached area such as P1. This will easily	! be taken care of with setting up the stack	! and some nops.	mov.l	old_stack_addr,r0	! 1	mov.l	r15,@r0			! 2	mov.l	new_stack,r15		! 3	mov.l	main_addr,r0		! 4	mov	#0,r1			! 5	sts.l	pr,@-r15		! 6	nop				! 7	nop				! 8	jsr	@r0			! go	mov	r1,r0	nop	! Put back the old stack pointer and PR	lds.l	@r15+,pr	mov.l	old_stack,r15	rts	nop	.align	4p2_mask:	.long	0xa0000000setup_cache_addr:	.long	setup_cachemain_addr:	.long	_dc_mainccr_addr:	.long	0xff00001cccr_data:	.word	0x090d	.word	0x0000old_stack_addr:	.long	old_stack + 0x20000000old_stack:	.long	0x00000000new_stack:	.long	0x8c010000	! Put stack at end of our space

⌨️ 快捷键说明

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