西安电子科技大学微机原理大作业

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

西安电子科技大学微机原理大作业第一次上机一、实验目的1.熟练掌握8086/8088的各种寻址方式及应用。2.掌握DEBUG调试程序中的一些常用命令的使用方法,为以后的实验打下基础二、实验仪器586微机1台三、实验内容1.关于数据的寻址方式练习8086/8088提供多种方式实现操作数寻址,大体可分为7种:a.立即寻址b.寄存器寻址c.直接寻址d.寄存器间接寻址e.寄存器相对寻址f.基址变址寻址g.基址变址且相对寻址掌握8086/8088的这些寻址方式,是学习汇编语言编程的关键。指令SRC寻址方式SRC的地址AX推算值AX实际值MOVAX,CX寄存器寻址00050005MOVAX,500H立即寻址05000500MOVAX,TABLE直接寻址1541:0004A5A4A5A4MOVAX,ES:[BX]寄存器间接寻址1542:0004C5C4C5C4MOVAX,[BX+05H]寄存器相对寻址1541:0009AAA9AAA9MOVAX,寄存器相153FB8BB8BSS:[BX]+03H对寻址:000777MOVAX,TABLE[BX]寄存器相对寻址1541:0008A9A8A9A8MOVAX,07H[BX]寄存器相对寻址1541:000BACABACABMOVAX,[BP]寄存器间接寻址153F:0003B4B3B4B3MOVAX,TABLE[BP]寄存器相对寻址1541:0007A8A7A8A7MOVAX,08H[BP]寄存器相对寻址153F:000BBCBBBCBBMOVAX,[BP+06H]寄存器相对寻址153F:0009BAB9BAB9MOVAX,寄存器相1541A7AA7ADS:[BP+03H]对寻址:000666MOVAX,[BP]+05H寄存器相对寻址153F:0008B9B8B9B8MOVAX,ES:[SI+03H]寄存器相对寻址1542:0005C6C5C6C5MOVAX,[DI+06H]寄存器相对寻址1541:0007A8A7A8A7MOVAX,[DI]+05H寄存器相对寻址1541:0006A7A6A7A6MOVAX,TABLE[SI]寄存器相对寻址1541:0006A7A6A7A6MOVAX,[SI]寄存器间接寻址1541:0002A3A2A3A2MOVAX,TABLE寄存器相1541A6AA6A[DI]对寻址:000555MOVAX,[SI]+05H寄存器相对寻址1541:0007A8A7A8A7MOVAX,[BX][DI+01H]基址变址且相对寻址1541:0006A7A6A7A6MOVAX,[BX][SI]+03H基址变址且相对寻址1541:0009AAA9AAA9MOVAX,TABLE[BX][SI]基址变址且相对寻址1541:000AABAAABAAMOVAX,ES:[BX][DI]基址变址寻址1542:0005C6C5C6C5MOVAX,[BP][DI+02H]基址变址且相对寻址153F:0006B7B6B7B6MOVAX,TABLE基址变址1541A9AA9A[BP][DI]且相对寻址:000888MOVAX,ES:[BP][SI]基址变址寻址1542:0005C6C5C6C5MOVAX,[BP][SI+05H]基址变址且相对寻址153F:000ABBBABBBAMOVAX,03H[BP][DI]基址变址且相对寻址153F:0007B8B7B8B7MOVAX,[BP][SI]基址变址寻址153F:0005B6B5B6B5MOVAX,[BP+02H][DI+03H]基址变址且相对寻址153F:0009BAB9BAB9MOVAX,TABLE[BP+02H][DI+03H]基址变址且相对寻址1541:000DAEADAEAD第二次上机一、实验目的1.熟练掌握汇编语言程序设计的方法及上机步骤。2.掌握算术运算中,十进制数调整指令的应用。3.掌握子程序的设计方法。4.掌握DOS功能的调用方法。二、实验仪器586微机1台三、实验内容1.编写求十进制数02121424与21736543之和的程序,并将和以十进制数的形式送屏幕显示。STACKSEGMENTSTACK'STACK'DW100HDUP(?)STACKENDSDATASEGMENTADD1DD02121424HADD2DD21736543HSUMDD?DATAENDSCODESEGMENTASSUMECS:CODE,DS:DATA,ES:DATA,SS:STACKSTART:MOVAX,DATAMOVDS,AXMOVES,AXMOVAX,STACKMOVSS,AXLEASI,ADD1LEADI,ADD2LEABX,SUMMOVAL,[SI]ADDAL,[DI]DAAMOV[BX],ALMOVAL,[SI+1]ADCAL,[DI+1]DAAMOV[BX+1],ALMOVAL,[SI+2]ADCAL,[DI+2]DAAMOV[BX+2],ALMOVAL,[SI+3]ADCAL,[DI+3]DAAMOV[BX+3],ALMOVDL,00ADCDL,00CALLDISPSUMMOVAH,4CHINT21HDISPSUMPROCNEARPUSHAXPUSHBXPUSHCXPUSHSIMOVSI,4PUSHDXMOVCX,5LAB:PUSHCXPUSHBXMOVAL,DLMOVBL,DLMOVCL,4SHRAL,CLADDAL,30HMOVAH,02MOVDL,ALINT21HANDBL,0FHADDBL,30HMOVAH,02MOVDL,BLINT21HPOPBXPOPCXDECSIMOVDL,[BX][SI]LOOPLABPOPDXPOPSIPOPCXPOPBXPOPAXRETDISPSUMENDPCODEENDSENDSTART2.有一个首地址为A的N字数组,请编程序使该数组中的数按从大到小的次序排列。STACKSEGMENTSTACKDB256DUP(?)STACKENDSDATASEGMENTDATA1DW7800H,6832H,0000H,87H,1275H,0EC34HSTRING1DB'inputnumber:',0DH,0AH,'$'STRING2DB'Thenumbersfromlargetosmallis:',0DH,0AH,'$'DATAENDSCODESEGMENTASSUMECS:CODE,DS:DATA,ES:DATA,SS:STACKSTART:MOVAX,DATAMOVDS,AXMOVES,AXMOVAX,STACKMOVSS,AXLEADX,STRING1MOVAH,09HINT21HMOVCX,6LEASI,DATA1L1:MOVAX,[SI]ADDSI,2CALLDISPAXCALLDISPCRLOOPL1MOVCX,5LEASI,DATA1ADDSI,10LP1:PUSHCXPUSHSILP2:MOVAX,[SI]CMPAX,[SI-2]JBENOXCHGXCHGAX,[SI-2]MOV[SI],AXNOXCHG:DECSIDECSILOOPLP2POPSIPOPCXLOOPLP1LEADX,STRING2MOVAH,09HINT21HMOVCX,6LEASI,DATA1L2:MOVAX,[SI]ADDSI,2CALLDISPAXCALLDISPCRLOOPL2MOVAH,4CHINT21HDISPALPROCPUSHAXPUSHCXPUSHDXPUSHAXMOVCL,4SHRAL,CLCALLCHANGMOVAH,02HMOVDL,ALINT21HPOPAXANDAX,0FHCALLCHANGMOVAH,02HMOVDL,ALINT21HPOPDXPOPCXPOPAXRETDISPALENDPCHANGPROCCMPAL,10JNGECHANG1ADDAL,7CHANG1:ADDAL,30HRETCHANGENDPDISPAXPROCXCHGAL,AHCALLDISPALXCHGAH,ALCALLDISPALRETDISPAXENDPDISPCRPROCPUSHAXPUSHDXMOVAH,2MOVDL,0AHINT21HMOVAH,2MOVDL,0DHINT21HPOPDXPOPAXRETDISPCRENDPCODEENDSENDSTART第三、四次上机一、实验目的1.增强和提高汇编语言程序设计的能力,掌握模块化程序设计的方法.2.熟练掌握DOS常用功能的调用方法.二、实验仪器586微机一台三、实验内容编写如下程序,并在机器上调试成功。程序采用菜单式选择,可以接收用户从键盘输入的四个命令(1-4),各命令功能分别为:(1)按下“1”键,完成字符串小写字母变成大写字母。(2)按下“2”键,完成找最大值(3)按下“3”键,完成排序(4)按下“4”键,显示时间(5)按下“5”键,结束程序运行,返回系统提示符。;宏定义;-------------------------------------------------------;-------显示字符串-------;-------------------------------------------------------DISPLMACROSTR;FunctiontodisplaystringsPUSHDXPUSHAXLEADX,STRMOVAH,09HINT21HPOPAXPOPDXENDM;-------------------------------------------------------;-------判断用户是否选择继续-------;-------------------------------------------------------ISCONTINUEMACROL;Macrotojudgewhethertocontinue,LisamarkDISPS15,10,SMENUMOVAH,08HINT21HCMPAL,1BHJNEL;若用JE会导致编译,跳不了那么远JMPMAINENDM;-------------------------------------------------------;-----设置光标宏----;-------------------------------------------------------CURSORMACROCURX,CURYPUSHAXPUSHBXPUSHDX;DX必须保护,始终指向输入缓冲区MOVAH,02HMOVDH,CURXMOVDL,CURYMOVBH,0INT10HPOPDXPOPBXPOPAXENDM;-------------------------------------------------------;-----定位字符串显示宏------;-------------------------------------------------------DISPSMACROX,Y,STR;将STR的内容显示到X,Y的位置PUSHAXPUSHBXPUSHDXMOVAH,02HMOVBH,00H;显示页码,第0页MOVDH,X;行(X坐标)MOVDL,Y;列(Y坐标)INT10HLEADX,STRMOVAH,09HINT21HPOPDXPOPBXPOPAXENDM;-------------------------------------------------------;--------清屏加色宏------;-------------------------------------------------------SCROLLMACRON,ULR,ULC,LRR,LRC,ATTPUSHAXPUSHBXPUSHCXPUSHDXMOVAH,06HMOVAL,N;N=上卷行数;N=0时,清窗口MOVCH,ULR;左上角行号(X)MOVCL,ULC;左上角列号(Y)MOVDH,LRR;右下角行号MOVDL,LRC;右下角列号MOVBH,ATT;卷入行属性,颜色设置

1 / 44
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功