资源描述:
《微型计算机原理实验》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、实验一:输出字符‘A’的源程序如下:PROGSEGMENTASSUMECS:PROGSTART:MOVDL,'A'MOVAH,2INT21HMOVAH,4CHINT21HPROGENDSENDSTART实验二:1.把BX中的二进制数转换成十进制数,在屏幕上显示出来,只考虑无符号数。程序如下:CODESEGMENTASSUMECS:CODESTART:MOVBX,0FFFHMOVCX,10000CALLDEC_DIVMOVCX,1000CALLDEC_DIVMOVCX,100CALLDEC_DIVMOVCX,1
2、0CALLDEC_DIVMOVCX,1CALLDEC_DIVMOVAH,4CHINT21HDEC_DIVPROCNEARMOVAX,BXMOVDX,0DIVCXMOVBX,DXMOVDL,ALADDDL,30HMOVAH,2INT21HRETDEC_DIVENDPCODEENDSENDSTART2.把BX中的带符号数转换成十进制数,在屏幕上显示出来。程序如下:CODESEGMENTASSUMECS:CODESTART:MOVBX,8001HMOVAX,8000HANDAX,BXJNZMINUSJMPDISPM
3、INUS:MOVDL,'-'MOVAH,2INT21HNEGBXJMPDISPDISP:MOVCX,10000CALLDEC_DIVMOVCX,1000CALLDEC_DIVMOVCX,100CALLDEC_DIVMOVCX,10CALLDEC_DIVMOVCX,1CALLDEC_DIVMOVAH,4CHINT21HDEC_DIVPROCNEARMOVAX,BXMOVDX,0DIVCXMOVBX,DXMOVDL,ALADDDL,30HMOVAH,2INT21HRETDEC_DIVENDPCODEENDSEND
4、START3.求一个数据块(由10个单字节的无符号数组成)中的最大元素,并将结果在屏幕上显示出来,程序如下: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:LOOPX1MOVRESU
5、LT,ALMOVAH,0MOVBX,AXCALLXIANSHIMOVAH,4CHINT21HBEGINENDPXIANSHIPROCNEARMOVAL,80HANDAL,BLJNZMINUSJMPDISPMINUS:MOVDL,'-'MOVAH,2INT21HNEGBLJMPDISPDISP:MOVCX,100CALLDEC_DIVMOVCX,10CALLDEC_DIVMOVCX,1CALLDEC_DIVMOVAH,4CHINT21HXIANSHIENDPDEC_DIVPROCNEARMOVAX,BXMOVD
6、L,0DIVMOVMOVMOVADDMOVINTCLBL,AHBH,0DL,ALDL,30HAH,221HRETDEC_DIVENDPCODEENDSENDBEGIN4.求一个数据块(由20个单字节的带符号数组成)中的正数和(≤字)和负数和(≤字),并在屏幕上用十进制的形式显示出两个和。程序如下:DATASEGMENTBLOCKDW-100,100,200,-200,5,6,7,8,9,10DW11,12,13,14,15,50,-50,150,-150,-200POSITDW?NEGATDW?ST1DB'
7、Thesumofallthepositivenumbers:$'ST2DB'Thesumofthenegativenumbers:$'MOVAX,DATAMOVDS,AXMOVBX,OFFSETBLOCKMOVSI,0MOVDI,0MOVCX,20X1:MOVAX,[BX]CMPAX,0JGEX3ADDDI,AXJMPX2X3:ADDSI,AXX2:ADDBX,2LOOPX1MOVPOSIT,SIMOVNEGAT,DIMOVMOVMOVBX,SIDX,OFFSETST1AH,9INT21HCALLXIANS
8、HIMOVDL,0DHMOVAH,2INT21HMOVDL,0AHMOVAH,2INT21HMOVBX,NEGATNEGBXANDBX,7FFFHMOVDX,OFFSETST2MOVAH,9INT21HMOVDL,'-'MOVAH,2INT21HCALLXIANSHIMOVAH,4CHINT21HSTARTENDPXIANSHIPROCNEARMOVCX,100CALLDEC_DIVMOVCX,10