汇编 assembly.docx
- 文档编号:15385172
- 上传时间:2023-07-04
- 格式:DOCX
- 页数:25
- 大小:23.55KB
汇编 assembly.docx
《汇编 assembly.docx》由会员分享,可在线阅读,更多相关《汇编 assembly.docx(25页珍藏版)》请在冰点文库上搜索。
汇编assembly
8080汇编(8080assembly)
(longtransfer)
JMPtransferinstructionsunconditionally
CALLprocedureCALL
RET/RETFprocessreturns.
2>conditionaltransferinstructions(shorttransfer,-128to+127)
Whenandonlyif(SFXOROF)=1,OP1 JA/JNBEisnotlessthanornotequalto. JAE/JNBisgreaterthanorequaltotransfer. JB/JNAEislessthanthetransfer. JBE/JNAislessthanorequaltotransfer. Theabovefour,testtheresultofunsignedintegerarithmetic(markCandZ). JG/JNLEisgreaterthanthetransfer. JGE/JNLisgreaterthanorequaltotransfer. JL/JNGEislessthanthetransfer. JLE/JNGislessthanorequaltotransfer. Theabovefour,thetestbandsymbolintegerarithmeticresult(signS,OandZ). JE/JZisthetransfer. JNE/JNZdoesnotequaltimetransfer. JCistransferredwhenitisin. WhenJNCisnotentered,itistransferred. WhenJNOdoesnotoverflow,transfer. TheJNP/JPOparityisshiftedwhenodd. TheJNSsymbolbitismovedwhen"0". JOoverflow. TheJP/JPEparityistransferredwhentheevennessiseven. TheJSsymbolismovedwhen"1". 3>loopcontrolinstruction(shortshift) LOOPCXisnotazerocycle. LOOPE/LOOPZCXisnotzeroandmarksZ=1. LOOPNE/LOOPNZCXisnotzeroandmarksZ=0. PUSHandPOP Function: presstheoperandsintooroutofthestack Syntax: PUSHoperandPOPoperands Format: PUSHrPUSHdataPOPrPOPM PUSHFPOPF,PUSHAPOPA Function: stackinstructiongroup Format: PUSHFPOPFPUSHAPOPA LEA,typicalvmlinux.lds,LES Function: taketheaddresstoregister Grammar: LEAr,mLDSr,mLESr,m XLAT(XLATB) Function: checktableinstruction Syntax: XLATXLATm Arithmeticinstruction ADD,ADC Function: addinstruction Syntax: ADDOP1,OP2ADCOP1,OP2 Format: ADDr1,r2ADDr,mADDm,rADDr,data Impactsigns: C,P,A,Z,S,O SUB,SBB Function: subtractioninstruction Syntax: SUBOP1,OP2SBBOP1,OP2 Format: SUBr1,r2SUBr,mSUBm,rSUBr,dataSUBm,data Impactsigns: C,P,A,Z,S,O INCandDEC Function: addorsubtractthevalueoftheOP Syntax: INCOPDECOP Format: INCr/mDECr/m Impactsigns: P,A,Z,S,O NEG Function: reversesymbolofOP(binarycomplement) Grammar: NEGOP Format: NEGr/m Impactsigns: C,P,A,Z,S,O TheMUL,IMUL Function: multiplicationinstructions Grammar: MULOPIMULOP Format: MULr/mIMULr/m Impactsign: C,P,A,Z,S,O(onlyIMULwillaffectSlogo) DIV,IDIV Function: divisioninstruction Syntax: DIVOPIDIVOP Format: DIVr/mIDIVr/m CBW,CWD Function: symbolnumberextensioninstruction Grammar: CBWCWD AAA,AAS,AAM,AAD Function: non-pressureBCDcodeoperationadjustmentinstruction Grammar: AAAAASAAMAAD Impactsigns: A,C(AAA,AAS)S,Z,P(AAM,AAD) DAA,DAS Function: compressedBCDcodetuninginstructions Syntax: DAADAS Impactsigns: C,P,A,Z,S Bitoperationinstructionset AND,OR,XOR,NOTTEST Function: performsthelogicaloperationbetweenBITandBIT Grammar: ANDr/m,r/m/dataORr/m,r/m/dataXORr/m,r/m/dataTESTr/m,r/m/dataNOTr/m Theimpactsign: C,O,P,Z,S(whereCandOaresetto0)NOTcommanddoesNOTaffectanyflagbit SHR,SHL,SAR,SAL Function: shiftinstruction Syntax: SHR/m,data/CLSHLr/m,data/CLSARr/m,data/CLSALr/m,data/CL Impactsigns: C,P,Z,S,O ROR,ROL,RCR,RCL Function: loopshiftinstruction Syntax: RORr/m,data/CLROLr/m,data/CLRCRr/m,data/CLRCLr/m,data/CL Impactsigns: C,P,Z,S,O Programprocesscontrolinstructionset CLC,onSTC,CMC Function: setsthecarryflag Grammar: CLCSTCCMC Markbit: C CLD,STD Function: settingthedirectionsign Syntax: CLDSTD Markposition: D CLI,STI Function: setsinterruptflag Syntax: CLISTI Markbit: I CMP Function: compareOP1andOP2values Syntax: CMPr/m,r/m/data Markbit: C,P,A,Z,O JMP Function: jumptothespecifiedaddresstoexecute Syntax: JMPaddress JXX Function: jumptothespecifiedaddresswhenaspecificconditionisestablished Syntax: JXXaddress Note: A: ABOVE,whenC=0,Z=0 B: BELOW,whenC=1 C: CARRY,whentheCXZ: CXZ: thevalueoftheCXregisteris0(ZERO) E: EQUAL,whenZisEQUALto1 G: GREATER(GREATERthan),whenZ=0andS=0 L: LESSthan)whenSisnotzero N: NOT(onthecontrary)needtobeusedinconjunctionwithothersymbols O: OVERFLOW,O=1 P: PARITY,P=1 PE: PARITYEVEN,P=1isestablished PO: PARITYODD,P=0 S: SIGN,S=1 Z: ZERO,Z=1 LOOP Function: circularinstructionset Syntax: LOOPaddress LOOPE(Z) Address: LOOPNE(Z)address Flagposition: no CALL,RET Function: subroutinecall,returninstruction Grammar: CALLaddressRETRET Flagbit: no INT,IRET Function: interruptcallandreturninstructions Grammar: INTnIRET Flagposition: whenexecutingINT,theCPUwillautomaticallypushthevalueoftheflagregistertothestack,andwhenIRETisexecuted,theflagvalueinthestackwillbebouncedbacktotheregister Stringoperationinstructionset MOVSBMOVSW,MOVSD Function: stringtransferinstruction MOVSBMOVSWMOVSD Flagbit: no CMPSBCMPSW,CMPSD Function: stringcomparisoninstruction Syntax: CMPSBCMPSWCMPSD Markbit: C,P,Z,S,O SCASB,SCASW Function: stringsearchinstruction Grammar: SCASBSCASW Markbit: C,P,Z,S,O LODSBLODSW,STOSBSTOSW Function: stringloadorstorageinstruction Grammar: LODSBLODSWstosstosw Flagposition: no REP. REPE,REPNE Function: repeattheprefixinstructionset Syntax: theREPcommandSREPEinstructionS Markposition: accordingtoorderS Method1: switchupanddown Methodtwo: equivalentsubstitutionmethod Themostdifficulttomasterisapartofassemblyknowledge Push-poppusheaxtopopeax Je-JNZje41000changedJNZ41000 Add--subaddecx,2,subecx,minus2 JEtoJMP ChangetheTESTXOR JLEchangeJL NOP.JMPaddress MOVandXORtransposition TheADDtransposition JEtoJMP 75to74 TheTESTtotheOR Jbetojb 38to37 CALLandMOVtransposition JAtoJG ChangeJNZJMP ChangetheTESTAND FindanewdirectiveequivalenttoJNZ ThegeneralchangeisJNZ--ja YoucanalsochangeittoJNZ--jno Datatransferinstruction ────────────────────────────── Theytransmitdatabetweenthememoryandtheregister,theregister,andtheinputandoutputports. 1.Generaldatatransferinstructions. MOVsendswordorbyte. TheMOVSXfirstsymbolexpands,thentransmits. MOVZXstartswithzeroextensionandthentransfers. PUSHthewordintothestack. POPputstheworduponthestack. PUSHAputsAX,CX,DX,BX,SP,BP,SI,andDIonthestack. POPApopsupthestackofDI,SI,BP,SP,BX,DX,CXandAX. PUSHADputsEAX,ECX,EDX,EBX,ESP,EBP,ESI,EDIonthestackinturn. POPADpopsupthestackofEDI,ESI,EBP,ESP,EBX,EDX,ECX,EAX. BSWAPswaptheorderofbytesin32-bitregisters XCHGexchangewordorbyte.(atleastoneoperandisaregisterandthesegmentregisterisnotoperable.) CMPXCHGcomparesandexchangesoperands.(thesecondoperandmustbetheaccumulatorAL/AX/EAX) TheXADDfirstexchangesandthenaccumulates.(theresultisinthefirstoperand) XLATbytelookuptabletransformation. ──BXpointtothestartingpointofa256-bytelist,ALforthetableindexvalue(0-255,namely 0-FFH);ReturnsALtochecktheresultsofthetable.([BX+AL]->AL) 2.Inputandoutputportinstructions. INI/Oportinput.(syntax: INaccumulator,{port│DX}) OUTI/Oportoutput.(syntax: OUT│DX}{port,theaccumulator) Whentheinputoutputportisspecifiedinanimmediateway,therangeis0-255;WhenspecifiedbyregisterDX, Therangeis0minus65535. 3.Destinationaddresstransferinstruction. LEAloadsthevalidaddress. Example: LEADX,string;SavetheoffsetaddresstoDX. LDSpassesthetargetpointerandloadsthepointercontentsintoDS. Example: LDSSI,string;Savetheaddress: offsetaddresstoDS: SI. LESpassesthetargetpointerandloadsthepointercontentsintoES. Example: LESDI,string;Takethesegmentaddress: offsetaddresstoES: DI. LFSpassesthetargetpointerandloadsthepointercontentintoFS. Example: LFSDI,string;Savetheaddress: offsetaddresstoFS: DI. LGSpassesthetargetpointerandloadsthepointercontentintoGS. Example: LGSDI,string; Address: offsetaddresstoGS: DI. LSSpassesthetargetpointerandloadsthepointercontentsintoSS. Example: LSSDI,string;Savetheaddress: offsetaddresstoSS: DI. 4.Flagtransferinstruction. LAHFflagregistertransmission,loadthemarkintoAH. TheSAHFflagregisteristransmittedandtheAHcontentisloadedintotheflagregister. PUSHFmarksthestack. POPFmarksthestack. PUSHD32-bitmarksareonthestack. POPD32bitmarksoutofthestack. Arithmeticoperationinstruction ────────────────────────────── TheADDaddition. ADCbringsinaddition. INC. ASCIIadjustmentofAAAaddition. ThedecimaladjustmentofDAAaddition. SUBsubtraction. SBBtakestheborrowingandsubtraction. DEC1. NECasksforthereverse. CMP.(thetwooperandsaresubtracted,andonlythemarkbitsaremodifiedandtheresultsarenotreturned.) AASsubtractionofASCIIcodeadjustment. ThedecimaladjustmentofDASsubtraction. MULwithoutsymbolmultiplication. IMULintegermultiplication. SothesetwothingsaregoingtoreturnAHandAL(bytearithmetic),orDXandAX(wordarithmetic), ASCIIadjustmentforAAMmultiplication. DIVunsigneddivision. IDIVintegerdivision. Theabovetworesultsaresentback: ReturntheAL,theremainderofthereturntoAH,(bytearithmetic); OrthequotientbacktoAX,andtheremaindertotheDX,(wordoperation). TheASCIIcodeadjustmentofAADdivision. CBWbytesareconvert
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 汇编 assembly