Lecture4:DataTransfer,Addressing,andArithmeticAssemblyLanguageforIntel-puters,-relatedOperatorsandDirectivesIndirectAddressingJMPandLOOPInstructionsDataTransferInstructionsOperandTypesImmediateoperands(imm):ThedataisaconstantRegisteroperands(reg):Thedataitemisinaregister ---(mem):Thedataitemisinmemory----99fordetailsDataTransferInstructionsMOVInstructionCopiesdataGeneralformatMOVdestination,sourceFormats-legaloperandsMOVreg,regMOVreg,memMOVmem,regMOVreg,immedMOVmem,immedimmedmeansaconstantSourceanddestinationmusthavethesamesize"reg"canbeanyregisterexceptDoesnotchangeflagNote:MemorytomemorymovesarenotallowedDataTransferInstructionsMOVInstructionRulesIPSegmentregistersusespecialrules -tobeusedonlywhentheprogramrunsinrealmode -CScannotbeatargetoperand -bValdb20wValdw0AAAAhdValDWORD0FEDCBA09h.code…movAL,10 movEAX,10movBX,wValmovdVal,ECX;.386requiredmovCX,bValmovDH,1234;illegal;illegalImmediateoperandsdonothavealengthattributeDataTransferInstructionsZero/SignExtensionofIntegersMOVZXInstructionMOVSXInstructionCopiesthecontentsofasourceoperandintoadestinationoperandandzero-extendsthevaluetoeither16or32bitsOnlyusedwithunsignedintegersCopiesthecontentsofasourceoperandintoadestinationoperandandsign-extendsthevaluetoeither16or32bitsOnlyusedwithsignedintegersDataTransferInstructionsZero/bValdb20wValSWORD8AAAhdValDWORD0FEDCBA09h.code…movAL,bValmovBX,wValmovzxECX,ALmovSXEDX,wValmovSX,EAX,1234ECX=?EDX=?Anythingwrong?DataTransferInstructionsXCHGInstructionXCHGexchangesthecontentsofsourceanddestingationFormatxchgreg,regxchgreg,memxchgmem,regExamples:xchgAX,BXxchgAH,bDataxchgwData,CXmov'srulesapply,doesnotchangeflagsDataTransferInstructionsLAHFandSAHFInstructionsLAHFSAHFCopiesthelowbyteoftheEFLAGSregisterintoAHExample
Lecture4DataTransfer,Addressing,andArithmetic 来自淘豆网www.taodocs.com转载请标明出处.