Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我的任务是完成一项家庭作业(我不会粉饰它),编写一个 32 位汇编程序,该程序使用循环和索引寻址来计算连续数组元素之间的间隙总和,它们是以非递减顺序。(例如:dwarray dword 0,2,5,9,10)
我不知道该怎么做是使用循环从数组中的第 n-1 个元素中减去数组的第 n 个元素。如果我这样做了,那么我会将结果存储在不同的寄存器中,并继续将结果添加到该寄存器中,直到到达最后一个元素。我只是希望指向正确的方向(我不是在寻找答案)。有没有人有什么建议?
由于您将使用循环,因此您需要一个等于数组中元素数减 1 的循环计数器。 方便的说明是add eax,[ebx+ecx*4]和sub eax,[ebx+ecx*4-4]
add eax,[ebx+ecx*4]
sub eax,[ebx+ecx*4-4]