ARM-底层/Day2

.text
.global _start
_start:
	mov r0,#9
	mov r1,#15
	bl cmp_func
	
cmp_func:
	cmp r0,r1
	beq stop  @相等则跳转结束  
	
	subhi r0,r0,r1
	subcc r1,r1,r0
	mov pc,lr  @不相等则返回执行
stop:	
	b stop
.end

循环实现1~100之间的和

.text
.global _start
_start:
	mov r0,#0
	mov r1,#1
	bl sum_func
	
sum_func:
	add r0,r1,r0
	add r1,#1
	
	cmp r1,#101
	beq stop
	mov pc,lr
stop:
	b stop
.end

猜你喜欢

转载自blog.csdn.net/weixin_57039874/article/details/130734681
今日推荐