STR / LDR内存在ARMSim# [英] STR/LDR to memory in ARMSim#

查看:407
本文介绍了STR / LDR内存在ARMSim#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个介绍性的分配要使用ARMSim#一个小程序(10行,最大)刚刚习惯了基本命令。

I have an introductory assignment to make a small program using ARMSim# (10 lines, maximum) just to get used to basic commands.

于是,我就这样做:

MOV r1, #4
MOV r2, #15
STR r2, [r1]
LDR r3, [r1]
SWI 0x11

此程序应该直接值4分配到R1寄存器,比分配直接值15到R2寄存器。在此之后,它应该保存在我的记忆中的地址4R2的内容(我知道的内存地址必须是4的倍数),最后,R3应该从地址4记忆的内容,但所有它得到0。

This program is supposed to assign the direct value "4" into r1 register, than assign the direct value "15" to r2 register. After that, it should store r2 content in "address 4" of my memory (I know the memory addresses must be multiples of 4) and finally, r3 should get the content from "address 4" memory, but all it gets is 0.

这有什么错呢?我试图寻找在其他网站,但它们的语法都和我一样,但我仍然不能设法R2内容投入使用R3 LDR STR 。我知道我可以使用 MOV 来做到这一点,但我的目的是学习一些新的指令。

What's wrong with it? I tried looking in other sites, but their syntax are the same as mine, but I still can't manage to put r2 content into r3 using LDR and STR. I know I could use MOV to do that, but my intention is to learn some new instructions.

推荐答案

我与ARMSim#版本1.9.1测试(20500)。

I'm testing with ARMSim# Version 1.9.1 (20500).

在MemoryView,对于地址0x00000004值为????????和一个地址0x00002004是81818181.在此,我认为地址0x00000004不可写在ARMSim#

In the MemoryView, the value for address 0x00000004 was ???????? and one for address 0x00002004 was 81818181. From this, i think that address 0x00000004 is not writable in ARMSim#

我的地址设置为0x00002004和它的工作。

I set the address to 0x00002004 and it worked.

MOV r1, #0x800
ADD r1, r1, r1
ADD r1, r1, r1
MOV r2, #4
ADD r1, r1, r2

MOV r2, #15

STR r2,[r1]

LDR r3, [r1]

SWI 0x11

这篇关于STR / LDR内存在ARMSim#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