版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
浙江大学2009-20江学年秋冬学期
《汇编与接口》课程期末考试试卷
课程号•:,开课学院:计算机学院
考试试卷:A卷J手卷
考试形式:开卷J闭卷允许带1本书和1本资料入场
考试日期:2010年1月日,考试时间:12()分钟
诚信考试,沉着应考,杜绝违纪。
考生姓名:学号:所属院系:
题序—•二三四五六七总分
得分
评卷人
请把第一至第三题的答案写在本页的答题纸上,第一至第三题的的评分以答题纸上的答案为准。
一.(10points)MarkTforcorrectinstructionordescription,markFforincorrectinstructionordescription.
F.MUL[SI]
T.ROLDWORDPTR[ECX],2
F.MOVES,59A2H
T.JCXZL2
F.IMULWORDPTR[ESP]
F.ADDAX,[SP+2]
F.MOVAX,BX+DI
F.ADD[DI],[BX]
F.INAX,320H
T.POPAD
二.(26points)Pleaseselectthebestchoiceforthefollowingquestions.
1.Indebug,ZRstandsfor“ZEROflagZFis1”.Whichonestandsfor“DirectionflagDFis1"indebug?
A.FWB.DNC.UPD.DO
【答案】:B
2.Inrealmode,SS=01H,DS=00H,BP=7EH,followingmemorydataisshownindebug.Afterinstruction“LES
BXJBP+4]'isexecuted,ESandBXwillbe.
0000:00807210A7007C10A700-4F0380058A038005
0000:0090AD061402A4F000F0-37051402116D00CO
A.ES=0214H,BX=F0A4HB.ES=107CH,BX=OOA7H
C.ES=F0A4H,BX=0214HD.ES=00A7H,BX=107CH
【答案】:C
3.“BUFDW1,2,3,4"isequaltoinmemorycontentsofBUF.
A.BUFDB1,0,2,0,3,0,4,0B.BUFDB(),1,0,2,0,3,0,4
C.BUFDD1000200H,3900400HD.BUFDD20001OOH.4000300H
【答案】:A
4.MOVAX,73E2H
ADDAX,EA3EH,thenOFandCFwillbe
A.OF=1andCF=1B.OF=1andCF=0
C.OF=0andCF=0D.OF=0andCF=1
【答案1D
5.SupposethattheoffsetaddressofvariableDATA!is100H,whichinstructionwilldo"EAXEBX+
2*ESI+70H”?
A:LEAEAX,DATA1[EBX+2*ESI-90H]
B:MOVEAX.OFFSET[EBX+2*ESI+70H]
C:MOVEAX,EBX+2*ESI+70H
D:MOVEAX,OFFSETdatal+EBX+2*ESI-90H
【答案】:A
6.MOVCX,OFFFFH
STC
ADCCX,0
thenCFandZFbe.
A.CF=OandZF=OB.CF=OandZF=1
C.CF=1andZF=OD.CF=1andZF=1
【答案】:D
7.MOVEAX,260
MOVECX,259
MULCLthenEAX=.
A.6B.67340
C.12D.780
【答案】:C
8.WhichICW1of8259Aselectscascadeoperationandedgetriggeredmode?
A:00011(X)1B.B:(MX)10010B.
C:0001000IB.D:000100I0B.
【答案】:c
9.WhichICW2setsIR2of8259AtointerruptvectorFAH?
A:0F8H.B:0EAH.
C:7CH.D:OFOH.
【答案】:A
10.WhichICW4of8259AselectsnormalEOIandnon-bufferedmode?
A:00011(X)1BB:0000001IB
C:00001001BD:0000000IB
【答案】:D
11.WhichOCWIof8259AwillmaskinterruptfromIR2pin?
A:100()01(JOBB:0100001OB
C:00000100BD:0000001OB
【答案1C
12.Whichcontrolwordfor8254setscounter1asacontinuoussquare-wavegenerator?
A:OIDOIOOBB:01110110B
C:101101I0BD:10111000B
【答案1B
13.Whichcontrolwordfor8254setscounter2asacontinuouspulsesgenerator?
A:01110101BB:0ill01(X)B
C:10110010BD:10110100B
【答案工D
三.(6points)Thefollowingfigureshowsthedetailconverting32-bitlinearaddressto32-bitphysicaladdress.
SupposeCR3=3ab82H,32-bitlinearaddrcss=03a28fd4H,pleasefillblanksbelow.
(1).10-bit“dir”;B,10-bit“page”=B,12-bit"offset^H.Here“dir",
“page”and“offset”arc3partsoflinearaddress.
(2).ThepointerAisa30-bitpagedirectoryentrypointer,anditpointstoa32-bitentryOfOeOdOcH.The32-bit
pointerA1isobtainedbyconcatenatepointerAand2-bit00,thenpc-intcrAl=H.
(3).ThepointerBisa30-bitpageentrypointer,anditpointstoa32-bitentry11223344H.The32-bitpointer
B1isobtainedbyconcatenatepointerBand2-bit00,thenpointerB1=H;
(4).32-bitphysicaladdress=H;
lObitWbit12bit
DirPageOffset32-bitlinearaddress
㊉:concatenate
30bit
pointerApointerB
FIGURE2-13Thepagingmechanisminthe80386throughPentium4microprocessors.
【答案】:
Thefollowingfigureshowstheprocesstoconvert32-bitlinearaddressto32-bilphysicaladdress.Suppose
CR3=3ab82H,32-bitlinearaddress=03a28fd4H,pleasefillblanksbelow.
(1).1O-bitdir=OOOOOOH10B.IO-bitpage=IQ0010I000B.12-bitoffset=0fd4H.Here“dir”,“page”and
“offset”are3partsoflinearaddress.
(2).ThepointerAisa30-bitpagedirectoryentrypointer,anditpointstoa32-bitentryOfOcOdOcH.The32-bit
pointerAlisobtainedbyconcatenatepointerAand2-bit00,thenpointerAl=3ab82038H-=0944-4GW
10111000
(3).ThepointerBisa30-bitpageentrypointer,,anditpointstoa32-bitentry11223344H.The32-bitpointerB1
isobtainedbyconcatenatepointerBand2-bit00,thenpointerB1=0ff)c08a0H;
(4).32-bitphysicaladdress=11223m4H:
四.(12points)Thefollowingprogramrunsunder32-bitVisualC++environment,eachintegertakes32bits.
Thefunctioncubc()readsacharacterchi.Ifchiisbetween'O'to'9',itisconvertedtoanumberbetween0to9,
thenthecubeofthenumberisobtainedandreturnedasthereturnvalueofcube();Otherwise,-1ofEAXis
returnedasihereturnvalueofcube().Pleasefilltheblankstofulfilltheabovefunction.
//Integerarraytable![101containscubeofnwherenis0to9.
inttablel[10]={0,1,8,27,64,125,216,343,512,729);
intcube()
{intch1;
chl=_getche();//readacharacterfromkeyboardandreturnittochi
_asm{
(1)____________
⑵____________
jbchrl
⑶
jachrl
subal,30h
(4)_____________
(5)_____________
movbl,al
moveax,tablel[ebx]
jmpcndl
chrl:(6)_____________
jmpendI
)
endl:;
【答案】
⑴moveax,chi;moval,ch1也算对,本行与下行互换也对
⑵cmpal,'0’
jbchrl
⑶cmpal」9'
jachrl
subaL30h
(4)shlal,2:salal,2也对
(5)xorebx,ebx:subebx,ebx也对:movebx.O也对
movbl,al
moveax,table![ebx]
jmpendl
chrl:⑹moveax,-1
五.(10points)Thefollowingpartialprogrammultiplieseach4-byteelementofarraydata1byeach4-byte
elementofarraydahi2,andstorestheproductinto8-by(eelementofarrayresult,i.e.
result[i]=data1[i]*data2[i].Eacharrayshas1()elements,andthemultiplicationrepeatstor1()times.Please
filltheblankstofulfilltheabovetarget.
.data
dataldd10dup(?)
data2dd10dup(?)
resultdq10dup(?)
.code
loop1:
mulda(a2[ebx*4]
movdwordptrresult[ebx*8+4],edx
loopioopl
【答案】
xorcbx.cbx
movex/0
loop1:moveax,datal|cbx*4|
mulda(a2[ebx*4]
movdwordptrresult|ebxk8Leax
movdwordptrresult[ebxf:8+4],edx
incebx
looploop1
六.(16points)A16550chipisusedinax86PC'sI/Oextendedcard.SupposeitsI/Obaseaddressesare
0D0-0D7HanditspinsAO,A1,A2connecttosystemaddressbusAO,A1,A2.Thefollowingprogram
initializesthe16550,Pleasefillappropriatevalueintoeachblankaccordingtothepromptbesideinstruction.
MOVAL,B;enableBauddivisorregisters
OUT0D3H,AL
MOVAL.;setBaudrateto57600
OUT0D0H,AL
MOVAL,___________
OUT0D1H,AL
;(5points,fill0or1ineachblankbelow)
MOVAL,000B;setlinecontrolregister:8-bit-data,evenparity,onestopbit
OUT0D3H,AL
MOVAL,0000011IB;enabletransmitterandreceiver
OUT0D2H,AL
;(4points,fill0or1ineachblankbelow)
MOVAL,0(X)()______B;enabletransmitterinterruptandreceiverinterrupt,thelatter
OUT,AL;isonlycorrectcharacterreceiptinterrupts.
;(2points,fill0or1ineachblankbelow)
MOVAL,000000__B;enable/DTRand/RTSpinof16550
OUT,AL
【答案】
MOVAL,1XXXXXXXB;enableBauddivisorregisiers
OUT0D3H,AL
MOVAL,20;setBaudrateto57600
OUT0D0H,AL
MOVAL,0
OUT0DIH,AL
;(5points,fill0or1ineachblankbelow)
MOVAL,0001101]_B;setlinecontrolregister:8-bit-data,evenparity,onestopbit
OUT0D3H,AL
MOVAL,000()0111B;enabletransmitterandreceiver
OUT0D2H,AL
;(4points,fill0or1ineachblankbelow)
MOVAL.00000X11B;enabletransmitterinterruptandreceiverinterrupt,thelatter
OUT0D1H,AL;isonlycorrectcharacterreceiptinterrupts.
;(2points,fill0or1ineachblankbelow)
MOVAL,000000J___LB;enable/DTRand/RTSpinof16550
OUT0D4H,AL
七.(20points)A82c55parallelcommunicationadapterisdesignedasaPC'sextendedcardwhichisinserted
inPCIbusslot.PC-1uses82C55-1ofitsadaptertoexchange8-bildatawith82C55-2ofPC-2.PC-1and
82C55-1worksymmetricallywith82C55-2andPC-2,andthisisdisplayedinthefollowingfigure.Each
82c55'sportAworksformode0output,whileitsportBworksformode1strobeinput.PortAofeach
82C55sends8-bi(datatoPonBof(heotherside.PinPC0ofeach82C55willgenerateainterruptafterit
receives8-bitdata,andtheinterruptsubroutineRECV_82C55_INTreceivesthe8-bitdata.
Theslave8259AofPCconnectsthePC0of82C55,itspinA0connectstotheA0ofsystemaddressbus
anditsI/Oaddressis0A0~0A1H;TheI/Oaddressesof82c55'sportA,B,Candcommandregisterare
300H,3()1H,302H,303H,respectively;
ProcedureSTORE_BUFFERstoresALintothereceivingbuffer,anddon'taffectanyregister'svalue.
Whenitexits,itsetstheZFto1toindicatethatthebufferisfull,ori(setstheZFto0toindicatethatthe
bufferisnotfull,ThedetailedinstructionsinSTORE_BUFFERisnotprovidedinthisexampaper.
ProcedureSENDhasa8-bitentryparameterinALanditsendsthedatainAL.Itfirstpollsthestatusof
82c55'sPC3whichconnectstotheIBFpinoftheopposite82C55.Onlywhentheopposite82c55'sINPUT
BUFFERisnotFULL,theprocedureSENDwillsendoutthedataandthenoutputsanegativepulseinthis
82c55'sPC4.
Notice:eachcommentusuallypromptsthefunctionofinstructionsnearthecomment.Oneblanktakes
onepointofscoreifscoreisnotmarkedbesidetheblank.
82c55-182C55-2
toIR7ofPC-Ts8259AtoIR7ofPC・2's8259A
PORT_AEQU300H
PORT_BEQU301H
PORT_CEQU302H
PORTCMDEQU303H
PIC1EQU0A0H
PIC2EQU0A1H
SIGNAL_EOIMACRO;signalEOI(EndofInterrupt)toslave8259A
OUTPIC1,AL
ENDM
;SET_STBuses8255'scommandbyteBtosetPC4(/STB)toval(0orI)
SET_STBMACROVAL;Heretheparametervalmustbe0or1
MOVAL,VAL;Constantexpressionmaybeusedhere.
ENDM
;TheProcedureINIT_82C55sets82C55commandbyteA:portA-mode0output,
;portB-modeIinput,PCOtoPC3-input;PC4toPC7—output
INIT.82C55PROCNEAR
MOVAL.B;fill0or1ineachblank.(4points)
SET_STBI;set/STBtoI(inactive)
STI
RET
INIT.82C55ENDP
SENDPROCNEAR
PUSHAX
LOOP1:_________________
INAL,DX
JNZLOOP1;ifIBF=1,gotoLOOP1tocontinuetest
MOVDX,PORT_A;outputALfromportA
;tooutputanegativepulse
MOVCX,8
LOOP2:LOOPLOOP2
SET_STB1;set/STBto1(inactive)
RET
SENDENDP
RECV_82C55JNTPROCFARUSESAXDX
;receivedata
CALLSTOREBUFFER;storeALintothereceivingbuffer
JNZL2;ifthereceivingbufferisfull,theCPUwillmask8259'sIR7
;ThemaskstatusofIRO-IR6willnotbeaffected.
OUTPIC2,AL
L2:________________
IRET
RECV_82C55_INTENDP
【答案】
PORT_AEQU300H
PORT_BEQU301H
PORT_CEQU302H
PORT_CMDEQU303H
PIC1EQU0A0H
PIC2EQUOAIH
.MODELSMALL
.STACK1024
,CODE
.STARTUP
MOVAL41H
CALLSEND
rEXIT
SIGNAL_EOIMACRO;signalEOI(EndofInterrupt)to8259A
MOVAL、20H;20H写成xxIOOxxxB的值也对;
OUTPIC1,AL
ENDM
SET_STBMACROVAL;Heretheparametervalmustbe0or1
;Use8255'scommandbyteiosetPC4(/STB)toval(1or0)
MOVDX,PORTCMD
MOVAL,OXXX1000BORVAL;Constantexpressionmaybeusedhere.
OUTDX,AL;OR改成+、xor也对
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 数字化平台流量转化机制与盈利能力研究
- 一级建造师考试(机电工程管理与实务)题库含答案(惠州2025年)
- 全国辅警招聘考试题库2026(含答案)
- 2026年甘肃甘南藏族公务员考试(面试)在线试题解析+考点知识分析
- 2026-2031年中国铝棒行业市场调查研究及发展前景预测报告
- Unity游戏设计课件 第一章 游戏基础
- 职业健康管理试题及答案
- 护士执业考试相关试题及答案展示
- 人工智能导论(微课视频版)课件 第9章9.3-9.4-智能博弈
- 高中生口服药知识测试题及答案
- 学校合唱比赛评分细则
- 复温新技术汇报
- 安全经验分享:中石油触电事故安全经验分享
- (高清版)DB37∕T 2688.3-2016 再制造煤矿机械技术要求 第3部分:液压支架
- 硅锰合金的制备与应用
- 山东省潍坊市青州市2025届高考考前模拟英语试题含解析
- 高压氧进修汇报
- 下肢静脉曲张小讲课课件
- 公共场所卫生管理制度
- DL5009.3-2013 电力建设安全工作规程 第3部分:变电站
- 低压电容器柜技术规范样本
评论
0/150
提交评论