汇编代码可以跨平台吗?

发布于 2024-09-18 20:44:04 字数 196 浏览 7 评论 0原文

0x042444FF; /* inc dword ptr [esp+4] */

0x042444FF 是机器码,而 inc dword ptr [esp+4] 是汇编代码,我知道 机器代码不是跨平台的,因为它取决于许多因素。

汇编代码呢,它取决于CPU吗?

0x042444FF; /* inc dword ptr [esp+4] */

0x042444FF is the machine code,while inc dword ptr [esp+4] is the assembly code, I know
machine code is NOT cross-platform,as it depends on many factors.

What about assembly code, does it depends on CPU ?

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

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

发布评论

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

评论(2

清旖 2024-09-25 20:44:05

汇编代码不是跨平台的。

通常,机器指令和汇编指令之间存在非常直接的映射,因此汇编代码取决于体系结构。

来自维基百科

汇编语言是一种用于计算机、微处理器、微控制器和其他集成电路的低级编程语言。它实现了二进制机器代码和对特定 CPU 架构进行编程所需的其他常量的符号表示。这种表示通常由硬件制造商定义,并且基于表示处理步骤(指令)、处理器寄存器、内存位置和其他语言功能的助记符。 因此,汇编语言特定于某种物理(或虚拟)计算机体系结构。这与大多数高级语言形成鲜明对比,后者是理想的可移植性。

Assembly code is not cross platform.

Usually there is a very direct mapping between machine instructions and assembly instructions so the assembly code depends on the architecture.

From Wikipedia:

An assembly language is a low-level programming language for computers, microprocessors, microcontrollers, and other integrated circuits. It implements a symbolic representation of the binary machine codes and other constants needed to program a particular CPU architecture. This representation is usually defined by the hardware manufacturer, and is based on mnemonics that symbolize processing steps (instructions), processor registers, memory locations, and other language features. An assembly language is thus specific to a certain physical (or virtual) computer architecture. This is in contrast to most high-level languages, which are ideally portable.

镜花水月 2024-09-25 20:44:05

汇编代码基本上是机器代码的一种文字形式;它旨在使编写机器代码更加方便和可读。两者几乎是一对一的映射,因此一条汇编语句被转换为其等效的机器代码。机器代码依赖于 CPU。因此,汇编也依赖于 CPU。

Assembly code is basically a worded form of the machine code; it is designed to make writing machine code a little more convenient and readable. There is pretty much a one-to-one mapping of the two, so one assembly statement is turned into its machine code equivalent. Macine code is CPU-dependent. Assembly is therefore, also CPU-dependent.

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