汇编指令集_汇编语言指令大全

汇编指令集_汇编语言指令大全,第1张

汇编指令集_汇编语言指令大全 如果你想写系统软件,两本入门书籍 — 谭浩强的《C 语言程序设计》和王爽的《汇编语言》是必看的。

谭老的 C 语言已相当成熟,王老师的汇编倒有个小缺陷—指令没有英文全称,或许他认为现在学编程的朋友都不记单词,如同新生代作家看不懂英文原著一般。

不过我觉得记住指令的英文全称,就不容易搞混,印象会更深刻,所以我把王爽书中出现的英文缩写的全称罗列出来,以便入门的朋友更好地记住它们。

8086CPU 提供以下几大类指令。

一、数据传送指令比如,mov(move)、push、pop、pushf(push flags)、popf(pop flags)、xchg(exchange)等都是数据传送指令,这些指令实现寄存器和内存、寄存器和寄存器之间的单个数据传送。

二、算术运算指令比如,add、sub(substract)、adc(add with carry)、sbb(substract with borrow)、inc(increase)、dec(decrease)、cmp(compare)、imul(integer multiplication)、idiv(integer divide)、aaa(ASCII add with adjust)等都是算术运算指令,这些指令实现寄存器和内存中的数据运算。

它们的执行结果影响标志寄存器的 sf、zf、of、cf、pf、af 位。

三、逻辑指令比如,and、or、not、xor(exclusive or)、test、shl(shift logic left)、shr(shift logic right)、sal(shift arithmetic left)、sar(shift arithmetic right)、rol(rotate left)、ror(rotate right)、rcl(rotate left through carry)、rcr(rotate right through carry)等都是逻辑指令。

除了 not 指令外,它们的执行结果都影响标志寄存器的相关标志位。

本帖隐藏的内容四、转移指令可以修改 IP,或同时修改 CS 和 IP 的指令统称为转移指令。

转移指令分为以下几类。

(1) 无条件转移指令,比如,jmp(jump);(2) 条件转移指令,比如,jcxz(jump if CX is zero)、je(jump if equal)、jb(jump if below)、ja(jump if above)、jnb(jump if not below)、jna(jump if not above)等;(3) 循环指令,比如,loop;(4) 过程,比如,call、ret(return)、retf(return far);(5) 中断,比如,int(interrupt)、iret(interrupt return)。

五、处理机控制指令这些指令对标志寄存器或其他处理机状态进行设置,比如,cld(clear direction)、std(set direction)、cli(clear interrupt)、sti(set interrupt)、nop(no operation)、clc(clear carry)、cmc(carry make change)、stc(set carry)、hlt(halt)、wait、esc(escape)、lock 等都是处理机控制指令。

六、串处理指令这些指令对内存中的批量数据进行处理,比如,movsb(move string byte)、movsw(move string word)、cmps(compare string)、scas(scan string)、lods(load string)、stos(store string)等。

若要使用这些指令方便地进行批量数据处理,则需要和 rep(repeat)、repe(repeat if equal)、repne(repeat if not equal)等前缀指令配合使用。

附:8086CPU 寄存器英文全称1、通用寄存器AX(accumulator)、BX(base)、CX(count)、DX(data)这些寄存器可以字(16 位)或字节(8 位)单位形式访问;SP(stack pointer)、BP(base pointer)、SI(source index)、DI(destination index),这些寄存器只能以字(16 位)单位形式访问。

