hexadecimal value of opcodes

若如初见. 提交于 2020-06-25 21:50:11

问题


I created a very simple assembly program that prints the letter 'a' in DOS. 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?


回答1:


Here's a nice reference: http://ref.x86asm.net/coder32.html

As you can see:

  • CD is the opcode for int
  • 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



回答2:


Are Assembly x86 instructions:

  • B4: mov ah mean move in the register ah
  • B2: mov dx mean move in the register dx
  • CD: int means software interrupt

I recommend you read this guide assembly x86 http://www.cs.virginia.edu/~evans/cs216/guides/x86.html



来源:https://stackoverflow.com/questions/22886534/hexadecimal-value-of-opcodes

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!