您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 企业文档 > 中国石油大学2016年微机原理实验程序(最新)终稿
实验一寻址方式和汇编语言程序上机调试步骤2、在数据段X单元存放有数据42,Y单元存放有数据-43,编程求这两数之和,并把结果存放到S单元。datasegmentxdb42ydb-43sdb0dataendscodesegmentassumecs:code,ds:datastart:movax,datamovds,axmoval,xaddal,ymovs,alloop:jmploopcodeendsendstart3、已知数据段X单元存放的数据为10H,编程将该数据左移四位后存放到Y单元。datasegmentxdb10hydb0hdataendscodesegmentassumecs:code,ds:datastart:movax,datamovds,axmovcl,4hmoval,xrolax,clmovy,alloop:jmploopcodeendsendstart实验二循环程序设计1、编程将数据段从00H单元起始的十个单元赋值,值为00H~09H。DATASEGMENTDATDB10DUP(?)DATAENDSCODESEGMENTASSUMEDS:DATA,CS:CODESTART:MOVAX,DATAMOVDS,AXMOVCX,10MOVBX,0LOOPER:MOVDAT[BX],BLINCBXLOOPLOOPERLOOP:JMPLOOPCODEENDSENDSTART2、现有两组数,X=-78,127,-128,-125,88,Y=32,-43,76,95,1。编程求两个数组之和,并将结果传送到S数组内,S(i)=X(i)+Y(i)。DATASEGMENTORG0000HXDB-78,127,-128,-125,88YDB32,-43,76,95,1SDB5DUP(?)DATAENDSCODESEGMENTASSUMEDS:DATA,CS:CODESTART:MOVAX,DATAMOVDS,AXMOVCX,5MOVBX,0LOOPER:MOVAL,X[BX]MOVDL,Y[BX]ADDAL,DLMOVS[BX],ALINCBXLOOPLOOPERLOOP:JMPLOOPCODEENDSENDSTART3、现有两个多位十进制数,X=5790123467,Y=1357902468。编程求X和Y之和,并将结果传送到S。DATASEGMENTORG0000HXDB67H,34H,12H,90H,57HYDB68H,24H,90H,57H,13HSDB5DUP(?)DATAENDSCODESEGMENTASSUMEDS:DATA,CS:CODESTART:MOVAX,DATAMOVDS,AXMOVCX,5MOVBX,0LOOPER:MOVAL,X[BX]MOVDL,Y[BX]ADCAL,DLDAAMOVS[BX],ALINCBXLOOPLOOPERLOOP:JMPLOOPCODEENDSENDSTART实验三、子程序调用程序设计1、用子程序调用(段内近程调用)编程,将以下十个数从小到大排序。85,77,126,-1,-43,37,-128,11,-19,13。DATASEGMENTXDB85,77,126,-1,-43,37,-128,11,-19,13COUNTEQU$-XDATAENDSCODESEGMENTASSUMEDS:DATA,CS:CODESTART:MOVAX,DATAMOVDS,AXCALLSUB1LOOP4:JMPLOOP4SUB1PROCNEARMOVSI,0MOVCX,COUNTDECCXLOOP1:MOVDX,CXLOOP2:MOVAL,X[SI]CMPAL,X[SI+1]JLLOOP3XCHGAL,X[SI+1]MOVX[SI],ALLOOP3:INCSILOOPLOOP2MOVCX,DXMOVSI,0LOOPLOOP1RETSUB1ENDPCODEENDSENDSTART实验四、DOS系统功能调用1、从键盘连续输入5个单个字符(如:1、2、3、4、5),并将其压入堆栈,并显示。DATASEGMENTDUFDB10DUP(?)DATAENDSSTACKSEGMENTSADB100DUP(?)TOPLABELWORDSTACKENDSCODESEGMENTASSUMEDS:DATA,CS:CODE,SS:STACKSTART:MOVAX,STACKMOVSS,AXMOVSP,OFFSETTOPPUSHDSSUBAX,AXPUSHAXMOVAX,DATAMOVDS,AXMOVCX,05HMOVAL,0S1:MOVAH,1INT21HPUSHAXLOOPS1MOVDL,0DHMOVAH,02HINT21HMOVDL,0AHMOVAH,02HINT21HMOVCX,05HMOVBX,4S2:POPAXMOVDUF[BX],ALDECBXLOOPS2MOVBX,0MOVCX,05HS3:MOVDL,DUF[BX]INCBXMOVAH,2HINT21HLOOPS3INCALMOVAH,4CHINT21HCODEENDSENDSTART2、从键盘输入一行字符串到内存缓冲区,并显示。DATASEGMENTXDB50DB?DB50DUP('$')DATAENDSCODESEGMENTASSUMEDS:DATA,CS:CODESTART:MOVAX,DATAMOVDS,AXMOVDX,OFFSETXMOVAH,0AHINT21HMOVDL,0AHMOVAH,02HINT21HMOVDL,0DHMOVAH,02HINT21HMOVDX,OFFSET[X+2]MOVAH,09HINT21HMOVAH,4CHINT21HCODEENDSENDSTART实验五接口实验预备知识1、调试5秒倒计时程序,掌握1秒延时子程序的调用方法,观察屏幕输出结果,调整好延时常数。DATASEGMENTXDB35H,34H,33H,32H,31HDATAENDSCODESEGMENTASSUMECS:CODE,DS:DATASTART:MOVAX,DATAMOVDS,AXLEABX,XMOVCX,5LOOP1:MOVDL,[BX]INCBXMOVAH,02HINT21HCALLDELAYLOOPLOOP1MOVAH,4CHINT21HDELAYPROCNEARPUSHBXPUSHCXMOVBX,800FOR1:MOVCX,0FFFFHFOR2:LOOPFOR2DECBXJNZFOR1POPCXPOPBXRETDELAYENDPCODEENDSENDSTART实验六简单的输出接口1、利用74LS75芯片设计一个简单的输出接口电路。先使1个绿色LED亮3秒钟后熄灭,然后使1个黄色LED亮灭3次后熄灭,亮灭间隔1秒钟,最后使1个红色LED亮3秒钟熄灭。以上现象重复2次,然后所有LED熄灭。要求总线数据信号为高电平时,LED点亮。CODESEGMENTASSUMECS:CODEstart:movdi,2l1:moval,02hmovdx,280houtdx,almovsi,3next:calldelaydecsijnznextmoval,00hmovdx,280houtdx,alcalldelaymovsi,3l2:moval,04hmovdx,280houtdx,alcalldelaymoval,00hmovdx,280houtdx,alcalldelaydecsijnzl2moval,08hmovdx,280houtdx,almovsi,3next1:calldelaydecsijnznext1moval,00hmovdx,280houtdx,alcalldelaydecdijnzl1MOVAH,4CHINT21HDELAYPROCNEARPUSHCXMOVBX,300HFOR1:MOVCX,0FFFFHFOR2:LOOPFOR2DECBXJNZFOR1POPCXRETDELAYENDPCODEENDSENDSTART2、利用74LS273芯片设计一个简单的输出接口电路,使八个LED循环顺序点亮,要求每个LED亮0.5秒,循环3次,然后所有LED熄灭。要求总线数据信号为高电平时,LED点亮。CODESEGMENTASSUMECS:CODESTART:MOVCX,3AA:MOVBX,8PUSHCXMOVDX,280HMOVAL,01HBB:OUTDX,ALCALLDELAYMOVDX,280HROlAL,1OUTDX,ALDECBXJNZBBPOPCXMOVDX,280HmovAL,00hOUTDX,ALLOOPAAMOVAH,4CHINT21HDELAYPROCNEARPUSHBXPUSHCXMOVBX,300HFOR:MOVCX,0FFFFHFOR1:LOOPFOR1DECBXJNZFORPOPCXPOPBXRETDELAYENDPCODEENDSENDSTART实验七简单的输入接口2、通过扳动电平开关输出的高低电平来作为读入信号,电平开关来回扳动一次(正确理解来回扳动一次的含义)作为一个读入过程,一个过程为一个累加数,在屏幕上显示累加结果,在屏幕上显示“6”后,再换行输出“END”,程序结束。DATASEGMENTXDB'END','$'DATAENDSCODESEGMENTASSUMECS:CODE,DS:DATASTART:MOVAX,DATAMOVDS,AXMOVDL,31HMOVCX,6L1:PUSHDXMOVDX,280HINAL,DXANDAL,01HMOVAH,ALL2:INAL,DXANDAL,01HCMPAH,ALJZL2L3:INAL,DXANDAL,01HCMPAH,ALJNZL3POPDXMOVAH,02HINT21HINCDLLOOPL1MOVDL,0AHMOVAH,02HINT21HMOVDL,0DHMOVAH,02HINT21HLEADX,XMOVAH,9INT21HMOVAH,4CHINT21HCODEENDSENDSTART实验八数码管动态显示实验1、使两个数码管分别显示“HP”,显示保持5秒钟后两个数码管熄灭。CODESEGMENTASSUMECS:CODESTART:MOVCX,03FFHL1:MOVDX,280HMOVAL,00HOUTDX,ALMOVDX,290HMOVAL,76H;HOUTDX,ALMOVDX,282HMOVAL,02HOUTDX,ALCALLDELAYMOVDX,282HMOVAL,00HOUTDX,ALMOVDX,290HMOVAL,73H;POUTDX,ALMOVDX,280HMOVAL,01HOUTDX,ALCALLDELAYLOOPL1MOVDX,280HMOVAL,00HOUTDX,ALMOVAH,4CHINT21HDELAYPROCNEARPUSHCXPUSHBXMOVBX,0100HFOR1:MOVCX,0100HFOR2:LOOPFOR2DECBXJNZFOR1POPBXPOPCXRETDELAYENDPCODEENDSENDSTART2、使两个数码管分别显示01,23,45,67,89,每组字符显示保持2秒钟,程序结束后数码管熄灭。ASSUMECS:CODESTART:MOVCX,01FFHL1:MOVDX,280HMOVAL,00HOUTDX,ALMOVDX,290HMOVAL,3FH;0OUTDX,ALMOVDX,282HMOVAL,02HOUTDX,ALCALLDELAYMOVDX,282HMOVAL,00HOUTDX,ALMOVDX,290HMOVAL,06H;1OUTDX,ALMOVDX,280HMOVAL,01HOUTDX,ALCALLDELAYLOOPL1MOVCX,01FFHL2:MOVDX,280HMOVAL,00HOUTDX,ALMOVDX,290HMOVAL,5BH;2OUTDX,ALMOVDX,282HMOVAL,02HOUTDX,ALCALLDELAYMOVDX,282HMOVAL,00HOUTDX,ALMOVDX,290
本文标题:中国石油大学2016年微机原理实验程序(最新)终稿
链接地址:https://www.777doc.com/doc-5352543 .html