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

📄 armcode.s

📁 s3c44b0 arm指令实验2
💻 S
字号:
#*********************************************************************************************
# NAME:		ARMcode.s																		 *
# Author: 	Embest																			 *
# Desc:		ARMcode examples																 *
#           copy words from src to dst														 *
# History:	shw.He 2005.02.22																 *
#*********************************************************************************************

/*------------------------------------------------------------------------------------------*/
/*	 								constant define						 				    */
/*------------------------------------------------------------------------------------------*/
.global _start

/*------------------------------------------------------------------------------------------*/
/*	 								code								 				    */
/*------------------------------------------------------------------------------------------*/
.text
.equ	num,	20								/*  Set number of words to be copied */

_start:
		ldr		r0, =src						/*  r0 = pointer to source block */
		ldr		r1, =dst						/*  r1 = pointer to destination block */
		mov		r2, #num						/*  r2 = number of words to copy */

		mov		sp, #0x400						/*  set up stack pointer (r13) */
blockcopy:       
		movs	r3,r2, LSR #3					/*  number of eight word multiples */
		beq		copywords						/*  less than eight words to move ? */

		stmfd	sp!, {r4-r11}					/*  save some working registers */
octcopy:
		ldmia	r0!, {r4-r11}					/*  load 8 words from the source */
		stmia	r1!, {r4-r11}					/*  and put them at the destination */
		subs	r3, r3, #1						/*  decrement the counter */
		bne		octcopy							/*  ... copy more */

		ldmfd	sp!, {r4-r11}					/*  don't need these now - restore originals */

copywords:
		ands	r2, r2, #7						/*  number of odd words to copy */
		beq		stop							/*  No words left to copy ? */
wordcopy:
		ldr		r3, [r0], #4					/*  a word from the source */
		str		r3, [r1], #4					/*  store a word to the destination */
		subs	r2, r2, #1						/*  decrement the counter */
		bne		wordcopy						/*  ... copy more */

stop:
		b		stop

/*------------------------------------------------------------------------------------------*/
/*	 								make a word pool					 				    */
/*------------------------------------------------------------------------------------------*/
.ltorg
src:
		.long		1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,1,2,3,4
dst:
		.long		0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

.end

⌨️ 快捷键说明

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