汇编语言和机器语言有什么关系?
汇编语言和机器语言(对于同一个底层系统)真的一样吗? 这两个概念有什么区别吗?
Are assembly language and machine language (for the same underlying system) really the same? Are there any differences between these two concepts?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(9)
汇编语言是人类可以理解的操作码(操作码)的符号编码,仅用于指示计算机处理器(硬件操作)和机器人(机器人操作)执行特定任务。 这是人类可以理解的语言。 该语言仅用于指导硬件操作,绝对不能用于创建软件程序。 汇编器用于将操作码(操作码)的符号编码部分转换为机器语言。 操作码(Opcode)是机器语言的一部分。
Assembly Language is the symbolic encode of opcode (operation code) that is understand by humans and only use to instruct computer processor (hardware operation) and robot (robotic operation) to perform specific tasks. This is an understandable language to human. This language is only use to instruct hardware operation and definitely not use to create software programme. A assembler is use to convert this symbolic encode part of opcode (operation code) into machine language. Operation Code (Opcode) is a part of machine language.
汇编语言是一种比机器语言更方便的机制。 使用汇编语言,您可以使用助记符序列而不是数字操作代码,并且可以使用符号标签而不是手动计算偏移量。 它还可以保护您免受真正愚蠢的错误 - 例如输入格式错误的处理器指令。
否则,汇编语言就相当于机器语言。 有时,您的旧汇编器不支持较新处理器的某些指令的助记符 - 那么您仍然可以将操作代码直接插入程序中。
Assembly language is a convenience mechanism over the machine language. With assembly language you use mnemonic sequences instead of numeric operation codes and can use symbolic labels instead of manually calculating offsets. It also protects you from really dumb errors - like typing a malformed processor instruction.
Otherwise the assembly language is the equivalent of the machine language. Sometimes you will have an old assembler that will not support mnemonics for some instructions of the newer processors - then you can still insert operation codes directly into the program.
机器语言是 CPU 操作码的“位编码”。
汇编语言是 CPU 操作码的“符号编码”。
因此,例如象征性地:
成为此位编码:
通常它是一对一的关系,但是某些汇编语言偶尔会具有额外的汇编指令,这些指令映射到多个机器代码指令或重用另一个操作码。 例如使用机器代码“xor R1,R1”作为“clr R1”或非常类似的东西。
此外,汇编语言将倾向于支持“宏编程”,这在汇编广泛使用的 80 年代使源代码具有更“高级”的外观。 我亲自编写了类似于“plot x,y”和“Hex Val”的汇编宏来简化常见操作。
例如:
Machine language is the "bit encoding" of a CPU's opcodes.
Assembly language is the "symbolic encoding" of a CPU's opcodes.
So for example symbolically:
Becomes this bit encoding:
Generally it's a one to one relationship, however some assembly languages will occasionally have extra assembly instructions that map to either multiple machine code instructions or reuse another opcode. Such as using machine code "xor R1,R1" as a "clr R1" or something very similar.
In addition, assembly languages will tend to support "macro programming" which, in the 80's when assembly was used extensively, gave the source code a more "high level" appearance. I've personally written assembly macros that looked like "plot x,y" and "Hex Val" to simplify common operations.
For example:
我找到了一个非常好的解释,想将其发布在这里,以便其他人可以阅读:
来源:机器语言和汇编语言有什么区别?
I found a really good explanation, thought to post it here, so that others could read it:
Source : What is difference between machine language and assembly language?
在汇编中,指令是 CPU 指令更容易理解的表示形式。
但是,汇编器还使寻址变得更容易:
这使得汇编更容易维护,特别是当地址之间的距离发生变化时。
In Assembly, instructions are easier-to-understand representations of CPU instructions.
But the assembler also makes, for example, addressing easier:
This makes assembly much easier to maintain, especially when the distance between the addresses changes.
机器语言是芯片能够理解的语言。 装配就是你所理解的。
每个汇编指令都有一个等效的机器语言指令。 x86 有一些单字节指令,但它们是可变长度的,最长可达 15 个字节(包括可选前缀)。
Machine language is what the chip understands. Assembly is what you understand.
Every assembly instruction has a machine language equivalent. x86 has a few single-byte instructions, but they're variable-length and can be up to 15 bytes long (including optional prefixes).
汇编级语言是通过允许程序员编写助记符而不是二进制代码(机器代码)来使编程变得简单的第一个有意识的步骤。
Assemble level language is the first conscious step towards making the programming simple by allowing the programmers to write mnemonics instead of binary code(machine code).
汇编语言首先由汇编器转换为机器语言。 它存储在内存(RAM)中,处理器/cup将其取出并从内存中存储到寄存器中,并按照指令集一一执行。
Assembly language is first converted to machine language by the assembler. which is stored in memory (RAM) processor/cup fetch it and store in from memory to register and follow the instruction set one after one.
机器语言
机器语言由 1 和 0 组成。 所以光看它很难理解。 所以如果我们要修改代码,那将是一个很大的问题。 机器语言也是一种编程语言(第一代)。我们的计算机CPU可以直接执行机器代码,无需任何汇编程序。
汇编语言
汇编语言由语法、数字和字母组成。 修改现有代码很容易。 所以我们的机器无法理解该程序。 所以机器使用汇编器将汇编语言代码转换为机器代码。
Machine Language
Machine language consists of ones and zeros. so it's so hard to understand by looking at it. so if we want to modify the code , it will be a huge problem. Machine languages is also a programming language(1st Gen).our computer CPU can directly execute that machine code without any assembler.
Assembly Language
assembly language consists of syntax , number , and letter. it's easy to modify existing code. so our machine cannot understand that program. so machine using an assembler to convert that assembly language code into machine code.