asm1_a.s

来自「英培特嵌入式开发系统IDE软件包」· S 代码 · 共 32 行

S
32
字号
#*********************************************************************************************
# NAME:		asm1_a.s																		 *
# Author: 	Embest																			 *
# Desc:		ARM instruction examples														 *
# History:	shw.He 2005.02.22																 *
#*********************************************************************************************

/*------------------------------------------------------------------------------------------*/
/*	 								constant define						 				    */
/*------------------------------------------------------------------------------------------*/
.equ	x, 45										/*  x=45 */
.equ	y, 64										/*  y=64 */
.equ	stack_top, 0x1000							/* define the top address for stacks */
.global _start

/*------------------------------------------------------------------------------------------*/
/*	 								code								 				    */
/*------------------------------------------------------------------------------------------*/
.text

_start:												/* code start */
		mov		sp, #stack_top
		mov		r0, #x								/* put x value into R0 */
		str		r0, [sp]							/* save the value of R0 into stacks  */
		mov		r0, #y								/* put y value into R0  */
		ldr		r1, [sp]							/* read the data from stack,and put it into R1 */
		ADD		r0, r0, r1
		STR		r0, [sp]
stop:
 		b		stop 								/* end the code ,cycling */
.end

⌨️ 快捷键说明

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