您好,欢迎访问三七文档
当前位置:首页 > 临时分类 > 《微机原理与汇编》教学实习报告
天津农学院计算机科学与信息工程系《微机原理与汇编》教学实习报告实习名称:用汇编语言实现音乐程序设计专业:班级:学号:姓名:指导教师:成绩:2012年3月4日1目录1教学实习的内容………………………………………………22教学实习的目的………………………………………………23教学实习设计介绍……………………………………………23.1设计题目………………………………………………………23.2设计目标………………………………………………………23.3系统的主要功能………………………………………………23.4系统开发与调试过程…………………………………………23.4.1程序设计准备阶段…………………………………………23.4.2程序设计阶段………………………………………………23.4.3程序调试、测评、试运行阶段……………………………133.5技术要点介绍…………………………………………………144总结与体会……………………………………………………141教学实习的内容综合运用学过汇编语言知识,设计一个音乐演奏程序。从而学习综合程序的2设计、编制及调试。2教学实习的目的通过实验能够较全面的巩固和应用课堂中所学的基本理论和程序设计方法,能够较熟练地完成汇编语言程序的设计、编制和调试。3教学实习设计介绍3.1设计题目音乐演奏_乐曲演奏3.2设计目标编写一个音乐程序,要求:按数字“1”,唱乐曲“玛丽有只小羔羊”;按数字“2”,唱乐曲“太湖船”;按数字“3”,唱乐曲“祝福歌”;按数字“4”,唱乐曲“亚洲雄风”;按Q鍵,退出。3.3系统的主要功能利用发声程序,可以编写演奏乐曲的程序。乐曲是按照一定的高低、强弱和长短关系组成的音调,在一首乐曲中,每个音符的音高和音长与频率和节拍有关。组成乐曲的每个音符的频率值和持续时间是乐曲程序发声所需要的两个数据。本系统基于上述原理,根据音调与频率的关系,按照乐曲的曲谱将每个音符的频率和持续时间定义成两个数据表,然后依次取出表中的频率值和时间值,调用sounding程序用计算机扬声器唱歌曲。3.4系统开发与调试过程3.4.1程序设计准备阶段为演奏的乐曲定义一个频率表和一个节拍时间表,在程序数据段中分别由MUS_FREG和MUS_TIME所指向的数组;3.4.2程序设计阶段stackSEGMENTstackdw20Hdup(?)3stackendsDATASEGMENTmsg1DB0DH,0AH,'WELCOMEYOUTOCOMEHERE!$'msg2DB0DH,0AH,'thisisamusicprogram!$'msg3DB0DH,0AH,'pleaseselect!$'msg4DB0DH,0AH,'INPUTERROR!$'msg5DB0DH,0AH,'PLEASEINPUTAGAIN!$'MUSLISTDB0DH,0AH,'1MUSIC1'DB0DH,0AH,'2MUSIC2'DB0DH,0AH,'3MUSIC3'DB0DH,0AH,'4MUSIC4'DB0DH,0AH,'QEXIT'db0dh,0ah,'$'MUS_FREG1DW330,294,262,294,3DUP(330)4DW3DUP(294),330,392,392DW330,294,262,294,4DUP(330)DW294,294,330,294,262,0MUS_TIME1DW6DUP(25*8),50*8DW2DUP(25*8,25*8,50*8)DW12DUP(25*8),100*8MUS_FREG2DW330,392,330,294,330,392,330,294,330DW330,392,330,294,262,294,330,392,294DW262,262,220,196,196,220,262,294,332,262,0MUS_TIME2DW3DUP(50),25,25,50,25,25,100DW2DUP(50,50,25,25),100DW3DUP(50,25,25),100MUS_FREG3DW262,262,294,262,349DW330,262,262,294,2625DW392,349,262,262,523DW440,349,262,262,466DW466,440,262,392,349,0MUS_TIME3DW50,50,100,100,100DW100,100,50,50,100,100DW100,100,100,50,50,100DW100,100,100,100,100,50DW50,100,100,100,100,100MUS_FREG4DW262,196,262,294,330,262,262,392,262,330,294,262,294DW262,196,262,294,330,262,262,440,262,330,294,262,294,392DW262,196,262,294,330,262,262,392,262,330,294,262,294DW262,196,262,294,330,262,220,262,440,392,392,392DW392,262,392,392,349,349,330,262,392,262,294,330DW392,523,392,392,440,440,392,349,330,262,294,294,262DW392,392,392,262,440,392,392,349,392,330,262,392,262,2946DW392,392,392,262,392,440,440,440,392,349,330,262,294,294,262,0MUS_TIME4DW50,25,25,18,7,25,25,25,25,25,18,7,100DW50,25,25,18,7,50,25,25,25,25,18,7,25,75DW50,25,25,18,7,50,25,25,25,25,18,7,100DW50,25,25,18,7,75,25,25,13,25,12,100DW50,25,25,13,12,75,25,25,25,18,7,100DW50,25,25,13,12,50,13,12,25,25,25,13,112DW25,25,13,37,13,25,62,25,25,25,25,25,13,62DW25,25,13,37,13,25,12,25,13,12,25,25,25,13,112DATAENDSCODESEGMENTASSUMECS:CODE,DS:DATA,ss:stackSTART:MOVAX,DATA7MOVDS,AXMOVDX,OFFSETmsg1MOVAH,09INT21HMOVDX,OFFSETmsg2MOVAH,09INT21HMOVDX,OFFSETmsg3MOVAH,09INT21Hmovdx,offsetMUSLISTmovah,09int21h;显示提示信息movah,01h8int21h;MOVDL,ALCMPal,31HJEMUSIC1CMPal,32HJEMUSIC2CMPal,33HJEMUSIC3CMPal,34HJEMUSIC4CMPal,51HJEEXIT;比较所选数ERROR:MOVDX,OFFSETmsg4MOVAH,099INT21HMOVDX,OFFSETmsg5MOVAH,09INT21HJMPSTARTEXIT:JMPENDINGMUSIC1:MOVSI,OFFSETMUS_FREG1MOVBP,OFFSETMUS_TIME1REPT1:MOVDI,[SI]CMPDI,0JEENDINGMOVBX,DS:[BP]10CALLSOUNDINGADDSI,2ADDBP,2JMPREPT1MUSIC2:MOVSI,OFFSETMUS_FREG2MOVBP,OFFSETMUS_TIME2jmpREPT1MUSIC3:MOVSI,OFFSETMUS_FREG3MOVBP,OFFSETMUS_TIME3jmpREPT1MUSIC4:MOVSI,OFFSETMUS_FREG4MOVBP,OFFSETMUS_TIME4jmpREPT111ENDING:MOVAH,4CHINT21HSOUNDINGPROCNEARPUSHAXPUSHBXPUSHCXPUSHDXPUSHDIMOVAL,0B6HOUT43H,ALMOVDX,12HMOVAX,34DCHDIVDIOUT42H,AL12MOVAL,AHOUT42H,ALINAL,61HMOVAH,ALORAL,3OUT61H,ALDELAY:MOVCX,1000DL10:MOVDI,CXMOVCX,2000DL001:LOOPDL001MOVCX,DILOOPDL10DECBXJNZDELAY13MOVAL,AHOUT61H,ALPOPDIPOPDXPOPCXPOPBXPOPAXRETSOUNDINGENDPCODEENDSENDSTART3.4.3程序调试、测评、试运行阶段1.用记事本或EDIT编辑程序在磁盘上建立源程序。2.源文件建立后,用MASM程序对源文件进行汇编,汇编后产生二进制的目标文件(OBJ文件)。3.使用连接程序LINK把文件转换为可执行的EXE文件。4.在建立了.EXE文件之后,就可以直接从DOS执行程序。3.5技术要点介绍14这个程序的技术要点在于sounding子程序的运用和循环结构的设计,利用合适的延时使计算机扬声器发出音乐声。4总结与体会通过对这次音乐程序的设计,学会了如何应用汇编语言实现音乐发生程序的设计。让我对音乐程序的编写涉及了的分支结构的设计,循环结构的设计,主子结构程序的设计以及DOS和BIOS常用功能调用的使用等诸多方面有所提高,从而更加地了解了汇编这门课程。参考文献:[1]李乃祥主编,《微机原理与汇编语言程序设计》(上册),天津:南开大学出版社,2004年[2]李乃祥主编,《微机原理与汇编语言程序设计》(下册),天津:南开大学出版社,2007年
本文标题:《微机原理与汇编》教学实习报告
链接地址:https://www.777doc.com/doc-3454214 .html