在LC-3汇编语言中,如何将这些命令转换为机器代码?
对于我的一门课,我需要用机器代码编写一个 LC-3 程序,但我似乎找不到带有句点的命令的机器代码:
.ORIG
.END
.BLKW
等等
有人知道它们是什么吗?我已完成所有命令,例如: AND R2, R2, #0
--> 0101 010 010 1 00000
但是我找不到 .ORIG
、.END
、.BLKW 的前四位
命令可在任何地方在线使用。
For one of my classes I need to write an LC-3 program in machine code and I can't seem to find the machine codes for the commands that have a period for them:
.ORIG
.END
.BLKW
etc
Does anyone know what they are? I have all of the commands done, for example:AND R2, R2, #0
--> 0101 010 010 1 00000
However I can't find what the first four bits for the .ORIG
, .END
, .BLKW
commands are anywhere online.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不熟悉您的特定方言,但在大多数汇编语言中,以
.
开头的关键字不是指令助记符,而是汇编程序指令。在您的情况下,看起来可能.ORIG
表示程序的开始,而.END
表示程序的结束。.BLKW
看起来像是某种内存填充操作。编辑:我进行了谷歌搜索,并得出了此演示文稿 。它说
.ORIG
描述了将以下块放置在内存中的位置。例如,.ORIG 0x3000
会将下一条指令设置在地址0x3000
处。.END
,正如我上面提到的,描述了程序的结束。.BLKW
表示“块字”,用于保留空间以用作数组等。在所有情况下,这些指令都没有任何特定的机器代码。对于
.ORIG
,只需在指定位置写出以下操作码或数据即可。.END
根本不会出现在机器代码中,而.BLKW
意味着您可以直接将指定字节从汇编程序复制到机器代码中。I'm not familiar with your particular dialect, but in most assembly languages, keywords starting with a
.
aren't instruction mnemonics but assembler directives. In your case, it looks like possibly.ORIG
means the start of a program and.END
the end..BLKW
seems like a memory filling operation of some kind.Edit: I did a google search and came up with this presentation. It says that
.ORIG
describes where to place the following block in memory. For example.ORIG 0x3000
would set the next instruction at address0x3000
..END
, as I mentioned above, describes the end of the program..BLKW
means "block word" and is used to reserve space for use as an array, for example.In all cases, there aren't any specific machine codes for these directives. For
.ORIG
, just write out the following opcodes or data at the specified location..END
won't show up in the machine code at all, and.BLKW
means you can just copy the specified bytes directly from the assembly program into machine code.