资源描述:
《微型计算机原理实验.doc》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、实验一:输出字符‘A’的源程序如下:PROGSEGMENTASSUMECS:PROGSTART:MOVDL,'A'MOVAH,2INT21HMOVAH,4CHINT21HPROGENDSENDSTART实验二:1.把BX中的二进制数转换成十进制数,在屏幕上显示出来,只考虑无符号数。程序如下:CODESEGMENTASSUMECS:CODESTART:MOVBX,0FFFHMOVCX,10000CALLDEC_DIVMOVCX,1000CALLDEC_DIVMOVCX,100CALLDEC_DIVMOVCX,10CALLDEC_DIVMOVCX
2、,1CALLDEC_DIVMOVAH,4CHINT21HDEC_DIVPROCNEARMOVAX,BXMOVDX,0DIVCXMOVBX,DXMOVDL,ALADDDL,30HMOVAH,2INT21HRETDEC_DIVENDPCODEENDSENDSTART2.把BX中的带符号数转换成十进制数,在屏幕上显示出来。程序如下:CODESEGMENTASSUMECS:CODESTART:MOVBX,8001HMOVAX,8000HANDAX,BXJNZMINUSJMPDISPMINUS:MOVDL,'-'MOVAH,2INT21HNEGBXJM
3、PDISPDISP:MOVCX,10000CALLDEC_DIVMOVCX,1000CALLDEC_DIVMOVCX,100CALLDEC_DIVMOVCX,10CALLDEC_DIVMOVCX,1CALLDEC_DIVMOVAH,4CHINT21HDEC_DIVPROCNEARMOVAX,BXMOVDX,0DIVCXMOVBX,DXMOVDL,ALADDDL,30HMOVAH,2INT21HRETDEC_DIVENDPCODEENDSENDSTART3.求一个数据块(由10个单字节的无符号数组成)中的最大元素,并将结果在屏幕上显示出来,程序
4、如下:DATASEGMENTBLOCKDB1,0,5,7,10,30,100,127,90,80RESULTDB?DATAENDSCODESEGMENTASSUMECS:CODE,DS:DATABEGINPROCFARMOVAX,DATAMOVDS,AXMOVCX,9LEASI,BLOCKMOVAL,[SI]X1:INCSICMPAL,[SI]JAEX2MOVAL,[SI]X2:LOOPX1MOVRESULT,ALMOVAH,0MOVBX,AXCALLXIANSHIMOVAH,4CHINT21HBEGINENDPXIANSHIPROCNEAR
5、MOVAL,80HANDAL,BLJNZMINUSJMPDISPMINUS:MOVDL,'-'MOVAH,2INT21HNEGBLJMPDISPDISP:MOVCX,100CALLDEC_DIVMOVCX,10CALLDEC_DIVMOVCX,1CALLDEC_DIVMOVAH,4CHINT21HXIANSHIENDPDEC_DIVPROCNEARMOVAX,BXMOVDL,0DIVCLMOVBL,AHMOVBH,0MOVDL,ALADDDL,30HMOVAH,2INT21HRETDEC_DIVENDPCODEENDSENDBEGIN4.求一
6、个数据块(由20个单字节的带符号数组成)中的正数和(≤字)和负数和(≤字),并在屏幕上用十进制的形式显示出两个和。程序如下:DATASEGMENTBLOCKDW-100,100,200,-200,5,6,7,8,9,10DW11,12,13,14,15,50,-50,150,-150,-200POSITDW?NEGATDW?ST1DB'Thesumofallthepositivenumbers:$'ST2DB'Thesumofthenegativenumbers:$'DATAENDSCODESEGMENTASSUMECS:CODE,DS:DA
7、TASTARTPROCMOVAX,DATAMOVDS,AXMOVBX,OFFSETBLOCKMOVSI,0MOVDI,0MOVCX,20X1:MOVAX,[BX]CMPAX,0JGEX3ADDDI,AXJMPX2X3:ADDSI,AXX2:ADDBX,2LOOPX1MOVPOSIT,SIMOVNEGAT,DIMOVBX,SIMOVDX,OFFSETST1MOVAH,9INT21HCALLXIANSHIMOVDL,0DHMOVAH,2INT21HMOVDL,0AHMOVAH,2INT21HMOVBX,NEGATNEGBXANDBX,7FFFHM
8、OVDX,OFFSETST2MOVAH,9INT21HMOVDL,'-'MOVAH,2INT21HCALLXIANSHIMOVAH,4CHINT21HSTARTEN