-6

I've been doing a software the last few days with the help of some people from here and now the code is finished but it seems to have some errors since it does not what it's suposed to.

The code is as follows:

            add r3,#1
            b .loop_ini

        .add_row:
            add r2,#1
            mov r3,#0
            b .loop_ini



            LDR r2,=0x0019660D
            umull r4,r5,r1,r2   @;RLo,RHi,N,M; r5 contains 32low bits from 
        .while_end:
            mov r0,r2           @;Movemos el resultado del modulo a r0
            pop {r1-r2,pc}          @;restores modified registers and returns

.end

Does anyone find any error? I think but don't know for sure that the error may be when inserting the random values into the matrix.

Thanks

4

1 回答 1

1

好吧,由于您没有提供有关代码预期功能的太多信息,因此我不得不进行一些猜测,但是引起我注意的第一件事是:

str r6, [r0]

据我所知, r0 应该是随机值, r6 应该是应该保存到的地址。

您必须在 中交换这两个str,因为 r0 现在用作地址,而 r6 作为要存储的值。

您还必须使用strb而不是str,至少看起来您想要使用字节,而不是完整的 32 位字。

我没有进一步研究它,可能还有更多问题。一般来说,代码似乎不是由具有 ARM 汇编经验的人编写的,它有很大的优化空间。TBH,除非您有充分的理由使用汇编,否则您应该考虑切换到 C 或其他高级语言。一个合适的编译器会生成更好的代码,让你不那么头疼。

于 2013-10-04T07:06:52.110 回答