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}  

  

posted @ 2014-06-27 13:28  李VS超  阅读(2614)  评论(0编辑  收藏  举报