STR/LDR 到 ARMSim 中的内存# [英] STR/LDR to memory in ARMSim#

查看:24
本文介绍了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 寄存器.之后,它应该将 r2 内容存储在我内存的地址 4"中(我知道内存地址必须是 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.

这是怎么回事?我尝试查看其他站点,但它们的语法与我的相同,但我仍然无法使用 LDRSTR 将 r2 内容放入 r3.我知道我可以使用 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天全站免登陆