简体   繁体   English

操作码的十六进制值

[英]hexadecimal value of opcodes

I created a very simple assembly program that prints the letter 'a' in DOS. 我创建了一个非常简单的汇编程序,在DOS中打印字母'a'。 I opened it in a hex editor and the result was this: 我在十六进制编辑器中打开它,结果如下:

Assembly code: 汇编代码:

mov ah, 2 
mov dx, 'a' 
int 21h 

Hex code 十六进制代码

B4 02 B2 61 CD 21

I wanted to understand how it was generated! 我想了解它是如何生成的! Like, I do not know if I'm right, but I realized that: 就像,我不知道我是对的,但我意识到:

B4 = mov ah 
02 = 2 
B2 = mov dx 
61 = 'a' 
CD = int 
21h = 21

The 02 , 61 and 21 I understood what turned but and B4 , B2 and CD ? 026121我明白了什么转身,但和B4B2CD

Here's a nice reference: http://ref.x86asm.net/coder32.html 这是一个很好的参考: http//ref.x86asm.net/coder32.html

As you can see: 如你看到的:

  • CD is the opcode for int CDint的操作码
  • B0+reg is the opcode for mov reg, imm8 , where reg is the destination register and as you can see from this table , ah = 100b and dx = 010b B0+regmov reg, imm8的操作码,其中reg是目标寄存器,从这个表中可以看出, ah = 100bdx = 010b

Are Assembly x86 instructions: 是汇编x86指令:

  • B4: mov ah mean move in the register ah B4:mov啊意思是在寄存器中移动啊
  • B2: mov dx mean move in the register dx B2:mov dx表示在寄存器dx中移动
  • CD: int means software interrupt CD:int表示软件中断

I recommend you read this guide assembly x86 http://www.cs.virginia.edu/~evans/cs216/guides/x86.html 我建议你阅读本指南程序集x86 http://www.cs.virginia.edu/~evans/cs216/guides/x86.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM