在 MIPS 汇编中将元素从一个数组复制到另一个数组
我是 MIPS 的新手,一直在尝试将元素从一个数组复制到另一个数组。我不确定该怎么做。数组的大小并不重要,但为了这样做,我们只说它的大小为 10。我对 MIPS 循环有点弱,并且对如何继续感到有点困惑。
add $s0, $zero, $zero
add $t0, $zero, $zero
lui $s0, 0x1001
ori $s0,$s0,0
lui $t0, 0x1001
ori $t0, $t0, 0x0040
我的初始化是 $s0 是第一个数组中第一个元素的地址,$t0 是第二个数组中第一个元素的地址。
I'm new at MIPS and have been trying to copy elements from one array to another. I'm unsure about how to go about this. It doesn't really matter what size the array is but lets just say for the sake of doing it that its size 10. I am little weak with MIPS loops and am kind of confused on how to proceed.
add $s0, $zero, $zero
add $t0, $zero, $zero
lui $s0, 0x1001
ori $s0,$s0,0
lui $t0, 0x1001
ori $t0, $t0, 0x0040
There my initialization with $s0 being the address first element in the first array and $t0 being the address of the first element in the 2nd one.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不相信你提供的代码是正确的,但假设它是正确的,你会做这样的事情:
免责声明:自从大学以来我就没有在 MIPS 中编程过,所以这个代码可能不是 100% 准确,但我相信它会给为您提供一个起点。
I do not believe the code you have provided is correct, but assuming it is, you would do something like this:
Disclaimer: I have not programmed in MIPS since college so this code may not be 100% accurate, but I believe it will give you a place to start.