首页 > 代码库 > ARM汇编基础--几个简单实例

ARM汇编基础--几个简单实例

实例1:

求1+2+3+......+100的和, 并将结果存入0x80000100地址空间中.

 1     area text, code, readonly
 2     entry   
 3     code32   
 4 start
 5     mov r1, #0   
 6     mov r2, #100   
 7 loop
 8     add r3, r3, r1 ;累加  
 9     add r1, r1, #1 ;自增   
10     cmp r1, r2   
11     ble loop   
12     ldr r2, =0x80000100   
13     str r3, [r2]   ;保存结果
14     nop   
15 end

 

ARM汇编基础--几个简单实例