5/12/2015 ProgramsFor8085MicroprocessorLearners
http://scanftree.com/microprocessor/ProgramsFor8085MicroprocessorLearners 1/12
Togglenavigation Scanftree.com
DataStructureOperatingSystemCGraphTheoryMicroprocessorDBMS
DatabaseConceptSQLSQLite
ExamplesCJAVAC++
ExtraCheatSheetsSEOIFSCCodes
Microprocessor
1. Advantages&Disadvantages2. ApplicationsofMicroprocessors3. EvolutionandClassification
Microprocessor8085
1. Architechture2. Pindescription3. AddressingModes4. BusStructure5. Interrupts6. InstructionSet7. ProgramsLevel18. ProgramsLevel2
Microprocessor8086
1. Architechture2. Pindescription
5/12/2015 ProgramsFor8085MicroprocessorLearners
http://scanftree.com/microprocessor/ProgramsFor8085MicroprocessorLearners 2/12
DMA8237
1. Introduction2. BlockDiagram3. Pindescription
Advertisment
Alstom'sInternetusagepolicyrestrictsaccesstothiswebsite.
Store8bitdatainmemory
Program1:MVIA,52H:"Store32Hintheaccumulator"STA4000H:"Copyaccumulatorcontentsataddress4000H"HLT:"Terminateprogramexecution"
Program2:LXIH:"LoadHLwith4000H"MVIM:"Store32HinmemorylocationpointedbyHLregisterpair(4000H)"HLT:"Terminateprogramexecution"
Note:Theresultofbothprogramswillbethesame.Inprogram1directaddressinginstructionisused,whereasinprogram2indirectaddressinginstructionisused.
729
Like
Share
5/12/2015 ProgramsFor8085MicroprocessorLearners
http://scanftree.com/microprocessor/ProgramsFor8085MicroprocessorLearners 3/12
Exchangethecontentsofmemorylocations
Statement:Exchangethecontentsofmemorylocations2000Hand4000H.
Program1:LDA2000H:"Getthecontentsofmemorylocation2000Hintoaccumulator"MOVB,A:"SavethecontentsintoBregister"LDA4000H:"Getthecontentsofmemorylocation4000Hintoaccumulator"STA2000H:"Storethecontentsofaccumulatorataddress2000H"MOVA,B:"GetthesavedcontentsbackintoAregister"STA4000H:"Storethecontentsofaccumulatorataddress4000H"
Program2:LXIH2000H:"InitializeHLregisterpairasapointertomemorylocation2000H."LXID4000H:"InitializeDEregisterpairasapointertomemorylocation4000H."MOVB,M:"Getthecontentsofmemorylocation2000HintoBregister."LDAXD:"Getthecontentsofmemorylocation4000HintoAregister."MOVM,A:"StorethecontentsofAregisterintomemorylocation2000H."MOVA,B:"CopythecontentsofBregisterintoaccumulator."STAXD:"StorethecontentsofAregisterintomemorylocation4000H."HLT:"Terminateprogramexecution."
Note:InProgram1,directaddressinginstructionsareused,whereasinProgram2,indirectaddressinginstructionsareused.
Addtwo8bitnumbers
Statement:Addthecontentsofmemorylocations4000Hand4001Handplacetheresultinmemorylocation4002H.
Sampleproblem(4000H)=14H(4001H)=89HResult=14H+89H=9DHSourceprogramLXIH4000H:"HLpoints4000H"MOVA,M:"Getfirstoperand"INXH:"HLpoints4001H"ADDM:"Addsecondoperand"INXH:"HLpoints4002H"MOVM,A:"Storeresultat4002H"HLT:"Terminateprogramexecution"
5/12/2015 ProgramsFor8085MicroprocessorLearners
http://scanftree.com/microprocessor/ProgramsFor8085MicroprocessorLearners 4/12
Subtracttwo8bitnumbers
Statement:Subtractthecontentsofmemorylocation4001Hfromthememorylocation2000Handplacetheresultinmemorylocation4002H.
Program:Subtracttwo8bitnumbersSampleproblem:(4000H)=51H(4001H)=19HResult=51H19H=38HSourceprogram:LXIH,4000H:"HLpoints4000H"MOVA,M:"Getfirstoperand"INXH:"HLpoints4001H"SUBM:"Subtractsecondoperand"INXH:"HLpoints4002H"MOVM,A:"Storeresultat4002H"HLT:"Terminateprogramexecution"
Addtwo16bitnumbers
Statement:Addthe16bitnumberinmemorylocations4000Hand4001Htothe16bitnumberinmemorylocations4002Hand4003H.Themostsignificanteightbitsofthetwonumberstobeaddedareinmemorylocations4001Hand4003H.Storetheresultinmemorylocations4004Hand4005Hwiththemostsignificantbyteinmemorylocation4005H.
Sampleproblem:(4000H)=15H(4001H)=1CH(4002H)=B7H(4003H)=5AHResult=1C15+5AB7H=76CCH(4004H)=CCH(4005H)=76HSourceProgram1:LHLD4000H:"GetfirstI6bitnumberinHL"XCHG:"SavefirstI6bitnumberinDE"LHLD4002H:"GetsecondI6bitnumberinHL"MOVA,E:"Getlowerbyteofthefirstnumber"ADDL:"Addlowerbyteofthesecondnumber"MOVL,A:"StoreresultinLregister"MOVA,D:"Gethigherbyteofthefirstnumber"ADCH:"AddhigherbyteofthesecondnumberwithCARRY"MOVH,A:"StoreresultinHregister"
5/12/2015 ProgramsFor8085MicroprocessorLearners
http://scanftree.com/microprocessor/ProgramsFor8085MicroprocessorLearners 5/12
SHLD4004H:"StoreI6bitresultinmemorylocations4004Hand4005H"HLT:"Terminateprogramexecution"
Sourceprogram2:LHLD4000H:GetfirstI6bitnumberXCHG:SavefirstI6bitnumberinDELHLD4002H:GetsecondI6bitnumberinHLDADD:AddDEandHLSHLD4004H:StoreI6bitresultinmemorylocations4004Hand4005H.HLT:Terminateprogramexecution
NOTE:Inprogram1,eightbitadditioninstructionsareused(ADDandADC)andadditionisperformedintwosteps.FirstlowerbyteadditionusingADDinstructionandthenhigherbyteadditionusingADCinstruction.Inprogram2,16bitadditioninstruction(DAD)isused.
Addcontentsoftwomemorylocations
Statement:Addthecontentsofmemorylocations40001Hand4001Handplacetheresultinthememorylocations4002Hand4003H.
Sampleproblem:(4000H)=7FH(400lH)=89HResult=7FH+89H=lO8H(4002H)=08H(4003H)=0lHSourceprogram:LXIH,4000H:"HLPoints4000H"MOVA,M:"Getfirstoperand"INXH:"HLPoints4001H"ADDM:"Addsecondoperand"INXH:"HLPoints4002H"MOVM,A:"Storethelowerbyteofresultat4002H"MVIA,00:"Initializehigherbyteresultwith00H"ADCA:"Addcarryinthehighbyteresult"INXH:"HLPoints4003H"MOVM,A:"Storethehigherbyteofresultat4003H"HLT:"Terminateprogramexecution"
Subtracttwo16bitnumbers
Statement:Subtractthe16bitnumberinmemorylocations4002Hand4003Hfromthe16bitnumberinmemorylocations4000Hand4001H.Themostsignificanteightbitsofthetwonumbersareinmemory
5/12/2015 ProgramsFor8085MicroprocessorLearners
http://scanftree.com/microprocessor/ProgramsFor8085MicroprocessorLearners 6/12
locations4001Hand4003H.Storetheresultinmemorylocations4004Hand4005Hwiththemostsignificantbyteinmemorylocation4005H.
Sampleproblem:(4000H)=19H(400IH)=6AH(4004H)=I5H(4003H)=5CHResult=6A19H5C15H=OE04H(4004H)=04H(4005H)=OEHSourceprogram:LHLD4000H:"Getfirst16bitnumberinHL"XCHG:"Savefirst16bitnumberinDE"LHLD4002H:"Getsecond16bitnumberinHL"MOVA,E:"Getlowerbyteofthefirstnumber"SUBL:"Subtractlowerbyteofthesecondnumber"MOVL,A:"StoretheresultinLregister"MOVA,D:"Gethigherbyteofthefirstnumber"SBBH:"Subtracthigherbyteofsecondnumberwithborrow"MOVH,A:"Storel6bitresultinmemorylocations4004Hand4005H"SHLD4004H:"Storel6bitresultinmemorylocations4004Hand4005H"HLT:"Terminateprogramexecution"
Findingonescomplementofanumber
Statement:Findthelscomplementofthenumberstoredatmemorylocation4400Handstorethecomplementednumberatmemorylocation4300H.
Sampleproblem:(4400H)=55HResult=(4300B)=AABSourceprogram:LDA4400B:"Getthenumber"CMA:"Complementnumber"STA4300H:"Storetheresult"HLT:"Terminateprogramexecution"
FindingTwoscomplementofanumber
Statement:Findthe2scomplementofthenumberstoredatmemorylocation4200Handstorethecomplementednumberatmemorylocation4300H
Sampleproblem:
5/12/2015 ProgramsFor8085MicroprocessorLearners
http://scanftree.com/microprocessor/ProgramsFor8085MicroprocessorLearners 7/12
(4200H)=55HResult=(4300H)=AAH+1=ABHSourceprogram:LDA4200H:"Getthenumber"CMA:"Complementthenumber"ADI,01H:"Addoneinthenumber"STA4300H:"Storetheresult"HLT:"Terminateprogramexecution"
PacktheunpackedBCDnumbers
Statement:PackthetwounpackedBCDnumbersstoredinmemorylocations4200Hand4201Handstoreresultinmemorylocation4300H.Assumetheleastsignificantdigitisstoredat4200H.
Sampleproblem:(4200H)=04(4201H)=09Result=(4300H)=94Sourceprogram:LDA4201H:"GettheMostsignificantBCDdigit"RLCRLCRLCRLC:"Adjustthepositionoftheseconddigit(09ischangedto90)"ANIFOH:"MakeleastsignificantBCDdigitzero"MOVC,A:"storethepartialresult"LDA4200H:"GetthelowerBCDdigit"ADDC:"AddlowerBCDdigit"STA4300H:"Storetheresult"HLT:"Terminateprogramexecution"
UnpackaBCDnumber
Statement:TwodigitBCDnumberisstoredinmemorylocation4200H.UnpacktheBCDnumberandstorethetwodigitsinmemorylocations4300Hand4301Hsuchthatmemorylocation4300HwillhavelowerBCDdigit.
Sampleproblem:(4200H)=58Result=(4300H)=08and(4301H)=05Sourceprogram:LDA4200H:"GetthepackedBCDnumber"
5/12/2015 ProgramsFor8085MicroprocessorLearners
http://scanftree.com/microprocessor/ProgramsFor8085MicroprocessorLearners 8/12
ANIFOH:"Masklowernibble"RRCRRCRRCRRC:"AdjusthigherBCDdigitasalowerdigit"STA4301H:"Storethepartialresult"LDA4200H:"GettheoriginalBCDnumber"ANIOFH:"Maskhighernibble"STA4201H:"Storetheresult"HLT:"Terminateprogramexecution"
Executionformatofinstructions
Statement:Readtheprogramgivenbelowandstatethecontentsofallregistersaftertheexecutionofeachinstructioninsequence.
Mainprogram:4000HLXISP,27FFH4003HLXIH,2000H4006HLXIB,1020H4009HCALLSUB400CHHLTSubroutineprogram:4100HSUB:PUSHB4101HPUSHH4102HLXIB,4080H4105HLXIH,4090H4108HSHLD2200H4109HDADB410CHPOPH410DHPOPB410EHRET
Rightshift,bitofdata(8bitand16bit)
Statement:Writeaprogramtoshiftaneightbitdatafourbitsright.AssumedataisinregisterC.
Sampleproblem:(4200H)=58Result=(4300H)=08and(4301H)=05
5/12/2015 ProgramsFor8085MicroprocessorLearners
http://scanftree.com/microprocessor/ProgramsFor8085MicroprocessorLearners 9/12
Sourceprogram1:MOVA,CRARRARRARRARMOVC,AHLT
Statement:Writeaprogramtoshifta16bitdata,1bitright.AssumethatdataisinBCregisterpair.
Sourceprogram2MOVA,BRARMOVB,AMOVA,CRARMOVC,AHLT
LeftShiftingofa16bitdata
Statement:Programtoshifta16bitdata1bitleft.AssumedataisintheHLregister
HL=1025=0001000000100101HL=0001000000100101+HL=0001000000100101Result=0010000001001010
Alterthecontentsofflagregisterin8085
Statement:Writeasetofinstructionstoalterthecontentsofflagregisterin8085.
PUSHPSW:"Saveflagsonstack"POPH:"RetrieveflagsinL"MOVA,L:"Flagsinaccumulator"CMA:"Complementaccumulator"MOVL,A:"AccumulatorinL"PUSHH:"Saveonstack"POPPSW:"Backtoflagregister"
5/12/2015 ProgramsFor8085MicroprocessorLearners
http://scanftree.com/microprocessor/ProgramsFor8085MicroprocessorLearners 10/12
HLT:"Terminateprogramexecution"
5
0
Tweet
4
Like
5/12/2015 ProgramsFor8085MicroprocessorLearners
http://scanftree.com/microprocessor/ProgramsFor8085MicroprocessorLearners 11/12
AddressingModesin80852comments PROGRAMSFOR8085MICROPROCESSORLEARNERS1comment
CProgramtoreadnameandmarksofstudentsandstoreitinfile2comments
Architechtureof80851comment
AROUNDTHEWEB
ALSOONSCANFTREE.COM
WHAT'STHIS?
SimpleEyeExerciseCanCureAllVisionProblems
Lifegooroo
PlaneHitsBridge,ManSkisBehindCar,SnakePulledFromCar
Web2Carz.com
AnEasy&ProvenMethodToNaturallyGetYourVisionBack
RestoreMyVision
OMG.BestCollegeintheWorld!Universities.AC
0Comments Scanftree.com Login1
Share SortbyNewest
Startthediscussion
Recommend
Scanftreeisoptimizedforlearning,testing,andtraining.Examplesmightbesimplifiedtoimprovereadingandbasicunderstanding.Tutorials,references,andexamplesareconstantlyreviewedtoavoiderrors,butwecannotwarrantfullcorrectnessofallcontent.Whileusingthissite,youagreetohavereadandacceptedourtermsofuseandprivacypolicy.
Copyright2014Scanftree.
5/12/2015 ProgramsFor8085MicroprocessorLearners
http://scanftree.com/microprocessor/ProgramsFor8085MicroprocessorLearners 12/12
Ankit kumar singh
815 followers
Follow