ORG 汇编指令有什么作用?

发布于 2024-09-12 16:14:16 字数 84 浏览 2 评论 0原文

谁能给我关于 ORG 指令的全面描述?
何时以及为何在汇编编写的应用程序中使用它?

在 x86 或 AMD64 上使用 Nasm。

can anyone give me a comprehensive description about ORG directive?
When and why is it used in assembly written applications?

Using Nasm on x86 or AMD64.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

雨巷深深 2024-09-19 16:14:16

ORG 用于设置汇编器位置计数器。这可能会也可能不会在链接时转换为加载地址。它可用于定义绝对地址,例如,在定义可能需要位于固定地址的中断向量之类的内容时,或者它可用于引入填充或为后续代码生成特定对齐方式。

ORG is used to set the assembler location counter. This may or may not translate to a load address at link time. It can be used to define absolute addresses, e.g. when defining something like interrupt vectors which may need to be at a fixed address, or it can be used to introduce padding or generate a specific alignment for the following code.

笑叹一世浮沉 2024-09-19 16:14:16

ORG 只是指示在哪里放置与当前段相关的下一段代码/数据。

将其用于固定地址是没有用的,因为最终地址取决于汇编时未知的段。

ORG is merely an indication on where to put the next piece of code/data, related to the current segment.

It is of no use to use it for fixed addresses, for the eventual address depends on the segment which is not known at assembly time.

故事还在继续 2024-09-19 16:14:16
      During the assemble time ORG directive resets the MLC (memory location counter) to the address specified in the ORG directive.

语法:ORG
注意:可以是无符号绝对值或任何符号或符号 + 。

示例:- 要观察该指令的工作情况,您需要任何使用 ORG 指令的汇编列表。

地点
0000A4 00 89 TAB DC 256AL1(*-TAB)
0001A4 00000194 90 组织 TAB+240
000194 F0F1F2F3F4F5F6F7 91 DC C'1234567'

上面的 TAB 符号被分配给 MLC 地址 0A4。在下一条指令中,ORG 将 MLC 设置为 TAB+240 地址位置,即 x'194'(~ x'A4' + 240,十进制)。
基本上这个设置是设置一个长度为 256 的表,从第 240 个位置开始存储一些字符常量,以便我可以将它用于 TR 指令。

      During the assemble time ORG directive resets the MLC (memory location counter) to the address specified in the ORG directive.

Syntax: ORG
note: may be a unsigned absolute value or any symbol or symbol + .

example:- to observe this instruction working you need any assemble listing which uses ORG directive.

location
0000A4 00 89 TAB DC 256AL1(*-TAB)
0001A4 00000194 90 ORG TAB+240
000194 F0F1F2F3F4F5F6F7 91 DC C'1234567'

Here in the above the TAB symbol is assigned to MLC address 0A4. in the next instruction ORG sets the MLC to TAB+240 address location which is x'194' (~ x'A4' + 240 in decimal).
basically this set up is setup a table with length 256 and from 240 th location to store some character constants so that I can use it for TR instruction.

洛阳烟雨空心柳 2024-09-19 16:14:16

ORG是起源的意思
ORG 用于微处理器和微控制器编程中的特定寻址。

例如:

.org 0000H

这意味着我们要从0000H地址启动我们的程序。

ORG means origin
ORG is used for specific addressing in microprocessor and microcontroller programming.

For example:

.org 0000H

This means we want to start our program from the 0000H address.

属性 2024-09-19 16:14:16

ORG(ORiGin 的缩写)是一条汇编指令,而不是一条指令。它定义机器代码(翻译后的汇编程序)在内存中的位置。至于ORG 100H,它处理80x86 COM 程序格式(COMMAND),它仅由一个最大64k 字节的段组成。此外,它还可用于定义绝对地址、引入填充或生成特定的对齐方式...

ORG (abbr. for ORiGin) is an assembly directive and is not an instruction. It defines where the machine code (translated assembly program) is to place in memory. As for ORG 100H this deals with 80x86 COM program format (COMMAND) which consists of only one segment with a maximum of 64k bytes. Also, It can be used to define absolute addresses, introduce padding, or generate a specific alignment...

滿滿的愛 2024-09-19 16:14:16

组织xxxx
ORG 不是汇编语言指令;它是一个
汇编指令指令。它告诉汇编器从这里开始的指令应该放置在位置
开始 xxxx

ORG xxxx
ORG is not an assembly language instruction; it is an
assembler directive instruction. It tells the assembler that the instruction from here onwards should be placed at location
starting xxxx

〆凄凉。 2024-09-19 16:14:16

它是您希望将二进制程序加载到的内存位置(如果有)。

我不想使用 org,而是直接向硬件发出操作码/值。
您始终可以将值存储在 ax 中并在 bx、cx、dx 之间传输。

我正在编写自己的汇编器来输出操作码/值,而不必担心在执行之前先将其发送到内存,

在读取操作码时当场执行操作码而不是尝试缓存它们要快得多内存中存在堆栈超载的风险,这可能会烧坏你的CPU

its the location in memory where you want the binary program to be loaded to, if any.

I prefer not to use org, and just issue out straight opcode/value to hardware.
you can always store values in ax and transfer between bx, cx, dx.

I'm writing my own assembler to dish out opcode/value without having to worry about sending it to memory first before executing,

Its so much faster just to execute opcodes on the spot as they're being read, rather than trying to cache them into memory risking overloading the stack which might burn out your cpu

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文