资源描述:
《北京邮电大学微机原理软件》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、实验报告北京邮电大学微机原理软件微机原理软件实验报告班级:姓名:学号:班内序号:指导老师:22实验报告北京邮电大学微机原理软件实验二分支、循环程序设计一、实验目的1.开始独立进行汇编语言程序设计;2.掌握基本分支,循环程序设计;3.掌握最简单的DOS功能调用.二、实验内容1.安排一个数据区,内存有若干个正数,负数和零.每类数的个数都不超过9.2.编写一个程序统计数据区中正数,负数和零的个数.3.将统计结果在屏幕上显示.4.(选作)统计出正奇数,正偶数,负奇数,负偶数以及零的个数.三、实验设计22实验报告北
2、京邮电大学微机原理软件四、源代码DATASEGMENTARRAYDB-1,-2,-3,-4,-5,-6,0,1,2,3,5,4,5,6,0COUNTEQU$-ARRAYPOSIDB0;正数NEGADB0;负数ZERODB0;零ODDPOSDB0;正奇数EVENPOSDB0;正偶数ODDNEGDB0;负奇数EVENNEGDB0;负偶数STRING1DB'正数个数:','$';把最后的统计结果显示在屏幕上STRING2DB'负数个数:','$';下同STRING3DB'零的个数:','$'STRING4DB'
3、正奇数个数:','$'STRING5DB'正偶数个数:','$'STRING6DB'负奇数个数:','$'STRING7DB'负偶数个数:','$'DATAENDSSTACKSEGMENTSTACK'STACK'DB100DUP(?)STACKENDSCODESEGMENTASSUMECS:CODE,DS:DATA,SS:STACKSTART:MOVAX,DATAMOVDS,AXMOVCX,COUNTLEABX,ARRAY;把数据段的偏移地址给BXLOOP1:CMPBYTEPTR[BX],0JGEPOSI
4、NCNEGA;统计负数TESTBYTEPTR[BX],01H;利用奇数的二进制表示式最后一位必为1的特JZENEG;点来判断奇偶INCODDNEG;统计负奇数JMPNEXTENEG:INCEVENNEG;统计负偶数JMPNEXTPOS:JZZERINCPOSI;统计正数TESTBYTEPTR[BX],01HJZEPOS22实验报告北京邮电大学微机原理软件INCODDPOS;统计正奇数JMPNEXTEPOS:INCEVENPOS;统计正偶数JMPNEXTZER:INCZERO;统计零NEXT:INCBXLO
5、OPLOOP1MOVAH,09H;显示正数MOVDX,SEGSTRING1MOVDS,DXLEADX,STRING1INT21HMOVAH,02HMOVDL,POSIADDDL,30HINT21HMOVDL,0AH;显示空格INT21H;显示回车MOVDL,0DHINT21HMOVAH,09H;显示负数MOVDX,SEGSTRING2MOVDS,DXLEADX,STRING2INT21HMOVAH,02HMOVDL,NEGAADDDL,30HINT21HMOVDL,0AHINT21HMOVDL,0DHIN
6、T21HMOVAH,09H;显示零MOVDX,SEGSTRING3MOVDS,DXLEADX,STRING3INT21HMOVAH,02HMOVDL,ZEROADDDL,30H22实验报告北京邮电大学微机原理软件INT21HMOVDL,0AHINT21HMOVDL,0DHINT21HMOVDL,0AHINT21HMOVDL,0DHINT21HMOVAH,09H;显示正奇数MOVDX,SEGSTRING4MOVDS,DXLEADX,STRING4INT21HMOVAH,02HMOVDL,ODDPOSADDD
7、L,30HINT21HMOVDL,0AHINT21HMOVDL,0DHINT21HMOVAH,09H;显示正偶数MOVDX,SEGSTRING5MOVDS,DXLEADX,STRING5INT21HMOVAH,02HMOVDL,EVENPOSADDDL,30HINT21HMOVDL,0AHINT21HMOVDL,0DHINT21HMOVAH,09H;显示负奇数MOVDX,SEGSTRING6MOVDS,DXLEADX,STRING6INT21H22实验报告北京邮电大学微机原理软件MOVAH,02HMOVD
8、L,ODDNEGADDDL,30HINT21HMOVDL,0AHINT21HMOVDL,0DHINT21HMOVAH,09H;显示负偶数MOVDX,SEGSTRING7MOVDS,DXLEADX,STRING7INT21HMOVAH,02HMOVDL,EVENNEGADDDL,30HINT21HMOVDL,0AHINT21HMOVDL,0DHINT21HMOVAX,4C00HINT21HCODEENDSENDSTART五、程序