资源描述:
《微机原理程序设计》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、微机原理程序设计XX理工大学微机原理程序设计-----------------------------------------------------------实验一实验要求:试编写一个程序,要求比较数组ARRAY中的三个16位补码数,并根据比较结果在显示终端上显示如下信息:(1)如果三个数都不相等则显示0;(2)如果三个数有两个相等则显示1;(3)如果三个数都相等则显示2。程序流程图:29微机原理程序设计程序清单:DATASEGMENTARRAYDW1,2,3DATAENDSCODESEGMENTASSUMECS:CODE,DS:DATASTART:MOVAX,
2、DATAMOVDS,AXMOVAX,ARRAYMOVBX,ARRAY+2MOVCX,ARRAY+4CMPAX,BXJELCMPBX,CX29微机原理程序设计JEL1CMPAX,CXJEL1MOVDL,30HJMPEXITL:CMPBX,CXJNEL1MOVDL,32HJMPEXITL1:MOVDL,31HEXIT:MOVAH,2INT21HMOVAH,4CHINT21HCODEENDSENDSTART运行结果:ARRAY中三个数互不不相等:ARRAY中三个数有两个相等:29微机原理程序设计ARRAY中三个数都相等:实验二实验要求:从键盘输入一系列字符(以回车符结束)
3、,并按字母、数字及其它字符分类计数,最后显示出这三类计数结果。程序流程图:29微机原理程序设计程序清单:DATASEGMENTCOUNT_OF_LETTERDB'thenumberofletteris:','$'COUNT_OF_NUMBERDB'thenumberofnumberis:','$'COUNT_OF_CHARACTERDB'thenumberofcharateris:','$'DATAENDSCODESEGMENTASSUMECS:CODE,DS:DATASTART:PUSHDSSUBAX,AXPUSHAXMOVAX,DATAMOVDS,AXMOVBH
4、,0MOVBL,0MOVCL,0NEXT:MOVAH,1INT21HCMPAL,0DHJEEXITCMPAL,30HJBCOUT_OF_CHARATER_ADDCMPAL,39HJBECOUT_OF_NUMBER_ADDCMPAL,41HJBCOUT_OF_CHARATER_ADDCMPAL,5AHJBECOUNT_OF_LETTER_ADDCMPAL,61HJBCOUT_OF_CHARATER_ADDCMPAL,7AHJBECOUNT_OF_LETTER_ADDCOUT_OF_CHARATER_ADD:INCCLJMPNEXTCOUT_OF_NUMBER_ADD:
5、INCBLJMPNEXTCOUNT_OF_LETTER_ADD:INCBHJMPNEXT29微机原理程序设计EXIT:CALLCRLFLEADX,COUNT_OF_LETTERMOVAH,09INT21HMOVAL,BHCALLBIN_DECCALLCRLFLEADX,COUNT_OF_NUMBERMOVAH,09INT21HMOVAL,BLCALLBIN_DECCALLCRLFLEADX,COUNT_OF_CHARACTERMOVAH,09INT21HMOVAL,CLCALLBIN_DECCALLCRLFRETCRLFPROCNEARMOVAH,02MOVDL,0
6、DHINT21HMOVAH,02MOVDL,0AHINT21HRETCRLFENDPBIN_DECPROCNEARPUSHBXPUSHCXANDAX,00FFHMOVCX,0MOVBX,0MOVDL,10ROTATE:DIVDLMOVBL,AHANDAX,00FFHPUSHBXINCCXCMPAX,1029微机原理程序设计JAEROTATEMOVBX,AXPUSHBXINCCXCONTINUE:POPBXADDBL,30HMOVDL,BLMOVAH,02HINT21HLOOPCONTINUEPOPCXPOPBXRETBIN_DECENDPCODEENDSENDSTA
7、RT运行结果:实验三实验要求:假设已编制好五个歌曲程序,它们的段地址和偏移地址存放在数据段的跳转表SONGLIST中。试编一程序,根据从键盘输入的歌曲编号1~5,转去执行五个歌曲程序中的一个。程序流程图:29微机原理程序设计程序清单:DATASEGMENTSONGLISTDWMUSIC1,MUSIC2,MUSIC3,MUSIC4,MUSIC5DATAENDSCODESEGMENTASSUMECS:CODE,DS:DATASTART:MOVAX,DATAMOVDS,AXREADLIST:MOVAH,1INT21HSUBAL,'0'CMPAL,0JEEXITCMPA