汇编语言课设文本编辑器_第1页
汇编语言课设文本编辑器_第2页
汇编语言课设文本编辑器_第3页
汇编语言课设文本编辑器_第4页
汇编语言课设文本编辑器_第5页
已阅读5页,还剩120页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

题目:文本编辑器 ... 1.2 .2.1开发背景...........................................3.3数据定义............................................4模块设计.......................................... 4.1运行结果...........................................4.2结果分析.............................................1程序测试..............................................................................摘要文本编辑器在我们的日常生活中使用非常频繁,是我们工作当1.2设计的内容的界面;2.在文本编辑区可以随意输入字符;4.实现了光标上移、下移、左移、右移;5.实现了下拉菜单以及弹出式菜单;6.可以实现屏幕的上卷和下卷;.1开发背景本次开发主要是在《微机原理与接口技术》这门课学习完成之2.2程序设计的意义本程序主要利用BIOS功能调用设计编辑器的菜单和编辑窗口,3.1总体设计方案程序利用模块化设计方法,对每个要实现的功能都设计成子程序,方便使用。程序中具体模块如图3-1。主程序绘制界面按键判断子菜单绘功能的实displaydis_edit3.2实现过程display(显示菜单栏);dis_edit(显示编辑窗口);dis_file(显示文件菜单);dis_text(显示文本菜单);key_down(光标向下);key_left(光标向左);key_up(光标向上);key_right(光标向右);key_pgup(菜单的循环选择);ok_exit(退出);open(子菜单显示及控制);.3数据定义好了,由于功能调用的需要所以把数据定义在了数据段和附加段中。以下是程序中用到数据的定义:datasegmentsdb'FileViewTextAbout$'f1db'Open',10,13,'Exit',10,13,'$'f2db'Clear$'idb0bdb0buffdb1200dup(?),'$'printfdb"Can'topentheFile$"mssdb'Massage$'ab1db'AboutEdit$'ab2db'GaoHaiFeng$'ab3db'C1141$'ab4db'2013-6-22$'dataendseatasegments1db'File$'s2db'View$'s3db'Text$'s4db'About$'s5db'Open$'s6db'Exit$'s7db'Clear$'eorrdb'eorr:$'okdb5bh,'OK',5dh,'$'designdb'Design:$'classdb'Class:$'datedb'Date:$'qqdb'QQ:$'eataends事先定义好数据的结构可以减少程序设计中很多的麻烦。块设计开开始绘制编辑绘制菜单返回3.4.2检测按键开始AH=0?是否返回3.4.3子菜单绘制该模块同样采用了BIOS功能调用设置子菜单,具体操作见图制返回4.1运行结果4.2结果分析选择、光标的移动、5.1程序测试通过本次课程设计可以说收获颇多,虽然在程序设计的过程中七、参考文献月datasegmentsdb'FileViewTextAbout$'f1db'Open',10,13,'Exit',10,13,'$'f2db'Clear$'idb0bdb0buffdb1200dup(?),'$'printfdb"Can'topentheFile$"mssdb'Massage$'ab1db'AboutEdit$'ab2db'GaoHaiFeng$'ab3db'C1141$'ab4db'2013-6-22$'dataendseatasegments1db'File$'s2db'View$'s3db'Text$'s4db'About$'s5db'Open$'s6db'Exit$'s7db'Clear$'eorrdb'eorr:$'okdb5bh,'OK',5dh,'$'designdb'Design:$'classdb'Class:$'datedb'Date:$'qqdb'QQ:$'eataendsstacksegmentdw1000dup(?)stackendscodesegmentassumeds:data,cs:code,ss:stack,es:eatamovds,axmovax,eatamoves,axmovah,0moval,3int10hcalldisplay;显示菜单栏calldis_edit;显示编辑区movah,4chthdisplayprocnear;显示菜单栏movah,6moval,0movch,0movcl,0movdh,0movdl,79movbh,70hmovmovmovmovmovmovmovmovmovmovmovmovretdisplayah,6al,1hlhdl,79bh,70hah,2bh,0hlah,09hsdis_editprocnear;显示编辑区movmovmovmovmovmovmovmovintmovmovmovmovmovmovmovpgup_r:di,0;作为缓存指针ah,6al,0hldh,24dl,79bh,1ehah,6al,1hldh,24dl,79bh,1ehmovah,2movbh,0movdh,1movdl,0int10hnext:movah,00h;从键盘读取字符int16hcmpal,1bh;判断输入的字符是否是ESCjzexitcmpal,0dhjzentercmpah,48h盘扫描码jzdi_upcmpah,4bhjzdi_leftcmpah,4dhjzdi_rightcmpah,50h;判断输入的字符是否是回车;判断按键是否是上,ah中存放的是特殊键jzdi_downjzdi_pgupcmpah,0ehjzdi_backmovbuff[di],al;每次接收一个字符时都存放到BUFF中imovbuff[di],'$'movah,2thloopnextjmpnext1;这里相当于无限循环,CX的值不起作用ffdiimovbuff[di],13imovah,3;获取光标位置movbh,0int10hcmpdh,24;判断回车之后是否是行尾jzgo_againmovmovincmovintah,2bh,0lnext1jmpnext1di_left:callkey_left;调用左移子程序jmpnext1di_right:callkey_right;调用右移子程序jmpnext1di_down:callkey_down;调用下移子程序jmpnext1jmppgup_rdi_back:callkey_backjmpnext1go_again:calldis_loop;上卷一行定位到行尾jmpnext1exit:movah,6moval,0movch,0movcl,0movdh,24movdl,79int10hretdis_editendpdis_loopprocnear;编辑区上卷一行光标定位到行尾movah,6moval,1movch,1movcl,0movdh,24movdl,79movbh,1ehint10hmovah,2movbh,0movdh,24movdl,0int10hretdis_loopendpkey_upprocnearmovah,3;读取光标位置movbh,0int10hcmpdh,1jzrodownmovah,2;定位光标位置decdhint10hreturn:retrodown:callroll_downjmpreturnkey_upendproll_downprocnear;屏幕下卷movah,7moval,1movch,1movcl,0movdh,24movdl,79movbh,1ehint10hmovah,3;读取光标位置movbh,0int10hmovah,2;定位光标位置int10hretroll_downendpkey_leftprocnearmovah,3;读取光标位置movbh,0int10hcmpdl,0;判断是否到了第一列jzgo_left;是的话移到上一行行尾movah,2movbh,0decdlint10hjmpret1go_left:cmpdh,1jnzroll_upmovah,6moval,1movch,1movcl,0movdh,24movdl,79movbh,1ehmovmovmovmovintah,2bh,0dl,79hret1roll_up:movah,2;移到上一行行尾movbh,0decdhmovdl,79int10hret1:retkey_leftendpkey_rightprocnearmovah,3;读取光标位置movbh,0dl,79go_rightdh,24on_okmovah,6moval,1movhmovlmovdh,24movdl,79movbh,1ehmovah,2movbh,0movdh,24movljmpret2movbh,0movret2go_right:movah,2movbh,0lint10hret2:retkey_rightendpkey_downprocnearmovah,3movbh,0dh,24m_downmovah,6moval,1movhmovlmovdh,24movdl,79movbh,1ehmovah,3movbh,0movah,2movbh,0movdh,24ret3m_down:movah,2movbh,0hint10hret3:retkey_downendpkey_pgupprocnear;按下pgup键的处理过程st_pgdn:calldisplaycmpi,0jnznt;判断当前的菜单项是第几个movah,6;菜单项处清屏moval,0movbh,1fhmovch,0movcl,0movdh,0movdl,3int10hmovah,13hmoval,0movcx,4movdh,0movmovmovleaintjmpnt:cmpjnzmovmovmovmovmovmovmovintmovmovmovlbl,0a5hbh,0bp,s1ret0nt1bh,1fhah,6al,0hlhdl,12ah,al,0xmovmovmovmovleaintjmpnt1:jnzmovmovmovmovmovmovmovintmovmovhlbl,0a5hbh,0bp,s2ret0cmpi,2nt2bh,1fhah,6;小菜单清屏al,0hcl,18hdl,21ah,13hal,0movmovmovmovmovleaintjmpnt2:jnzmovmovmovmovmovmovmovintmovxhdl,18bl,0a5hbh,0bp,s3ret0cmpi,3nt1bh,1fhah,6al,0hcl,27hdl,30ahhbios输出字符串movmovmovmovmovmovleaintret0:cmpjnzmovrtt:al,0xhdl,27bl,0a5hbh,0bp,s4incirttmovah,0hah,49hst_pgdnal,0dh;判断是否是回车rt0jnzlolcalldis_aboutjmprt0lol:cmpi,1jnzqqqcalldis_filejmprt0qqq:cmpi,3jnzrtt;不确定calldis_textrt0:cmpi,1jnzntfmovah,6;菜单项处清屏moval,0movbh,70hmovch,0movcl,0movdh,0movdl,3movmovmovmovmovmovmovleaintjmpntf:jnzmovmovmovmovmovmovah,13hal,0xhlbl,70hbh,0bp,s1rrrcmpi,2ntf1bh,70hah,6al,0hlhmovintmovmovmovmovmovmovmovleaintjmpntf1:jnzmovmovmovmovmovdl,12ah,al,0xhlbl,70hbh,0bp,s2rrrcmpi,3ntf2bh,70hah,6;小菜单清屏al,0hcl,18movmovintmovmovmovmovmovmovmovleaintjmpntf2:jnzmovmovmovmovhdl,21ah,al,0xhdl,18bl,70hbh,0bp,s3rrrcmpi,0rrrbh,70hah,6al,0hmovcl,27movdh,0movdl,30int10hmovah,13hmoval,0movcx,5movdh,0movdl,27movbl,70hmovbh,0leabp,s4int10hrrr:movi,0retkey_pgupendpdis_fileprocnear;显示File菜单movah,6moval,0movbh,70hmovhmovlmovhmovlmovah,6moval,1movbh,70hmovhmovlmovhmovlmovah,2movbh,0movhmovlmovleaintmovintcmpjnzan_don:jnzmovleamovmovmovmovmovmovintmovah,09hdx,f1ah,00hah,50h;如果按方向键下cmpb,0hahaah,13hbp,s6al,0xhlbh,0bl,70hah,13hmovmovmovmovmovmovhaha:movmovmovmovmovmovmovbp,s5al,0xhlbh,0bl,05ahcmpb,1ah,13hbp,s5al,0xhlbh,0bl,70hint10hmovah,13hleabp,s6moval,0movcx,4movdh,2movdl,0movbh,0movbl,05ahint10hcmpb,2jnzeeemovb,0eee:movah,00int16hcmpah,50h;判断是否是方向键下jzan_doncmpah,01h;判断是否是ESCjzrrr1cmpal,0dh;判断是否是回车jnzeeecmpb,1jnzcexitcallopenjmprrr1rrr1:movah,6moval,0movch,1movcl,0movdh,24movdl,79movbh,1ehint10hmovah,6moval,1movch,1movcl,0movdh,24movdl,79movbh,1ehint10hcalldis_buffretdis_fileendpdis_buffprocnearmovah,2movbh,0movhmovlmovah,9dx,buffretdis_buffendpopenprocnearcalldisplaymovah,6moval,0movch,1movcl,0movdh,24movdl,79movbh,1ehint10hcalldis_buff;显示缓存数据movah,6moval,0movbh,70hmovch,6movcl,19movdh,6movdl,59int10hmoval,1movbh,70hmovch,6movcl,19movdh,6movdl,59int10hmovah,2movbh,0movdh,6movdl,34int10hmovah,9leadx,mssthmovah,6moval,0movbh,5ehmovhmovcl,19movdh,14movdl,59movah,6moval,1movbh,5ehmovhmovcl,19movdh,14movdl,59movbp,eorrmoval,0movxmovbh,0movbl,52hmovdh,10movdl,24int10hmovah,2movbh,0movdh,10movdl,32int10hmovah,9leadx,printfthmovah,13hleabp,okmoval,0movcx,4movbh,0movbl,70hmovdh,12movdl,37int10hsure:movah,00hal,0dhmovah,6moval,0movhmovlmovdh,24movdl,79movbh,1ehlretdis_buffopenendpok_exitprocprocmovah,6movbh,0moval,0movch,0movcl,0movdh,24movdl,79int10hmovah,4chthretok_exitendpdis_textprocnearmovah,6moval,0movbh,70hmovch,1movcl,18movdh,1movdl,24int10hmovah,6moval,1movbh,70hmovhmovcl,18movhmovdl,24movah,2movbh,0movhmovdl,18movah,09hdx,f2movah,13hbp,s7moval,0movcx,5movdh,1movdl,18movbh,0movbl,05ahint10hint16hcmpah,01hjzr121cmpal,0dhjnzr121movbuff,'$'r121:movah,6moval,0movch,1movcl,0movdh,24movdl,79movbh,1ehint10hcalldis_buffretdis_textendpdis_aboutprocnearmovah,6moval,0movbh,70hmovch,6movcl,19movdh,6movdl,59int10hmovah,6moval,1movbh,70hmovch,6movcl,19movmovintmovmovmovmovhdl,59ah,2bh,0hdl,34int10hdx,ab1movah,6moval,0movbh,3ehmovhmovcl,19movdh,14movdl,59movmovmovmovmovmovmovintmovah,6al,1bh,3ehhcl,19dh,14dl,59ah,13hleabp,designmovcx,7movdh,8movdl,30movbh,0movbl,30hint10hmoval,0movbh,30hmovch,9movcl,30movdh,9movdl,38int10hmovah,13hmovcx,5movdh,9movdl,30movbh,0movbl,31hint10hmoval,0movbh,3ehmovch,10movcl,30movdh,10movdl,38int10hmovah,13hleabp,date;显示日期movcx,5movdh,10movdl,30movbh,0movbl,30hint10hmoval,0movbh,3ehmovch,11movcl,30movdh,11movdl,38int10hmovah,13hmovcx,3movdh,11movdl,30movbh,0movbl,

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论