2、专用寄存器IP(instruction pointer)、SP(stack pointer);;FLAGS 又称 PSW(program status word) 分为:① 条件码OF(overflow)、SF(sign)、ZF(zero)、CF(carry)、AF(auxiliary)、PF(parity)② 控制标志DF(direction)③ 系统标志位TF(trap)、IF(interrupt)、IOPL(I/O privilege level)3、段寄存器CS(code)、DS(data)、SS(stack)、ES(extra)汇编指令的英文全称一、数据传送指令1. 通用数据传送指令.MOV—-> moveMOVSX—->extended move with sign dataMOVZX—->extended move with zero dataPUSH—->pushPOP—->popPUSHA—->push allPOPA—->pop allPUSHAD—->push all dataPOPAD—->pop all dataBSWAP—->byte swapXCHG—->exchangeCMPXCHG—->compare and changeXADD—->exchange and addXLAT—->translate2. 输入输出端口传送指令.IN—->inputOUT—->output3. 目的地址传送指令.LEA—->load effective addressLDS—->load DSLES—->load ESLFS—->load FSLGS—->load GSLSS—->load SS4. 标志传送指令.LAHF—->load AH from flagSAHF—->save AH to flagPUSHF—->push flagPOPF—->pop flagPUSHD—->push dflagPOPD—->pop dflag二、算术运算指令ADD—->addADC—->add with carryINC—->increase 1AAA—->ascii add with adjustDAA—->decimal add with adjustSUB—->substractSBB—->substract with borrowDEC—->decrease 1NEC—->negativeCMP—->compareAAS—->ascii adjust on substractDAS—->decimal adjust on substractMUL—->multiplicationIMUL—->integer multiplicationAAM—->ascii adjust on multiplicationDIV—->divideIDIV—->integer divideAAD—->ascii adjust on divideCBW—->change byte to wordCWD—->change word to double wordCWDE—->change word to double word with sign to EAXCDQ—->change double word to quadrate word三、逻辑运算指令AND—->andOR—->orXOR—->xor Exclusive ORNOT—->notTEST—->testSHL—->shift leftSAL—->arithmatic shift left 算术SHR—->shift rightSAR—->arithmatic shift rightROL—->rotate leftROR—->rotate rightRCL—->rotate left with carryRCR—->rotate right with carry四、串指令MOVS—->move stringCMPS—->compare stringSCAS—->scan stringLODS—->load stringSTOS—->store stringREP—->repeatREPE—->repeat when equalREPZ—->repeat when zero flagREPNE—->repeat when not equalREPNZ—->repeat when zero flagREPC—->repeat when carry flagREPNC—->repeat when not carry flag五、程序转移指令1 > 无条件转移指令 (长转移)JMP—->jumpCALL—->callRET—->returnRETF—->return far2 > 条件转移指令 (短转移,-128 到 + 127 的距离内)JAE—->jump when above or equalJNB—->jump when not belowJB—->jump when belowJNAE—->jump when not above or equalJBE—->jump when below or equalJNA—->jump when not aboveJG—->jump when greaterJNLE—->jump when not less or equalJGE—->jump when greater or equalJNL—->jump when not lessJL—->jump when lessJNGE—->jump when not greater or equalJLE—->jump when less or equalJNG—->jump when not greaterJE—->jump when equalJZ—->jump when has zero flagJNE—->jump when not equalJNZ—->jump when not has zero flagJC—->jump when has carry flagJNC—->jump when not has carry flagJNO—->jump when not has overflow flagJNP—->jump when not has parity flagJPO—->jump when parity flag is oddJNS—->jump when not has sign flagJO—->jump when has overflow flagJP—->jump when has parity flagJPE—->jump when parity flag is evenJS—->jump when has sign flag3 > 循环控制指令 (短转移)LOOP—->loopLOOPE—->loop equalLOOPZ—->loop zeroLOOPNE—->loop not equalLOOPNZ—->loop not zeroJCXZ—->jump when CX is zeroJECXZ—->jump when ECX is zero4 > 中断指令INT—->interruptINTO—->overflow interruptIRET—->interrupt return5 > 处理器控制指令HLT—->haltWAIT—->waitESC—->escapeLOCK—->lockNOP—->no operationSTC—->set carryCLC—->clear carryCMC—->carry make changeSTD—->set directionCLD—->clear directionSTI—->set interruptCLI—->clear interrupt六、伪指令DW—->definw wordPROC—->procedureENDP—->end of procedureSEGMENT—->segmentASSUME—->assumeENDS—->end segmentEND—->endMove)MOVC (Move Code)MOVX (Move External)XCH (Exchange)PUSHPOPAJMP (Absolute Jump)LJMP (Long Jump)SJMP (Short Jump)JMP (Jump Indirect)JZ (Jump Zero)JNZ (Jump Not Zero)JC (Jump if Carry)JNC (Jump if Not Carry)JB (Jump if Bit is set)JNB (Jump if Not Bit)JBC (If Bit is set and Clear Bit)CJNE (Compare and Jump if Not Equal)DJNZ (Decrement and Jump if Not Zero)ACALL (Absolute Call)LCALL (Long Call)RET (Return)NOP (No Operation)ADDADDC (Add with Carry)SUBB (Substract with Borrow)MUL (Multiply)DIV (Divide)INC (Increment)DEC (Decrement)ANL (Logical AND)ORL (Logical OR)XRL (Logical Exclusive OR)CPL (Complement)CLR (Clear)SEBT (Set Bit)RL (Rotate Left)RR (Rotate Right)RLC (Rotate Left throught the Carry flag)RRC (Rotate Right throught the Carry flag)XCHDSWAPDA (Decimal Adjust)ORG (Origin)DB (Define Byte)DW (Define Word)EQU (Equal)DATAXDATA (External Data)BITEND

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/tougao/671890.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-04-19
下一篇 2022-04-19

发表评论

登录后才能评论

评论列表(0条)

保存