单片机开发资料光盘-双龙-686M.zip

源代码在线查看: init.s

软件大小: 574027 K
上传用户: rllfllef
关键词: 686 zip 单片机 光盘
下载地址: 免注册下载 普通下载 VIP

相关代码

				; to be included by the crt*.s files
				;
					; initialize stacks
					;
					; set the hardware stack to ram_end, and the software stack some
					; bytes below that
					ldi R28,					ldi R29,>ram_end
					out $3D,R28
					out $3E,R29
					subi R28,					sbci R29,>hwstk_size
				
					ldi R16,0xAA	; sentenial
					std	Y+0,R16		; put sentenial at bottom of HW stack
				
					clr R0
					ldi R30,					ldi R31,>__bss_start
					ldi R17,>__bss_end
				
				; this loop zeros out all the data in the bss area
				;
				init_loop:
					cpi R30,					cpc R31,R17
					breq init_done
					st Z+,R0
					rjmp init_loop
				init_done:
				
					std Z+0,R16		; put sentenial at bottom of SW stack
				
				; copy data from idata to data
				; idata contains the initialized values of the global variables
				
					ldi R30,					ldi R31,>__idata_start
					ldi R26,					ldi R27,>__data_start
					ldi R17,>__idata_end
				
				copy_loop:
					cpi R30,					cpc R31,R17
					breq copy_done
					lpm 	; load (Z) byte into R0
					adiw R30,1
					st X+,R0
					rjmp copy_loop
				copy_done:
							

相关资源