.text
.global _start
_start:
mov r0,#0x9
mov r1,#0x15
func:
cmp r0,r1
beq stop
subhi r0,r0,r1
subcc r1,r1,r0
b func
stop:
b stop
.end
用汇编实现for循环实现1~100相加 十进制:5050 十六进制:0x13BA
.text
.global _start
_start:
mov r0,#0x1
mov r1,#0x64
mov r2,#0x1
mov r3,#0x0
func1:
cmp r0,r1
addls r3,r3,r0
addls r0,r0,r2
bhi stop
b func1
stop:
b stop