![計算機組成原理與接口技術(shù)課件-第8次課_第1頁](http://file4.renrendoc.com/view/0ca50208e684429fb427ddb497451527/0ca50208e684429fb427ddb4974515271.gif)
![計算機組成原理與接口技術(shù)課件-第8次課_第2頁](http://file4.renrendoc.com/view/0ca50208e684429fb427ddb497451527/0ca50208e684429fb427ddb4974515272.gif)
![計算機組成原理與接口技術(shù)課件-第8次課_第3頁](http://file4.renrendoc.com/view/0ca50208e684429fb427ddb497451527/0ca50208e684429fb427ddb4974515273.gif)
![計算機組成原理與接口技術(shù)課件-第8次課_第4頁](http://file4.renrendoc.com/view/0ca50208e684429fb427ddb497451527/0ca50208e684429fb427ddb4974515274.gif)
![計算機組成原理與接口技術(shù)課件-第8次課_第5頁](http://file4.renrendoc.com/view/0ca50208e684429fb427ddb497451527/0ca50208e684429fb427ddb4974515275.gif)
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
Chapter1
The80x86MicroprocessorTHE80x86IBMPCANDCOMPATIBLECOMPUTERSCHAPTER1MainContent
Registersofthe80x86MOVandADDinstructionsCodesegment,Datasegment,StacksegmentandExtrasegmentLogicaladdressandPhysicaladdressPUSHandPOPinstructionsFlagregisterAddressingmodesofthe8086
Sec.1.2Insidethe8088/8086CHAPTER1Figure1-1InternalBlockDiagramofthe8088/86CPU(ReprintedbypermissionofIntelCorporation,
CopyrightIntelCorp.1989)Sec.1.2Insidethe8088/8086RegistersCHAPTER1
Differentregistersinthe8088/86areusedfordifferentfunctions.Thefirstletterofeachregisterindicatesitsuse.AXisusedfortheaccumulator.BXisabaseaddressingregister.CXisacounterinloopoperations.DXpointstodatainI/Ooperations.Sec.1.2Insidethe8088/8086RegistersCHAPTER1
Differentregistersinthe8088/86areusedfordifferentfunctions.Sec.1.3IntroductiontoassemblyprogrammingCHAPTER1
Aprogramthatconsistsof0sand1siscalledmachinelanguage.Assemblylanguagesprovidesmnemonicsforthemachinecodeinstructions,plusotherfeaturesthatmadeprogrammingfasterandlesspronetoerror.Assemblylanguageprogramsmustbetranslatedintomachinecodebyaprogramcalledanassembler.Assemblylanguageisreferredtoasalow-levellanguagebecauseitdealsdirectlywiththeinternalstructureoftheCPU.
CHAPTER1
OneofthemostcommonlyusedassemblersisMASMbyMicrosoft.Othertools:LinkDebug
Debug.execanbefoundinC:\windows\system32\OS(XP)
Sec.1.3IntroductiontoassemblyprogrammingSec.1.3IntroductiontoassemblyprogrammingMOVinstructionCHAPTER1
Simplystated,theMOVinstructioncopiesdatafromonelocationtoanother.Ithasthefollowingformat:MOVdestination,source;copysourceoperandtodestinationThefollowingprogramfirstloadsCLwithvalue55H,thenmovesthisvaluearoundtovariousregistersinsidetheCPU.MOVCL,55HMOVDL,CLMOVAH,DLTheuseof16-bitregistersisdemonstratedbelow.MOVCX,468FHMOVAX,CXMOVDX,AXSec.1.3IntroductiontoassemblyprogrammingMOVinstructionCHAPTER1Inthe8086CPU,datacanbemovedamongalltheregistersshowninTable1-2(excepttheflagregister)aslongasthesourceanddestinationregistersmatchinsize.Codesuchas“MOVAL,DX”willcauseanerror.Theexceptionoftheflagregistermeansthatthereisnosuchinstructionas“MOVFR,AX”.Datacanbemoveddirectlyintononsegmentregistersonly,usingtheMOVinstruction.Forexample,MOVAX,58FCH;LEGALMOVDX,6678H;LEGALMOVSI,924BH;LEGALMOVBP,2459H;LEGALMOVDS,2341H;ILLEGALMOVCX,8876H;LEGALMOVCS,3F47H;ILLEGALMOVBH,99H;LEGALSec.1.3IntroductiontoassemblyprogrammingMOVinstructionCHAPTER1Fromthediscussionabove,notethefollowingthreepoints:1.Valuescannotbeloadeddirectlyintoanysegmentregister(CS,DS,ES,orSS).MOVAX,2345H;load2345HintoAXMOVDS,AX;thenloadthevalueofAXintoDS
MOVDI,1400H;load1400HintoDIMOVES,DI;thenmoveitintoES,nowES=DI=14002.IfavaluelessthanFFHismovedintoa16-bitregister,therestofthebitsareassumedtobeallzeros.Forexample,in“MOVBX,5”theresultwillbeBX=0005;thatisBH=00andBL=05.3.Movingavaluethatistoolargeintoaregisterwillcauseanerror.MOVBL,7F2H;ILLEGAL:7F2Hislargerthan8bitsMOVAX,2FE456h;ILLEGALSec.1.3IntroductiontoassemblyprogrammingMOVinstructionCHAPTER1Inthe8086CPU,datacanbemovedamongalltheregisters,aslongasthesourceanddestinationregistersmatchinsize(Excepttheflagregister.)Thereisnosuchinstructionas"MOVFR,AX".Codesuchas"MOVAL,DX"willcauseanerror.Onecannotmovethecontentsofa16-bitregister
intoan8-bitregister.Sec.1.3IntroductiontoassemblyprogrammingADDinstructionCHAPTER1
TheADDinstructionhasthefollowingformat:ADDdestination,source;ADDthesourceoperandtothedestinationToaddtwonumberssuchas25Hand34H,eachcanbemovedtoaregisterandthenaddedtogether:MOVAL,25H;move25intoALMOVBL,34H;move34intoBLADDAL,BL;AL=AL+BLTheprogramabovecanbewritteninmanyways,dependingontheregistersused.Anotherwaymightbe:MOVDH,25H;move25intoDHMOVCL,34H;move34intoCLADDDH,CL;addCLtoDH:DH=DH+CLSec.1.3IntroductiontoassemblyprogrammingADDinstructionCHAPTER1
Itisnotnecessarytomovebothdataitemsintoregistersbeforeaddingthemtogether.MOVDH,25H;loadoneoperandintoDHADDDH,34H;addthesecondoperandtoDHTheprogramabovecanbewritteninmanyways,dependingontheregistersused.Anotherwaymightbe:MOVDH,25H;move25intoDHMOVCL,34H;move34intoCLADDDH,CL;addCLtoDH:DH=DH+CLThelargestnumberthatan8-bitregistercanholdisFFH.MOVAX,34EH;move34EHintoAXMOVDX,6A5H;move6A5HintoDXADDDX,AX;addAXtoDX:DX=DX+AXAgain,any16-bitnonsegmentregisterscouldhavebeenusedtoperformtheactionabove.E.g.MOVCX,34EH;ADDCX,6A5HSec.1.4IntroductiontoprogramsegmentsCHAPTER1
AtypicalAssemblylanguageprogramconsistsatleastthreesegments:acodesegment,adatasegment,andastacksegment.ThecodesegmentcontainstheAssemblylanguageinstructionsthatperformthetasksthattheprogramwasdesignedtoaccomplish.Thedatasegmentisusedtostoreinformation(data)thatneedstobeprocessedbytheinstructionsinthecodesegment.Thestackisusedtostoreinformationtemporarily.
Sec.1.4IntroductiontoprogramsegmentsCHAPTER1Asegmentisanareaofmemorythatincludesupto64Kbytesandbeginsonanaddressevenlydivisibleby16(Suchanaddressendsin0H).The8088/86canonlyhandleamaximumof64Kbytesofcodeand64Kbytesofdataand64Kbytesofstackatanygiventime,althoughithasarangeof1megabyteofmemorybecauseofits20addresspins(220=1megabyte).
Howtomovethiswindowof64Kbytestocoverall1megabyteofmemory?Sec.1.4IntroductiontoprogramsegmentsLogicaladdressandphysicaladdressCHAPTER1
InIntelliteratureconcerningthe8086,therearethreetypesofaddressesmentionedfrequently:thephysicaladdress,theoffsetaddress,andthelogicaladdress.Thephysicaladdressisthe20-bitaddressthatisactuallyputontheaddresspinsofthe8086microprocessorsanddecodedbythememoryinterfacingcircuitry.Thisaddresscanhavearangeof00000HtoFFFFFHforthe8086andreal-mode286,386,and486CPUs.ThisisanactualphysicallocationinRAMorROMwithinthe1megabytememoryrange.Theoffsetaddressisalocationwitha64K-bytesegmentrange.There,anoffsetaddresscanrangefrom0000HtoFFFFH.Thelogicaladdressconsistsofasegmentvalueandanoffsetaddress.Sec.1.4IntroductiontoprogramsegmentsCodesegmentCHAPTER1
ThelogicaladdressofaninstructionalwaysconsistsofaCS(codesegment)andanIP(instructionpointer),showninCS:IPformat.
CSIP00523F59:StartwithCS.ShiftleftCS.AddIP.0052000523F5E2Sec.1.4IntroductiontoprogramsegmentsCodesegmentCHAPTER1Example1-1
IfCS=24F6HandIP=634AH,show:ThelogicaladdressTheoffsetaddressAndcalculate:(c)Thephysicaladdress(d)Thelowerrange(e)TheupperrangeofthecodesegmentSolution:24F6:634A(b)634A(c)2B2AA(24F60+634A)(d)24F60(24F60+0000)(e)34F5F(24F60+FFFF)Sec.1.4IntroductiontoprogramsegmentsLogicaladdressvs.physicaladdressinthecodesegment
ThethreecolumnsshowthelogicaladdressofCS:IP,themachinecodestoredatthataddressandthecorrespondingAssemblylanguagecode.ADDAX,1F35H05351F1132:0112ADDCX,BX01D91132:0110ADDAX,DX01D01132:010EMOVAH,20HB4201132:010CMOVBL,9FHB39F1132:010AMOVBH,AL88C71132:0108MOVCX,DX89D11132:0106MOVDL,72HB2721132:0104MOVDH,86HB6861132:0102MOVAL,57HB0571132:0100AssemblylanguagemnemonicsandoperandMachinelanguageOpcodeandoperandLogicaladdressCS:IPSec.1.4IntroductiontoprogramsegmentsLogicaladdressvs.physicaladdressinthecodesegment
ThethreecolumnsshowthelogicaladdressofCS:IP,themachinecodestoredatthataddressandthecorrespondingAssemblylanguagecode.MOVAL,57HB0571132:0100AssemblylanguagemnemonicsandoperandMachinelanguageOpcodeandoperandLogicaladdressCS:IPInstruction"MOVAL,57"hasamachinecodeofB057.B0istheopcodeand57istheoperand.Thebyteataddress1132:0100containsB0,theopcodeformovingavalueintoregisterAL.Address1132:0101containstheoperandtobemovedtoAL.Sec.1.4IntroductiontoprogramsegmentsDatasegmentCHAPTER1
Assumethataprogramisbeingwrittentoadd5bytesofdata,suchas25H,12H,15H,1FH,and2BH,whereeachbyterepresentsaperson’sdailyovertimepay.Onewaytoaddthemisasfollows.MOVAL,00HADDAL,25HADDAL,12HADDAL,15HADDAL,1FHADDAL,2BHIntheprogramabove,thedataandcodearemixedtogetherintheinstructions.Theproblemwithwritingtheprogramthiswayisthatifthedatachanges,thecodemustbesearchedforeveryplacethedataisincluded,andthedataretyped.Sec.1.4IntroductiontoprogramsegmentsDatasegmentCHAPTER1Thefollowingdemonstrateshowdatacanbestoredinthedatasegmentandtheprogramrewrittensothatitcanbeusedforanysetofdata.Assumethattheoffsetforthedatasegmentbeginsat200H.Thedataisplacedinmemorylocations:DS:0200=25H;DS:0201=12H;DS:0202=15H;DS:0203=1FH;DS:0204=2BHAndtheprogramcanberewrittenasfollows:MOVAL,00HADDAL,[0200]ADDAL,[0201]ADDAL,[0202]
ADDAL,[0203]ADDAL,[0204]Sec.1.4IntroductiontoprogramsegmentsDatasegmentCHAPTER1The8086/88allowsonlytheuseofregistersBX,SI,andDIasoffsetregistersforthedatasegment.Inotherwords,whileCSusesonlytheIPregisterasanoffset,DSusesonlyBX,DI,andSItoholdtheoffsetaddressofthedata.Thetermpointerisoftenusedforaregisterholdinganoffsetaddress.Inthefollowingexample,BXisusedasapointer:MOVAL,00HMOVBX,0200HADDAL,[BX]INCBXADDAL,[BX]INCBXADDAL,[BX]
Sec.1.4IntroductiontoprogramsegmentsLogicaladdressandphysicaladdressinthedatasegmentCHAPTER1
Thephysicaladdressfordataiscalculatedusingthesamerulesasforthecodesegment.Example1-2
AssumetheDSis5000andoffsetis1950.Calculatethephysicaladdressofthebyte.Solution:DS:offset00050591:StartwithDS.ShiftDS
left.Addtheoffset.00050000505915Sec.1.4IntroductiontoprogramsegmentsLogicaladdressandphysicaladdressinthedatasegmentCHAPTER1Example1-3
IfDS=7FA2Handtheoffsetis438EH,Calculatethephysicaladdress.(b)Calculatethelowerrange.(c)Calculatetheupperrangeofthedatasegment.(d)Showthelogicaladdress.Solution:83DAE(7FA20+438E)(b)7FA20(7FA20+0000)(c)8FA1F(7FA20+FFFF)(d)7FA2:438EExample1-4AssumethattheDSregisteris578C.Toaccessagivenbyteofdataatphysicalmemorylocation67F66,doesthedatasegmentcovertherangewherethedataislocated?Ifnot,whatchangesneedtobemade?Solution:No,sincetherangeis578C0to678BF,location67F66isnotincludedinthisrange.Toaccessthatbyte,DSmustbechangedsothatitsrangewillincludethatbyte.Sec.1.4IntroductiontoprogramsegmentsLittleendianconventionCHAPTER1
Previousexamplesused8-bitor1-bytedata.Inthiscasethebytesarestoredoneafteranotherinmemory.Whathappenswhen16-bitdataisused?MOVAX,35F3HMOV[1500],AXIncaseslikethis,thelowbytegoestothelowmemorylocationandthehighbytesgoestothehighmemoryaddress.DS:1500=F3DS:1501=35Example1-5Assumememorylocationswiththefollowingcontents:DS:6826=48andDS:6827=22.ShowthecontentsofregisterBXintheinstructionMOVBX,[6826]Solution:DS:6826=48DS:6827=22BHBL4822Sec.1.5Moreaboutsegmentsinthe80x86Whatisastack?CHAPTER1
Thestackisasectionofread/writememory(RAM)usedbytheCPUtostoreinformationtemporarily.TheCPUneedsthisstorageareasincethereareonlyalimitednumberofregisters.SincethestackisinRAM,ittakesmuchlongertoaccesscomparedtoaccesstimeofregisters.Sec.1.5Moreaboutsegmentsinthe80x86HowstacksareaccessedCHAPTER1
ThetwomainregistersusedtoaccessthestackaretheSS(stacksegment)andSP(stackpointer)register.Theseregistersmustbeloadedbeforeanyinstructionsaccessingthestackareused.ThestoringofaCPUregisterinthestackiscalled
apush
,andloadingthecontentsofthestackintotheCPUregisteriscalled
apop.
Theprincipleis“Lastin,Firstout”.Sec.1.5Moreaboutsegmentsinthe80x86PushontothestackCHAPTER1
WhenPUSHisexecuted,thecontentsoftheregisteraresavedonthestackandSPisdecrementedby2.Foreverybyteofdatasavedonthestack,SPisdecrementedonce,andsincepushissavingthecontentsofa16-bitregister,itisdecrementedtwice,
PoppingthecontentsofthestackbackintotheCPUregisteristheoppositeprocessofpushing.Sec.1.5Moreaboutsegmentsinthe80x86MoreaboutPushandPOPCHAPTER1
PushIP;ILLEGALPOPIP;ILLEGAL
Push1234H;ILLEGALin8086legalin80286
PUSHAandPOPAarelegalinstructionsin80286,PUSHAcopiesAX,CX,DX,BX,SP,BP,DI,andSItothestack.POPAremovesthewordcontentsforthefollowingregistersfromthestack:SI,DI,BP,SP,BX,DX,CX,AX.Sec.1.5Moreaboutsegmentsinthe80x86PushingontothestackCHAPTER1Sec.1.5Moreaboutsegmentsinthe80x86PoppingthestackCHAPTER1Sec.1.5Moreaboutsegmentsinthe80x86Logicaddressvs.physicaladdressforthestackCHAPTER1
Theexactphysicallocationofthestackdependsonthevalueofthestacksegment(SS)andSP,thestackpointer.ThelogicaddressisSS:SP.Tocomputerthephysicaladdressforthestack,thesameprincipleisappliedaswasusedforthecode(CS:IP)anddatasegment(DS:BX,DS:DIorDS:SI).
Sec.1.5Moreaboutsegmentsinthe80x86Afewmorewordsaboutsegmentsinthe80x86CHAPTER1Asinglephysicaladdresscanbelongtomanydifferentlogicaladdresses.E.g.Logicaladdress(hex)
Physicaladdress(hex)1000:5020150201500:0020150201502:0000150201400:1020150201302:200015020Sec.1.5Moreaboutsegmentsinthe80x86Afewmorewordsaboutsegmentsinthe80x86CHAPTER1WhenaddingtheoffsettotheshiftedsegmentregisterresultsinanaddressbeyondthemaximumallowedrangeofFFFFFH,wrap-aroundwilloccur.Sec.1.5Moreaboutsegmentsinthe80x86OverlappingCHAPTER1Incalculatingthephysicaladdress,itispossiblethattwosegmentscanoverlap,whichisdesirableinsomecircumstances.Sec.1.5Moreaboutsegmentsinthe80x86FlagregisterCHAPTER1Sixflags,calledconditionalflags,indicatesomeconditionresultingafteraninstructionexecutes.Thesesixare
CF,PF,AF,ZF,SF,and
OF.Theremainingthree,oftencalledcontrolflags,control
theoperationofinstructionsbeforetheyareexecuted.Sec.1.5Moreaboutsegmentsinthe80x86CodesfortheFlagRegisterCHAPTER1NC(nocarry)CY(carry)CFcarryflagPO(parityodd)PE(parityeven)PFparityflagNA(noauxiliarycarry)AC(auxiliarycarry)AFauxiliarycarryflagNZ(notzero)ZR(zero)ZFzeroflagPL(plus,orpositive)NG(negative)SFsignflagDI(disableinterrupt)EI(enableinterrupt)IFinterruptflagUP(up)DN(down)DFdirectionflagNV(nooverflow)OV(overflow)OFoverflowflagCodeWhenReset(=0)CodeWhenSet(=1)FlagSec.1.5Moreaboutsegmentsinthe80x86FlagregisterandADDinstructionCHAPTER1TheoverflowflagwillbecoveredinChapter6,sinceitrelatesonlytosignednumberarithmetic.Example1-10
Showhowtheflagregisterisaffectedbytheadditionof38Hand2FH.Solution:MOVBH,38H;BH=38HADDBH,2FH;add2FtoBH,nowBH=67H3800111000+2F
001011116701100111CF=0sincethereisnocarrybeyondd7PF=0sincethereisanoddnumberof1sintheresultAF=1sincethereisacarryfromd3tod4ZF=0sincetheresultisnotzeroSF=0sinced7oftheresultiszeroSec.1.5Moreaboutsegmentsinthe80x86FlagregisterandADDinstructionCHAPTER1
Thesameconceptsapplyfor16-bitaddition,asshowninExample1-12.Example1-13
ShowhowtheflagregisterisaffectedbyMOVAX,AAAAH;AX=AAAAHADDAX,5556H;nowAX=0000HSolution:AAAA10101010
1010
1010+5556
0101010101010110000000000000
00000000CF=1sincethereisacarrybeyond
d15PF=1sincethereisanevennumberof1s
inthelowerbyteAF=1sincethereisacarryfromd3tod4ZF=1sincetheresultiszeroSF=0sinced15oftheresultiszeroSec.1.5Moreaboutsegmentsinthe80x86UseofthezeroflagforloopingCHAPTER1
Oneofthemostwidelyusedapplicationsoftheflagregisteristheuseofzeroflagtoimplementprogramloops.MOVCX,05H;CXholdstheloopcountMOVBX,0200H;BXholdstheoffsetdataaddressMOVAL,00H;initializeALADD_LP:ADDAL,[BX];addthenextbytetoALINCBX;incrementthedatapointerDECCX;decrementtheloopcounterJNZADD_LP;jumptonextiterationifcounternotzeroSec.1.680x86addressingmodesCHAPTER1
TheCPUcanaccessoperands(data)invariousways,calledaddressingmodes.Thenumberofaddressingmodesisdeterminedwhenmicroprocessorisdesignedandcannotbechanged.The80x86providesatotalofsevendistinctaddressingmodes:1.Register2.Immediate3.Direct4.Registerindirect5.Basedrelative6.Indexedrelative7.BasedindexedrelativeSec.1.680x86addressingmodesRegisteraddressingmodeCHAPTER1
Theregisteraddressingmodeinvolvestheuseofregisterstoholdthedatatobemanipulated.
Memoryisnotaccessed
whenthisaddressingmodeisexecuted;therefore,itisrelativelyfast.MOVBX,DXMOVES,AXADDAL,BH
Itshouldbenotedthatthesourceanddestinationregistersmustmatchinsize.Sec.1.680x86addressingmodesImmediateaddressingmodeCHAPTER1
Intheimmediateaddressingmode,thesourceoperandisaconstant.Immediateaddressingmodecanbeusedtoloadinformationintoanyoftheregisters
exceptthesegmentregistersandflagregisters.Examples:MOVAX,2550H;move2550HintoAXMOVCX,625;loadthedecimalvalue625intoCXMOVBL,40H;load40HintoBLTomoveinformationtothesegmentregisters,thedatamustfirstbemovedtoageneral-purposeregisterandthentothesegmentregister.Example:MOVAX,2550HMOVDS,AXInotherwords,thefollowingwouldproduceanerror:MOVDS,0123H;illegal!!!Sec.1.680x86addressingmodesDirectaddressingmodeCHAPTER1
ThisaddressistheoffsetaddressandonecancalculatethephysicaladdressbyshiftinglefttheDSregisterandaddingittotheoffsetasfollows:MOVDL,[2400];movecontentsofDS:2400HintoDLExample1-15
Findthephysicaladdressofthememorylocationanditscontentsaftertheexecutionofthefollowing,assumingthatDS=1512H.MOVAL,99HMOV[3518H],ALSolution:FirstALisinitializedto99H,theninlinetwo,thecontentsofALaremovedto
logicaladdress
DS:3518H
whichis
1512:3518.ShiftingDSleftandaddingittotheoffsetgivesthephysicaladdressof
18638H(15120H+3518H=18638H).
Thatmeansaftertheexecutionofthesecondinstruction,thememorylocationwithaddress18638Hwillcontainthevalue99H.Sec.1.680x86addressingmodesRegisterindirectaddressingmodeCHAPTER1
Theregistersusedforthispurposeare
SI,DI,andBX.Iftheseregistersareusedaspointers,thatis,iftheyholdtheoffsetofthememorylocation,theymustbecombinedwith
DSinordertogeneratethe20-bitphysicaladdress.MOVAL,[BX];movesintoALthecontentsofthememorylocation;pointed
tobyDS:BXMOVCL,[SI];movecontentsofDS:SIintoCLMOV[DI],AH;movecontentsofAHintoDS:DIExample1-16AssumethatDS=1120,SI=2498,andAX=17FE.ShowthecontentsofmemorylocationsaftertheexecutionofMOV[SI],AXSolution:ThecontentsofAXaremovedintomemorylocationswithlogicaladdressDS:SIandDS:SI+1.Lowaddress13698HcontainFE,andhighaddress13699Hcontains17H.Sec.1.680x86addressingmodesBasedrelativeaddressingmodeCHAPTER1
Inthebasedrelativeaddressingmode,baseregistersare
BXandBP.Thedefaultsegmentsare
DSforBXandSSforBP.Forexample:MOVCX,[BX]+10;moveDS:BX+10andDS:BX+10+1intoCX;PA=DS(shiftedleft)+BX+10
AlternativecodingsareMOVCX,[BX+10]orMOVCX,10[BX]InthecaseoftheBPregister,MOVAL,[BP]+5;PA=SS(shiftedleft)+BP+5Again,alternativecodingsareMOVAL,[BP+5]orMOVAL,5[BP]Sec.1.680x86addressingmodesIndexedrelativeaddressingmodeCHAPTER1
Theindexedrelativeaddressingmodeworksthesameasthebasedrelativeaddressingmode,exceptthatregistersDIandSIholdtheoffsetaddress.Examples:MOVDX,[SI]+5;PA=DS(shiftedleft)+SI+5MOVCL,[DI]+20;PA=DS(shiftedleft)+DI+20Example1-17AssumethatDS=4500,SS=2000,BX=2100,SI=1486,DI=8500,BP=7814,andAX=2512.ShowtheexactphysicalmemorylocationwhereAXisstoredineachofthefollowing.Allvaluesareinhex.MOV[BX]+20,AX(b)MOV[SI]+10,AX(c)MOV[DI]+4,AX(d)MOV[BP]+12,AXSolution:DS:BX+20location47120=(12)and47121=(25)DS:SI+10
location46496=(12)and46497=(25)DS:DI+4
location4D504=(12)and4D505=(25)SS:BP+12
location27826=(12)and27827=(25)Sec.1.680x86addressingmodesBasedindexedaddressingmodeCHAPTER1
Bycombiningbasedandindexedaddressingmodes,anewaddressingmodeisderivedcalledthebasedindexedaddressingmode.MOVCL,[BX][DI]+8;PA=DS(shiftedleft)+BX+DI+8MOVCH,[BX][SI]+20;PA=DS(shiftedleft)+BX+SI+20MOVAH,[BP][DI]+12;PA=
SS
(shiftedleft)+BP+DI+12MOVAH,[BP][SI]+29;PA=
SS
(shiftedleft)+BP+SI+29Thecodingoftheinstructionsabovecanvary;forexample,thelastexamplecouldhavebeenwrittenMOVAH,[BP+SI+29]OrMOVAH,[SI+BP+29]NotethatMOVAX,“[SI][DI]+displacement”is
illegal.Sec.1.680x86addressingmodesSegmentoverridesCHAPTER1Table1-3:OffsetRegistersforVariousSegmentsSP,BPSI,DI,BXSI,DI,BXIPOffsetregister(s):SSESDSCSSegmentregister:Table1-4:SampleSegmentOverridesDS:BX+DI+32SS:BX+DI+32MOVSS:[BX][DI]+32,AXDS:BX+12ES:BX+12MOVCX,ES:[BX]+12SS:BPDS:BPMOVAX,DS:[BP]DS:SISS:SIMOVDX,SS:[SI]SS:BPCS:BPMOVAX,CS:[BP]DefaultSegmentSegmentUsedInstructionSec.1.680x86addressingmodesSummaryCHAPTER1Table1-5:Summaryof80x86addressingmodesDS,DSSS,SS[BX][SI]+disp,[BX][DI]+disp[BP][SI]+disp,[BP][DI]+dispBasedindexedrelativeDS,DS[DI]+disp,[SI]+dispIndexedrelativeDS,SS[BX]+disp,[BP]+dispBasedrelativeDS,DS,DS[BX],[SI],[DI]Registerindirect
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2020幼兒園幼兒膳食工作總結(jié)-幼兒園食堂工作總結(jié)范文5篇
- 2025年度教育類在線考試系統(tǒng)開發(fā)合同
- 2025年度特殊景觀植物引種與應用合同
- 2025年度網(wǎng)絡安全防護技術(shù)合同范本
- 2025年度醫(yī)療設備養(yǎng)護與故障快速響應合同
- 2025年度智能物流配送平臺建設合同
- 2025年度大型商業(yè)綜合體消防設施供水供電合同協(xié)議書
- 2025年度荒灘綜合養(yǎng)殖區(qū)特許經(jīng)營權(quán)出讓合同
- 電信網(wǎng)絡與物聯(lián)網(wǎng)的融合發(fā)展趨勢
- 2025年度綜合交通樞紐監(jiān)理分公司技術(shù)服務協(xié)議
- 全國初中數(shù)學競賽分類匯編及解析
- 06歲兒童眼保健知識培訓課件
- 企業(yè)商業(yè)秘密保護操作指引(2023版)
- 三年級數(shù)學口算題300道 (可直接打印)
- 益生芽孢桿菌體外抑菌活性及耐藥性研究
- 2023數(shù)聯(lián)網(wǎng)(DSSN)白皮書
- ISO17025經(jīng)典培訓教材
- 消防設施操作和維護保養(yǎng)規(guī)程
- 反面典型案例剖析材料范文(通用6篇)
- 餐飲行業(yè)品牌介紹商務宣傳PPT模板
- 關(guān)于中小企業(yè)人才流失的調(diào)查分析報告畢業(yè)論文
評論
0/150
提交評論