汇编指令

数据传输指令

  • MOV(Move):将数据从一个位置传输到另一个位置。
mov eax, ebx ; Move ebx to eax
  • PUSH(Push):将数据压入堆栈。
push eax ; Push eax onto the stack
  • POP(Pop):从堆栈中弹出数据。
pop eax ; Pop from the stack into eax
  • XCHG(Exchange):交换两个寄存器的值。
xchg eax, ebx ; Exchange eax and ebx
  • LEA(Load Effective Address):计算内存地址并将其加载到寄存器中。
lea eax, [ebx+4] ; Load effective address of [ebx+4] into eax

算术指令

  • ADD(Add):将两个操作数相加。
add eax, ebx ; Add ebx to eax
  • SUB(Subtract):将一个操作数从另一个操作数中减去。
sub eax, ebx ; Subtract ebx from eax
  • MUL(Multiply):无符号乘法。
mul ebx ; Multiply eax by ebx (unsigned)
  • IMUL(Integer Multiply):有符号乘法。
imul ebx ; Multiply eax by ebx (signed)
  • DIV(Divide):无符号除法。
div ebx ; Divide eax by ebx (unsigned)
  • IDIV(Integer Divide):有符号除法。
idiv ebx ; Divide eax by ebx (signed)
  • INC(Increment):将操作数加 1。
inc eax ; Increment eax by 1
  • DEC(Decrement):将操作数减 1。
dec eax ; Decrement eax by 1

逻辑指令

  • AND(Logical AND):按位与。
and eax, ebx ; Logical AND eax and ebx
  • OR(Logical OR):按位或。
or eax, ebx ; Logical OR eax and ebx
  • XOR(Logical XOR):按位异或。
xor eax, eax ; Logical XOR eax with eax (clear eax)
  • NOT(Logical NOT):按位取反。
not eax ; Logical NOT eax

控制流指令

  • JMP(Jump):无条件跳转。
jmp label ; Jump to label
  • JE / JZ(Jump if Equal / Jump if Zero):如果相等/零则跳转。
je label ; Jump to label if equal
  • JNE / JNZ(Jump if Not Equal / Jump if Not Zero):如果不相等/非零则跳转。
jne label ; Jump to label if not equal
  • JG / JNLE(Jump if Greater / Jump if Not Less or Equal):如果大于/不小于等于则跳转。
jg label ; Jump to label if greater
  • JGE / JNL(Jump if Greater or Equal / Jump if Not Less):如果大于等于/不小于则跳转。
jge label ; Jump to label if greater or equal
  • JL / JNGE(Jump if Less / Jump if Not Greater or Equal):如果小于/不大于等于则跳转。
jl label ; Jump to label if less
  • JLE / JNG(Jump if Less or Equal / Jump if Not Greater):如果小于等于/不大于则跳转。
jle label ; Jump to label if less or equal
  • CALL(Call):调用子程序。
call subroutine ; Call subroutine
  • RET(Return):从子程序返回。
ret ; Return from subroutine

比较指令

  • CMP(Compare):比较两个操作数。
cmp eax, ebx ; Compare eax and ebx
  • TEST(Test):按位与比较。
test eax, eax ; Test eax (logical AND eax with eax)

移位和旋转指令

  • SHL / SAL(Shift Logical Left / Shift Arithmetic Left):逻辑左移/算术左移。
shl eax, 1 ; Shift eax left by 1 bit
  • SHR(Shift Logical Right):逻辑右移。
shr eax, 1 ; Shift eax right by 1 bit
  • SAR(Shift Arithmetic Right):算术右移。
sar eax, 1 ; Arithmetic shift eax right by 1 bit
  • ROL(Rotate Left):循环左移。
rol eax, 1 ; Rotate eax left by 1 bit
  • ROR(Rotate Right):循环右移。
ror eax, 1 ; Rotate eax right by 1 bit

字符串操作指令

  • MOVSB(Move String Byte):将字节从源字符串移动到目标字符串。
movsb ; Move byte from [esi] to [edi]
  • MOVSW(Move String Word):将字从源字符串移动到目标字符串。
movsw ; Move word from [esi] to [edi]
  • MOVSD(Move String Doubleword):将双字从源字符串移动到目标字符串。
movsd ; Move doubleword from [esi] to [edi]
  • CMPSB(Compare String Byte):比较源字符串和目标字符串的字节。
cmpsb ; Compare byte at [esi] with byte at [edi]
  • CMPSW(Compare String Word):比较源字符串和目标字符串的字。
cmpsw ; Compare word at [esi] with word at [edi]
  • CMPSD(Compare String Doubleword):比较源字符串和目标字符串的双字。
cmpsd ; Compare doubleword at [esi] with doubleword at [edi]
  • STOSB(Store String Byte):将字节存储到目标字符串。
stosb ; Store byte in al at [edi]
  • STOSW(Store String Word):将字存储到目标字符串。
stosw ; Store word in ax at [edi]
  • STOSD(Store String Doubleword):将双字存储到目标字符串。
stosd ; Store doubleword in eax at [edi]
  • LODSB(Load String Byte):从源字符串加载字节。
lodsb ; Load byte at [esi] into al
  • LODSW(Load String Word):从源字符串加载字。
lodsw ; Load word at [esi] into ax
  • LODSD(Load String Doubleword):从源字符串加载双字。
lodsd ; Load doubleword at [esi] into eax
  • SCASB(Scan String Byte):扫描目标字符串的字节。
scasb ; Compare byte at [edi] with al
  • SCASW(Scan String Word):扫描目标字符串的字。
scasw ; Compare word at [edi] with ax
  • SCASD(Scan String Doubleword):扫描目标字符串的双字。
scasd ; Compare doubleword at [edi] with eax

输入/输出指令

  • IN(Input):从端口读取数据。
in al, dx ; Read byte from port dx into al
  • OUT(Output):向端口写入数据。
out dx, al ; Write byte from al to port dx

系统指令

  • HLT(Halt):停止处理器执行。
hlt ; Halt the processor
  • NOP(No Operation):无操作。
nop ; No operation
  • STI(Set Interrupt Flag):设置中断标志。
sti ; Set interrupt flag
  • CLI(Clear Interrupt Flag):清除中断标志。
cli ; Clear interrupt flag
  • STOSB(Store String Byte):将字节存储到目标字符串。
stosb ; Store byte in al at [edi]

总结

x86 指令集非常庞大,以上列出的只是其中的一部分。对于完整的 x86 指令集,可以参考 Intel 或 AMD 的官方文档。

本技术内容仅供学习和交流使用,如有疑问请联系qq2014160588并注明来意。请确保在使用过程中遵守相关法律法规。任何因使用本技术内容而导致的直接或间接损失,作者概不负责。用户需自行承担因使用本技术内容而产生的所有风险和责任。请勿将本技术内容用于任何非法用途。
上一篇
下一篇