学号:0121211350313微机原理及接口技术课程设计题目显示姓名字样的程序学院自动化学院专业电气工程及其自动化班级电气1203姓名杨敏指导教师李道远2014年12月27日课程设计任务书学生姓名:杨敏专业班级:电气1203指导教师:李道远工作单位:自动化学院题目:显示姓名字样的程序初始条件:编写显示“自己姓名”字样的程序。并能由小到大,由大到小变化。按Q退出程序。要求完成的主要任务:(包括课程设计工作量及其技术要求,以及说明书撰写等具体要求)(1)设计任务及要求分析(2)方案比较及认证说明(3)系统原理阐述(4)硬件设计课题需要说明:硬件原理,电路图,采用器件的功能说明(5)软件设计课题需要说明:软件思想,流程图,源程序及程序注释(6)调试记录及结果分析(7)总结(8)参考资料(9)附录:芯片资料或程序清单,软件演示屏幕拷贝图或硬件实物图目录1.课程任务及其要求分析.......................42.系统原理阐述...............................43.汇编语言程序设计...........................53.1主程序设计及其原理分析.....................53.1.1设计思路..............................53.1.2流程图................................53.1.3主程序................................63.2各子程序原理分析...........................83.2.1三种字体输出子程序及其功能说明............83.2.2延迟子程序及其功能说明..................93.2.3清屏子程序及其功能说明..................93.2.4换行子程序及其功能说明.................104.程序测试记录及其结果分析..................105.小结......................................126.参考文献..................................121.课程任务及其要求分析对任务书进行分析可知,本课程设计的任务为用汇编语言设计显示自己姓名的程序并且要求姓Q键退出程序。设计的基本要求为认真编写程序,并在规定的时间内写好课程设计报告书,报告书的基本要求为(1)设计任务及要求分析(2)系统原理阐述(3)软件思想,流程图,源程序及程序注释(4)调试记录及结果分析(5)总结(6)参考资料,(7)最后附上《本科生课程设计评定表》并且在规定的时间内完成课程设计报告书,提交报告书并进行答疑2.系统原理阐述分析设计任务及要求可以得知编写此汇编程序的基本原理,编写一个主程序和若干个子程序(延时子程序、换行子程序、清屏子程序、显示姓名子程序)来完成设计任务所要求的功能,用这种方法比较简单,主程序完成的功能为:首先要输出开始语句,提示用户输入字体规格,取得字体规格后调用输出姓名子程序,为了使我们能够看到自己的名字必须调用延时子程序以增加显示的时间,调用结束马上输出结束语句,提示用户是按Q退出还是按N继续输出姓名,当得到N以后必须马上清屏,然后再次调用提示信息子程序和显示姓名子程序,换行子程序的原理为通过int21h的02h功能来完成,清屏子程序的原理为通过int10h的06h的屏幕上卷功能来完成清屏通过AL可以设计一次清屏的行数。显示姓名子程序的原理为首先通过汉字取模软件完成姓名汉字的编码,经过的方格用1表示,没有经过的方格用0表示,然后应用int10h的02号功能完成字符的显示,1输出为*,0输出空格,将主程序和各个子程序组合在一起即可完成汇编程序的编制。3.汇编语言程序设计3.1主程序设计及其原理分析3.1.1设计思路根据设计任务及要求可知,汇编语言的基本思想为编写一个主程序和若干个子程序,各子程序分别为:延时子程序、换行子程序、清屏子程序、显示姓名子程序,在程序运行时用主程序分别调用各个子程序,即可完成汇编语言程序的编制。因为各个子程序是相互独立的,这样可以先依靠主程序来完成一部分功能,然后通过增加子程序逐渐增加系统的功能,最终达到所要求的功能。3.1.2流程图3.1.3主程序datasegment;数据段yang16DB08H,00H,88H,1FH,08H,08H,08H,04H,3FH,02H,08H,01H,8CH,7FH,1CH,49H,2AH,49H,2AH,49H,89H,48H,88H,44H,48H,44H,28H,42H,08H,29H,88H,10H;杨16x16min16DB02H,04H,02H,04H,0FEH,04H,01H,7CH,7EH,22H,42H,22H,4AH,22H,52H,25H,0FFH,15H,42H,14H,49H,08H,51H,08H,0FFH,14H,40H,12H,28H,21H,90H40H;敏16x16yang24DB00H,00H,00H,04H,00H,00H,07H,00H,20H,06H,3FH,0F0H,06H,00H,60H,06H,00H,0C0H,06H,41H,00H,3FH,82H,00H,06H,04H,00H,06H,08H,00H,07H,3FH,0FCH,0EH,92H,6CH,0EH,0C6H,4CH,1EH,44H,0CCH,16H,08H,8CH,26H,11H,88H,26H,21H,08H,46H,42H,08H,06H,04H,08H,06H,08H,08H,06H,10H,18H,06H,60H,0F0H,06H,00H,20H,00H,00H,00H;杨24x24min24DB00H,00H,00H,00H,00H,00H,06H,00H,0C0H,0CH,01H,80H,08H,0DH,80H,1FH,0F1H,00H,10H,01H,00H,28H,13H,0FCH,2FH,0FBH,18H,49H,15H,10H,09H,95H,10H,08H,99H,10H,08H,15H,10H,3FH,0F8H,90H,1AH,10H,0B0H,11H,10H,0A0H,11H,90H,60H,11H,30H,60H,3FH,0FCH,60H,10H,20H,0B0H,00H,21H,18H,01H,0E2H,0EH,00H,0CCH,04H,00H,00H,00H;敏24x24yang32DB00H,00H,00H,00H,00H,00H,00H,00H,01H,00H,00H,00H,01H,0C0H,00H,80H,01H,87H,0FFH,0C0H,01H,82H,01H,0C0H,01H,80H,03H,00H,01H,80H,06H,00H,01H,88H,0CH,00H,3FH,0FCH,18H,00H,01H,80H,30H,00H,01H,80H,60H,00H,01H,80H,0C0H,00H,03H,0C1H,80H,18H,03H,0E3H,0FFH,0FCH,03H,0B8H,31H,98H,07H,98H,21H,98H,05H,98H,63H,18H,0DH,88H,0C3H,18H,09H,80H,86H,18H,19H,81H,8CH,18H,11H,82H,0CH,18H,21H,84H,18H,10H,41H,88H,30H,30H,01H,90H,60H,30H,01H,80H,0C0H,30H,01H,81H,80H,30H,01H,82H,08H,70H,01H,8CH,07H,0E0H,01H,90H,01H,0C0H,01H,80H,00H,80H,00H,00H,00H,00H;杨32x32min32DB00H,00H,00H,00H,00H,00H,00H,00H,03H,00H,04H,00H,03H,80H,07H,00H,03H,00H,06H,00H,06H,00H,0CCH,00H,07H,0FFH,0ECH,00H,04H,00H,0CH,00H,0CH,00H,08H,00H,1CH,01H,18H,18H,17H,0FFH,9FH,0FCH,26H,01H,98H,20H,46H,41H,28H,20H,06H,21H,28H,20H,06H,31H,48H,60H,06H,33H,88H,60H,04H,03H,64H,60H,3FH,0FFH,0F4H,60H,0CH,03H,04H,40H,0CH,83H,04H,0C0H,0CH,63H,02H,0C0H,0CH,23H,02H,0C0H,0CH,23H,03H,80H,08H,03H,41H,80H,18H,03H,0E3H,80H,1FH,0FFH,0F6H,0C0H,00H,02H,04H,60H,00H,06H,08H,70H,00H,7EH,30H,3CH,00H,1CH,40H,18H,00H,18H,80H,00H,00H,00H,00H,00H;敏32x32BeginWorddb'PleaseChooseaprintsize1,2or3','$';开始语句QuitWorddb'Doyouwanttoexit?Q/N','$';结束语句KongHangdb'','$;'输出8位空格dataendscodesegment;代码段assumecs:code,ds:datastart:MOVAX,DATAMOVDS,AXagain:leadx,BeginWord;程序开始语句,选择字体movah,9int21hcallCTLFmovah,1int21hcallCTLFcmpal,'3'jzzhi3cmpal,'2'jzzhi2cmpal,'1'jzzhi1jmpagainzhi1:callprint1;输出1号字体jmpchoosezhi2:callprint2;输出2号字体jmpchoosezhi3:callprint3;输出3号字体choose:calldelay;结束选择leadx,QuitWordmovah,9int21hcallCTLFmovah,1int21hcallCTLFcmpal,'Q'jzQuitcmpal,'N'jnzchoosecallqingpingjmpagainQuit:movax,4c00hint21hcodeendsendstart3.2各子程序原理分析3.2.1三种字体输出子程序及其功能说明以2号字体输出子程序为例print2procnear;输出2号字体(24x24)子程序leasi,yang24;置偏移地址leadi,min24movcx,24;列循环lie2:pushcxmovcx,3hangy2:pushcx;第一个字行循环movbl,byteptr[si]movcx,8loopy2:shlbl,1;移位判断输出类型jncc1movdl,2ahmovah,2int21hjmpd1c1:movdl,20hmovah,2int21hd1:looploopy2popcxincsiloophangy2leadx,KongHang;输出两字中间8位空格movah,9int21hmovcx,3hangm2:pushcx;第二个字行循环movbl,byteptr[di]movcx,8loopm2:shlbl,1;移位判断输出类型jncc2movdl,2ahmovah,2int21hjmpd2c2:movdl,20hmovah,2int21hd2:looploopm2popcxincdiloophangm2callCTLF;换行popcxlooplie2retprint2endp3.2.2延迟子程序及其功能说明delayprocnear;延迟子程序pushcxmovcx,0d000hloop$popcxretdelayendp3.2.3清屏子程序及其功能