ARM-汇编 helloworld

.section .data
.output: 
    .ascii "%s\n\000"
.str:
    .ascii "hello world\0"
.section .text

helloworld_helloworld_void:
    mov ip, sp  
    stmfd sp!, {fp,ip,lr,pc}  
    sub fp, ip, #4 
    sub sp, sp, #4
    
    @init
    str r1,[fp,#-16]
    ldr r0,[fp,#-16]
    
    @str="hello world"
    ldr r0,[r0,#0]
    ldr r0,=.str
    
    ldmea fp, {fp,sp,pc}  
    .global main
main: 
    mov ip, sp  
    stmfd sp!, {fp,ip,lr,pc}  
    sub fp, ip, #4 
    sub sp, sp, #80
    
    @create obj
    ldr r0,=-16
    sub r1,fp,r0
    bl  helloworld_helloworld_void
    
    @call str
    str r0,[fp,#-20]
    ldr r0,=.output
    ldr r1,[fp,#-20]
    bl  printf
    
    ldmea fp, {fp,sp,pc}  
    
    

 

posted @ 2014-06-29 10:24  李VS超  阅读(1025)  评论(0编辑  收藏  举报