Assembly 有人能解释一下这个简单的手臂动作是怎么做的吗?

Assembly 有人能解释一下这个简单的手臂动作是怎么做的吗?,assembly,arm,Assembly,Arm,所以,有一个过去的考试问题,我没有一个清楚的理解 “下面的ARM例程执行什么功能?” 功能是 int exam1(int array[], int size) stmfd sp!, {v1-v6, lr} mov a3,#0 elop: ldr a4, [a1], #4 movs a4,a4 addmi a3,a3,#1 subs a2,a2,#1 bne elop mov a1,a3 ldmfd sp!,{v1-v6,pc} 编辑: 我不知道每个命令在如何编辑寄存器/读取内存方面都做了什么

所以,有一个过去的考试问题,我没有一个清楚的理解

“下面的ARM例程执行什么功能?” 功能是

int exam1(int array[], int size)
stmfd sp!, {v1-v6, lr}
mov a3,#0
elop: ldr a4, [a1], #4
movs a4,a4
addmi a3,a3,#1
subs a2,a2,#1
bne elop
mov a1,a3
ldmfd sp!,{v1-v6,pc}
编辑:
我不知道每个命令在如何编辑寄存器/读取内存方面都做了什么

看看我是否还记得我的ARM汇编程序:

int exam1(int array[], int size)

stmfd sp!, {v1-v6, lr}    ; store registers v1-v6 plus link register on the stack
mov a3,#0                 ; zero register a3 - prospective count of negative numbers
elop:                     ; loop label
ldr a4, [a1], #4          ; load register a4 from the memory addr pointed to by a1 (first param)
                          ; and increment a1 by 4 bytes
movs a4,a4                ; move a4 to itself, but setting flags, so negative flag set
                          ; if the loaded value was negative
addmi a3,a3,#1            ; if the negative flag was set, increment a3
subs a2,a2,#1             ; subtract one from a2 (number of entries to process), setting flags
bne elop                  ; if a3 did not reach zero, loop
mov a1,a3                 ; move the result (number of negative numbers) into a1
ldmfd sp!,{v1-v6,pc}      ; restore v1-v6, and restore saved link register as pc, returning

如果您不理解助记符、符号或单个指令的含义,最好在参考指南中查找它们。

它计算数组中的负整数数。你不明白哪一部分?@Jongware为什么不解释一下呢?对不起,我没说清楚。我不知道每个命令在如何编辑寄存器/从内存读取方面都做了什么,因为对每一行的深入解释可能有多页长。因此,只解释OP不理解的部分更经济。啊——根据上面的评论,只需在线查找ARM规格。我提到的长达几页的解释可以在那里找到。