ARM汇编语言实现while循环

.section .data
.output: 
	.ascii "%d\n\000"
.section .text
	.global main
main: 
	mov ip, sp  
	stmfd sp!, {fp,ip,lr,pc}  
	sub fp, ip, #4 
	sub sp, sp, #80 

	@memory and register

	mov r3, # 1 
	mov r0,r3
		
loop: 
	cmp r0,# 15
	bge stop 
	mov r1,# 1  
	add r2, r0, r1 
	mov r0, r2 
	
	@保护现场
	str r0, [fp,#-16]	
	
	str r0,[fp,# -20 ] 
	ldr r0, =.output  
	ldr r1,[fp,# -20 ] 
	bl printf  
	
	@恢复现场
	ldr r0,[fp,#-16]

	b loop   
stop:
	ldmea fp, {fp,sp,pc}  

  

转载于:https://www.cnblogs.com/fistao/p/3811800.html

你可能感兴趣的:(ARM汇编语言实现while循环)