Mr. Sapan Naik 1

BabuMadhavInstituteofInformationTechnology,UTU
5YearsIntegratedM.Sc.(IT)–Semester4
060010309:DSE3–MicroprocessorProgrammingandInterfacing
QuestionBank
Unit1:Introduction
1. Writethedecimalequivalentforeachintegralpowerof2from2! to2!" .
2. Convertthefollowingdecimalnumberstobinary:
22
76
500
3. Convertthefollowingbinarynumbertodecimal:
1011
11010001
11101110010110
4. Converttohexadecimal:
53decimal
756decimal
01101100010binary
11000010111binary
5. Converttodecimal:
D3H
3FEH
44H
6. ConvertthefollowingdecimalnumberstoBCD:
86
62
33
7. Defineparityanddescribehowitisusedtodetectanerrorintransmitteddata.
8. Showadditionof:
10011! and1011! inbinary
37!" and25!" inBCD
4AHand77H
9. Expressthefollowingdecimalnumbersin8-bitsignandmagnitudeform:
+26
-7
-26
-125
10. Showthesubtraction,inbinary,ofthefollowingdecimalnumbers.
7-4
37-26
125–93
11. Showthemultiplicationof1001and011.
12. Showthedivisionof1100100by1010.
13. Dotheindicatedoperationsonthefollowingnumbers:
3AH+94H
17AH–4CH
01011001BCD
Mr.SapanNaik 1
BabuMadhavInstituteofInformationTechnology,UTU
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
+01000010BCD
01111001BCD
+01001001BCD
01011001BCD
+00100110BCD
-011000111BCD
-00111001BCD
ShowtheoutputproducedwhenthefollowingbinarywordsareANDedwitheachotherand
whentheyareORedwitheachother:
1010and0111
1011and1100
11010111and111000
ANDingan8-bitbinarynumberwith11110000issometimesreferredtoas“masking”
thelower4bitwhy?
Describethemainadvantageofdistributedprocessingcomputersystemoverasimple
timesharingsystem.
Describethesequenceofsignalsthatoccursontheaddressbus,thecontrolbus,andthe
databuswhenasimplemicrocomputerfetchesaninstruction.
Whatdetermineswhetheramicroprocessorisconsideredan8-bit,a16-bit,ora32-bit
device?
Howmanyaddresslinesdoesan8086have?
Howmanymemoryaddressdoesthisnumberofaddresslinesallowthe8086toaccess
directly?
Atanygiventime,the8086workswithfoursegmentsinthisaddressspace.Howmany
bytesarecontainedineachsegment?
Whatisthemaindifferencebetweenthe8086andthe8088?
Describethefunctionofthe8086queueandHowdoesthequeuespeedupprocessing?
Ifthecodesegmentforan8086programstartsataddress70400H,whatnumberwillbein
theCSregister?Andassumingthissamecodesegmentbase,whatphysicaladdresswilla
codebytebefetchedfromiftheinstructionpointercontain539CH?
Whatphysicaladdressisrepresentedby:4370:561EH,7A32:0028H
WhatistheadvantageofusingaCPUregisterfortemporarydatastorageoverusinga
memorylocation?
Ifthestacksegmentregistercontain3000Handthestackpointerregistercontains8434H,
Whatisthephysicaladdressofthetopofthestack?
Whatistheadvantageofusingassemblylanguageinsteadofwritingaprogramdirectlyin
machinelanguage?
Describetheoperationan8086willperformwhenitexecutesADDAX,BX.
Whattypesofprogramareusuallywritteninassemblylanguage?
Describetheoperationthatan8086willperformwhenitexecuteseachofthefollowing
instructions:
MOVBX,03FFH
MOVAL,0DBH
MOVDH,CL
MOVBX,AX
Writethe8086assemblylanguagestatementwhichwillperformthefollowingoperations:
Loadthenumber7986HintotheBPregister.
CopytheBPregistercontainstotheSPregister.
BabuMadhavInstituteofInformationTechnology,UTU
33.
34.
35.
36.
CopythecontentsoftheAXregistertotheDSregister.
LoadthenumberF3HintotheALregister.
Ifthe8086executionunitcalculatesaneffectiveaddressof14A34andDScontains7000H
whatphysicaladdresswilltheBUIproduce?
Ifthedatasegmentregister(DS)contains4000H,whatphysicaladdresswilltheinstruction
MOVAL,[234Bh]read?
Ifthe8086datasegmentregistercontains7000H,writetheinstructionthatwillcopythe
contentsofDLtoaddress74B2CH.
DescribethedifferencebetweentheinstructionsMOVAX,2437HandMOVAX,[2437H].
Unit2:8086assemblylanguageprogrammingtechniques
1. Listthemajorstepsindevelopinganassemblylanguageprogram.
2. Whatisthemainadvantageofatop-downdesignapproachtosolvingaprogramproblem?
3. Whyshouldyoudevelopadetailedalgorithmforaprogrambeforewritingdownany
assemblyforaprogrambeforewritingdownanyassemblylanguageinstructions?
4. Whatarethethreebasicstructuretypesusedtowritethealgorithmforaprogram?
5. Whatistheadvantageofusingonlythesestructureswhenwritingthealgorithmfora
program?
6. Useaflowchartorpseudocodetoshowthealgorithmforaprogram,whichgetsanumber
fromamemorylocation,subtracts20Hfromit,andoutputs01Htoport3AHiftheresultof
thesubtractionisgreaterthan25H.
7. Giventheregistercontentsinfigure1answerthefollowingquestions:
a. Whatphysicaladdresswillthenextinstructionbefetchedfrom?
b. Whatisthephysicaladdressforthetopofthestack?
ES=1234h
AX=4321h
SP=1111h
CS=2345h
BX=5432h
BP=2222h
SS=3456h
DS=4567h
CX=6543h
DX=7654h
IP=5678h
SI=3333h
DI=4444h
Figure1.Registercontent
8. Describetheoperationandresultsofeachofthefollowinginstruction,Giventheregister
contentsshowinfigure1includeinyouranswerthephysicaladdressorregisterthateach
instructionwillgetitsoperandsfromandthephysicaladdressorregister.Assumethatthe
followinginstructionsareindependent,notsequential,unlesslistedtogetherunderaletter.
a. MOVAX,BX b. MOVCL,37H
c. INCBX
d. MOVCX.[246BH]
e. MOVCX,246BH
f. ADDAL,DH
g. MULBX
h. DECBP
i. DIVBL
j. SUBAX,DX
k. ORCL,BL
l. NOTAH
Mr.SapanNaik 3
BabuMadhavInstituteofInformationTechnology,UTU
9.
10.
11.
12.
13.
m. ROLBX,CH
n. ANDAL,CH
o. AOVDS,AX
p. PORBX,CL
q. ANDAL,OFH
r. MOV,AX,[BX]
s. MOV[BX][SI],CL
Seeifyoucanspotthegrammatical(syntax)errorsinthefollowinginstruction.
a. MOVBH,AX
b. MOVDX,CL
c. ADDAL,2073H
d. MOV7632H,CX
e. INBL,04H
Showtheresultsthatwillbeintheaffectedregistersormemorylocationsaftereachofthe
followinggroupsofthefollowinggroupsofinstructionsexecutes.Assumethateachgroup
ofinstructionsstartswiththeregisterandmemorycontentsshowninFigure1.
-ADDBL,AL
MOV[00041,BL
RORDI,04
-MOVCL,04
-ADDAl,BH
DAA
-MOVBX,000AH
MOVAL,[BX]
SUBAL,CL
INCBX
MOV[BX),AL
Writethe8086instructions,whichwillperformtheindicatedoperation.
CopyALtoBL.
Load43HintoCL
IncrementthecontentsofCXby1.
CopySPtoBP.
Add07HtoDL.
MultiplyALtimesBL.
CopyAXtoamemorylocationatoffset245AHindatasegment.
DecrementSPby1.
RotatethemostsignificantbitofALintotheleastsignificantbitposition.
CopyDLtoamemorylocationwhoseoffsetisinBX.
Maskthelower4bitsofBL.
SetthemostsignificantbitofAXtoa1,butdonotaffecttheotherbits.
Inventthelower4bitsofBL,butdonotaffecttheotherbits.
Constructthebinarycodeforeachofthefollowing8086instructions.
MOVBL,AL
RORAX,I
MOV[BX],CX OUTDX,AL
ADDBX,59H[DI]
ANDAL,OFH
SUB[2048],DH NOP
XCHGCH,ES:[BX]
INAL,DX
Describehowanassemblylanguageprogramisadevelopedanddebuggedusingsystem
toolsuchaseditors,assembler,linker,locator,emulatorsanddebuggers.
BabuMadhavInstituteofInformationTechnology,UTU
Unit3:Procedures,MacrosandAssemblerDirectives
1. DescribestackoperationsduringnearprocedureCALLandRET.
2. Whatisreentrantprocedure?Differentiatereentrantandrecursiveprocedure.
3. Differentiateproceduresandmacros.
4. WriteinstructionformatofCALLinstructionforinter-segment,indirectcall.
5. ExplainSTD,DAS,ROL,JGandCALLinstructionswithexample.
6. Define:Indirectinter-segmentcall.
7. Listoutanytwocontrolflagsof8086.
8. ExplainLEA,ADC,AAA,JLandCMPinstructionswithexample.
9. Define:Directinter-segmentjump.
10. DescribeXCGH,DAA,SBB,RORandPUSHinstructionswithexample.
11. DescribestackoperationsduringnearprocedureCALLandRET.
12. ListoutdifferenttypesofUnconditionalJumpinstructions.Describe8086binarycoding
templateofthesame.
13. Whatisreentrantprocedure?Howtomakeanyprocedureasreentrant?
14. Define:Indirectintra-segmentjump.
15. Describetheoperationandresultofeachofthefollowinginstructionsgiventheregister
containsshowingfigureincludingyouransweredregisterthateachinstructionwillgetits
operandfromenterphysicaladdressofregisterthateachinstructioncangetresultinit.
userinstructiondescriptioninchapter6tohelpyouassumethattheinstructionbeloware
independent,notsequential,unlesslistedtogetherunderaletter
a)ROLLAX,CX
b)INAL,DXP
c)MOVCX,IBX]
d)ADDAX,[BX][SI]
e)JMP023AH
f)JMPBX
16. Constructthebinarycodesforinstructionforquestion15athrough15f.
17. Predictthestateofthe6of8086conditionalflagsaftereachofthefollowinginstructionor
groupofinstructionsexecutes.usetheregisterscontentsshowninfigureassumethatall
flagsareresetbeforetheinstructionexecuteusethedetailinstructiondescriptioninthe
chapter6tohelpyou.
a)MOVAL,AH
b)ADDBL,CL
c)ADDCL,DH
d)ORCX,BX
18. Seeifyoucanfindanyerrorsinthefollowinginstructionofgroupofinstructions.
a)CNTDOWN:MOVBL,72H
DECBL
JNZCNTDOWN
b)ADDCX,AL
c)JMPBL
Mr.SapanNaik 5
BabuMadhavInstituteofInformationTechnology,UTU
d)JNZ[BX]
19. a)writeanalgorithmforprogrammerwhichaddsabytenumberfromonememory
locationtoabytefromnextmemorylocation,putthesuminthirdmemorylocationand
savethestateofflagintheleastsignificantbitofafourthmemorylocation.
b)writean8086assemblylanguageprogramforthisalgorithm.hints:setupdata
declarationssimilartothoseinfigureuseofrotateinstructiontogetthecarryflagstatethe
instructionLSDofregisterormemorylocation
c)whatadditionalinstructionwouldyouhavetoaddtothisprogramsothatitcorrectlyadd
2BCDbytes?
20. AcommonproblemwhenreadingaseriesofASCIIcharactersfromakeyboardistheneed
tofilteroutthosecodeswhichrepresentthehexdigits0to9andatofandconvertthese
ASCIICodestothehexdigitstheyrepresents.example,ifweread34htheASCIIcodefor4.
wewanttomaskupper4bitstoleave04,the8Bithexcodefor4ifwereadin42htheASCII
forB,wewanttoadd09andmasktheupper4bitstoleave0B,the8bitcodeforhexB.if
wereadinanASCIIcodethatisnotintherange30hto39hor31hto36hthenwewantto
loadanderrorcodeofFFHinsteadofthehexvalueoftheenteredcharacter.Figure2shows
describetheactionnexttoeachrangeofASCIIvalueswriteanalgorithmandassembly
languageprogramwhichimplementstheactions.hints:anestedIF-THEN-ELSEstructure
mightbeuseful.
21. Computetheaverageof4bytesstoredinanarrayinmemory
22. Computetheaverageofanynumberofbytesinanarrayinmemory.numberofbytestobe
addedisinthefirstbyteofthearray.
23. Addafive-bytenumberinonearraytoafivebytenumberinanotherarray.putthesamein
anotherarray.putthestateofthecarryflaginbyte6ofthearraythatcontainsthesumthe
firstvalueineacharrayistheleastsignificantbyteofthatnumber.
24. 8086BasedprocesscontrolsystemoutputsaMeasuredFahrenheitTemperaturetoa
displayonitsfrontpanel.youneedwriteashortprogramwhichconvertsFahrenheit
temperaturetoCelsiussothatSystemcanbesoldinEuropetheRelationshipbetween
FahrenheitandCelsiusisC=(F-32)5/9.theFahrenheitTemperaturewillalwaysbeinthe
range50to250.RoundtheCelsiusValuetothenearestdegree.
25. Writeadelayloopwhichproducesadelayof500usonan8086witha5-MHzdelay
26. Writeashortprogramwhichoutputsa1KHzsquarewaveonD0ofportFFFAHthebasic
principleistooutputofhigh,wait500us(0.5ms.outputalowwait500usoutputahigh
etc.)
Unit4:Interfacing
1. Writepinnumberof8086fora)toenablelatch,b)INTA.
2. Drawthecircuitconnectionsforthe3625decoderPROMandfortwoofthe4Kx8RAMs.
3. Showthetruthtableyouwouldusefora3625PROMdecodertoproduceCSIsignalsfor
4Kx8RAMsinan8086system.AssumethefirstRAMstartsataddress00000H.Donot
forgetA0andBHE.
4. Tracebelowprogramandwriteregisterscontentaftereachinstruction.
BabuMadhavInstituteofInformationTechnology,UTU
5. 6. datasegment
a. ansdb?
b. numdb0f1h
7. ends
8. 9. codesegment
10. start:
a. movax,@data
b. movds,ax
c. moval,num
d. rolal,02
e. roral,03
f. rolal,04
g. roral,05
h. xchgah,al
i. movans,ah
j. movax,4c00h
k. int21h
13.
14.
15.
16.
17.
18.
19.
20.
21.
11. ends
12. endstart
Explain8086memorybanksanddescribeRAMaddressdecodingontheSDK-86.
DifferentiatememorymappedI/OanddirectI/O.
Showthetruthtableyouwouldusefora3625PROMdecodertoproduceCSIsignalsfor
eight8Kx8ROMsinan8086system.AssumethefirstRAMstartsataddress00000H.Donot
forgetA0andBHE.
Drawtheblockdiagramof8086memorybanks.Explainsignalsforbyteandword
operationsforthesame.
Explain8086memorybanksanddescribeRAMaddressdecodingontheSDK-86.
ListoutwaysofaccessingI/O.Whichwayisbetterinwhichsituation?
ShowthetruthtableyouwoulduseforadecodertoproduceCSIsignalsforfour8Kx8ROMs
inan8086system.
UserdoesnotwanttowastememoryforaccessingI/O.Inthissituationwhichmethodof
accessingI/Oispreferableandwhy?
Drawthecircuitconnectionsforthe3625decoderPROMandfortwoofthe16Kx8RAMS.
Showthetruthtableofaddressalso.
Unit5:8086InterruptsandInterruptApplication
1. WritedownthenameofType3interrupt.
2. Whereinmemoryinterrupt-pointertableisstoredfor8086?Drawthestructureofit.
3. Onwhichmemorylocations,theInterruptpointertableisstored?Whatistheuseofit?
4. Listoutanytwowaysoftakinginputfromkeyboardandgiveexampleofboth.
5. Howtoclearscreenandsetthecursorusinginterrupt?Describescreenfeaturesindetail.
6. WhatistheuseofTYPE2andTYPE3interrupts?
7. DefineBIOSKeyboarddataarea.WhatistheuseofINT16Hinterrupt?
8. Draw8086interrupt-pointertable.Explain8086interruptsandinterruptresponses.
9. Explain09H,02Hand40HfunctionsforscreendisplayofINT21Hwithexample.
10. Whatistheuseof09HfunctionofINT21h?
11. WritedownthenamesofType0andType1interrupt.
Mr.SapanNaik 7
BabuMadhavInstituteofInformationTechnology,UTU
12. Howmuchmemorydoesinterruptpointertableoccupy?Whatisthestartingaddressof
TYPE3interrupt?
13. ListoutanyfunctionsofINT21Hforscreeninterruptandgiveexampleofboth.
14. Explain8086interrupttypesindetail.
15. WhatisBIOSkeyboarddataarea?Explaininterruptfortakinginputfromkeyboard.
Unit6:ProgrammablePeripheralDevices
1. WhatisthechipnumberforprogrammableinterruptcontrollerandDMAcontroller?
2. Drawinternalblockdiagramof8255Aprogrammableparallelportdevice.
3. Writeshortnoteon8251–Programmableinterfacedevice–SerialI/O.
4. Listoutmodulesof8251-ProgrammableInterfacedevice.Whatistheuseofdatabuffer
module?
5. Writeshortnoteon8259-ProgrammableInterruptController.
6. Howmanyinterruptlinesareavailablein8259-ProgrammableInterruptController?Canit
handlenonmaskableinterrupts?
7. Writeshortnoteon8237-DMAController.
8. Listoutmodeof8255-ProgrammablePeripheralInterfaceandwriteuseofallmodes.