资源描述:
《微机原理习题答案4》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、微型计算机原理第4章习题参考答案4.1已知某数据段中有COUNT1EQU16HCOUNT2DW16H下面两条指令有何异同。MOVAX,COUNT1MOVBX,COUNT2解:同:执行完之后,AX=BX=16H异:MOVAX,COUNT1向AX中传送的是立即数,而MOVBX,COUNT2向BX中传送的是变量内容。4.2下列程序段执行后,寄存器AX、BX和CX的内容分别是多少?ORG0202HDA-WORDDW20HMOVAX,DA-WORD;AX=0020HMOVBX,OFFSETDA-WORD;BX=0202HMOVCL,BYTEPTR
2、DA-WORD;CL=20HMOVCH,TYPEDA-WORD;CH=02H解:AX=0020H,BX=0202H,CX=0220H4.3设平面上有一点P的直角坐标(x,y),试编制完成以下操作的程序:如P点落在第I象限,则K=I;如P点落在坐标轴上,则K=0。解:DATSEGMENTmsgdb'pleaseinputnumberonly!$'MSG1DB10,13,'INPUTX:$'MSG2DB10,13,'INPUTY:$'xbufdb20,0xbuf1db20dup(?)ybufdb20,0ybuf1db20dup(?)D1DB
3、10,13,'K='D2DB'?,$'DATENDSCODSEGMENTASSUMECS:COD,DS:DATBG:MOVAX,DATMOVDS,AXmovdx,offsetmsgmovah,9int21hMOVDX,OFFSETMSG1MOVAH,9INT21Hmovdx,offsetxbufMOVAH,0AHINT21HMOVDX,OFFSETMSG2MOVAH,9INT21Hmovdx,offsetybufMOVAH,0AHINT21HCMPybuf1,'0'JEPRO1CMPxbuf1,'0'JEPRO1cmpxbuf1,'-'
4、JzPRO2CMPybuf1,'-'JePRO4MOVD2,'1'JMPSHOWPRO1:MOVD2,'0'JMPSHOWPRO2:CMPybuf1,'-'JePRO3MOVD2,'2'JMPSHOWPRO3:MOVD2,'3'JMPSHOWPRO4:MOVD2,'4'SHOW:MOVDX,OFFSETD1MOVAH,9INT21Hmovah,4chint21hCODENDSENDBG4.4试编制一程序,把CHAR1中各小写字母分别转换为对应的大写字母,并存放于CHAR2开始的内存单元中。CHARDB‘abcdef’CHAR2DB$—C
5、HAR1DUP(0)解:DATSEGMENTCHAR1DB'abcdefgh'CHAR2DB$-CHAR1DUP(0)NEQU$-CHAR2DATENDSCODSEGMENTASSUMECS:COD,DS:DATBG:MOVAX,DATMOVDS,AXMOVSI,0MOVCX,NLP:MOVAL,CHAR1[SI]SUBAL,20HMOVCHAR2[SI],ALINCSILOOPLPMOVAH,4CHINT21HCODENDSENDBG4.5试编写一程序,把DABY1字节单元中数据分解成3个八进制数,其最高位八进制数据存放在DABY2
6、字节单元中,最低位存放在DABY2+2字节单元中。DABY1DB6BHDABY2DB3DUP(0)解:DATSEGMENTDABY1DB6BHDABY2DB3DUP(0)DB24HDATENDSCODSEGMENTASSUMECS:COD,DS:DATBG:MOVAX,DATMOVDS,AXMOVAL,DABY1ANDAL,07HMOVDABY2+2,ALMOVAL,DABY1ANDAL,38HMOVCL,3SHRAL,CLMOVDABY2+1,ALMOVAL,DABY1ANDAL,0C0HMOVCL,6SHRAL,CLMOVDABY2
7、,ALMOVAH,4CHINT21HCODENDSENDBG4.12试编写一程序,编程计算(A*B+C-70)/A,其中A、B、C均为字节变量。解:DATSEGMENTADB23BDB45CDB67shangDB?yushudb?DATENDSCODSEGMENTASSUMECS:COD,DS:DATBG:MOVAX,DATMOVDS,AXMOVAL,AIMULBMOVCL,CMOVCH,0ADDAX,CXMOVDX,70SUBAX,DXMOVBL,AIDIVBLMOVshang,ALmovyushu,ahMOVAH,4CHINT21
8、HCODENDSENDBG4.14试编写一程序,找出BUF数据区中带符号数的最大数和最小数。解:DATSEGMENTBUFDB3,6,5,4,1,-56,89,78,-67,12,43,45,-32NE