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

📄 memcpy.s

📁 标准c库代码,可以应用于各个系统提供了大量的基本函数
💻 S
字号:
#include "defines.h"#ifdef __H8300H__	.h8300h#endif	.global _memcpy_memcpy:;	MOVP	@(2/4,r7),A0P	; dst;	MOVP	@(4/8,r7),A1P	; src;	MOVP	@(6/12,r7),A2P	; len	MOVP	A0P,A3P	; keep copy of final dst	ADDP	A2P,A0P	; point to end of dst	CMPP	A0P,A3P	; see if anything to do	beq	quit	ADDP	A2P,A1P	; point to end of src	; lets see if we can do this in words	or	A0L,A2L	; or in the src address	or	A3L,A2L	; or the dst address	btst	#0,A2L	; see if the lsb is zero	bne	byteloopwordloop:	subs	#2,A1P		; point to word	mov.w	@A1P,A2		; get word	mov.w	A2,@-A0P	; save word	CMPP	A0P,A3P		; at the front again ?	bne 	wordloop	rtsbyteloop:	subs	#1,A1P		; point to byte	mov.b	@A1P,A2L	; get byte	mov.b	A2L,@-A0P	; save byte	CMPP	A0P,A3P 	; at the front again ?	bne 	byteloop	; return with A0 pointing to dstquit:	rts

⌨️ 快捷键说明

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