1ARM
2ARM汇编指令集
2.1
2.1.1【MOV】
c
area reset, code, readonly
code32
entry
mov r0, #1
end
2.1.2【SUB】
c
area reset, code, readonly
code32
entry
mov r0, #0x02
sub r1, r0, #1
end
2.1.3【ORR】
c
preserve8
area reset, code, readonly
code32
entry
mov r0, #0X0F
mov r1, #2
orr r3, r0, #0X10;将r0寄存器第4位置1,结果放入r3
end
2.1.4【BIC】
c
preserve8
area reset, code, readonly
code32
entry
mov r0, #0X0F
mov r1, #2
bic r2, r0, #0X08;将r0寄存器第3位清0,结果放入r2
end
2.1.5【cmp】
c
/*比较2个数大小,并找到大的数*/
area reset, code, readonly
code32
entry
mov r1, #1
mov r2, #2
cmp r1, r2
movge r4, r1
movlt r4, r2
end
2.1.6【b】
c
area reset, code, readonly
code32
entry
;demo4
mov r1, #1
mov r2, #2
cmp r1, r2
bge greater
blt less
greater
mov r3, r1
b finish
less
mov r3, r2
finish
b finish
end
c
area reset, code, readonly
code32
entry
;demo5
mov r1, #0
mov r2, #0
loop
add r2, r2, r1
add r1, #1
cmp r1, #128
ble loop
finish
b finish
end
2.1.6.2【bl】
c
area reset, code, readonly
code32
entry
mov r1, #0
mov r2, #0
bl asm_add
nop
nop
nop
asm_add
add r1, r1,r2
mov pc, lr
;bx lr
finish
b finish
end
c
//【bl】指令完成数的累加