




已阅读5页,还剩12页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
微机原理课程设计_简易文本编辑器-课程设计微机原理课程设计_简易文本编辑器_汇编课程设计|精品课程网站设计|课程设计网报告总结心得双击可执行文件wbbjq.exe,在出现的界面中输入任意文本内容,利用DEL键、BACKSPACE键、HOME键、END键、上下左右光标键对文本进行全屏幕编辑,按f1键激活菜单file,下移光标,选择save,输入文件名。也可以选择FILE菜单的其他菜单项,他们的功能均可实现。按f10激活帮助,按ESC键退出帮助。red_chr macro ;读取字符宏定义mov ah,0int 16hendmstring macro p1 ;输入字符光标mov ah,9lea dx,p1int 21hendmwin macro opr1,opr2,opr3,opr4,opr5,opr6 ;建立窗口mov ah,06hmov al,opr1mov bh,opr2mov ch,opr3mov cl,opr4mov dh,opr5mov dl,opr6int 10hendmpos_curse macro op1,op2,op3 ;定义光标位置mov ah,2mov bh,op1mov dh,op2mov dl,op3int 10hendmpos_get macro ;显示光标位置mov ah,03hmov bh,0int 10hendmdata segment ;定义数据段menu db File Edit Help $mass_1 db F1 Active file F10 Active help,$manu_1 db New ,13,10,$manu_2 db Open ,13,10,$manu_3 db Save ,13,10,$manu_4 db Save as ,13,10,$manu_5 db Exit ,$handle dw ?message1 db Please input file name:,$message2 db Please input save file name:,$message3 db Please input open file name:,$message4 db *The file is not save! Save it now? (Y/N)*: ,$path db 50 dup(0),$buffer db 2000 dup(?)bak db 3850 dup(0)line db ?row db ?char db ?help_mas1 db welcome use editor! $ ;帮助内容help_mas2 db please the first active help! $help_mas3 db good lucky! $help_mas4 db =$help_mas5 db Press F1 to active file. $help_mas6 db You can use DOWN cursor key to choose the fuction $help_mas7 db Press F10 to show the help massage.Press Esc To Quit$date db today ?/?/,$;调用日期hanglie db ?/?,$ ;行/列data endscode segment main proc far ;主程序assume cs:code,ds:datastart:push dssub ax,axpush axmov ax,datamov ds,axcall wind call edit retmain endpwind proc near ;创建窗口子程序win 0,3eh,1,0,24,79 ;定义窗口背景win 1,1fh,0,0,0,79win 0,1fh,24,0,24,79show: ;显示菜单位置及内容pos_curse 0,0,1 mov ah,9lea dx,menuint 21hshow_2: ;显示状态栏位置及内容pos_curse 0,24,1mov ah,9lea dx,mass_1int 21hcall win3call win4pos_curse 0,1,0mov row,dhmov line,dlwind endpedit proc nearchar_get: ;读字符call comcom proc near ;定义功能鍵pos_getmov row,dhmov line,dlfirst:pos_curse 0,row,linej00: mov ah,0int 16h ;从键盘读字符 ah=扫描码 al=字符码push axlea dx,buffermov bufferbx,alinc bxcmp ah,48h ;上jz up_1cmp ah,50h ;下jz down_1cmp ah,4bh ;左jz leftcmp ah,4dh ;右jz rightcmp ah,1ch ;回车jz enter_1call fuc_keymov ah,2mov dl,alint 21hpop axcall menu_showjmp j6down_1:jmp downenter_1:jmp enter_2up_1: jmp upleft: ;光标左移pos_getmov row,dhmov dl,linecmp line,0jnz directmov line,79dec rowcmp row,0je stop2 jmp firststop2:mov row,1jmp firstdirect: dec linecall win4 ;显示光标位置jmp firstright: ;光标右移pos_getmov row,dhmov dl,linecmp line,79jnz direct2mov line,0inc rowcmp row,24je returns1 jmp firstdirect2:inc linecall win4jmp firstenter_2:jmp enterup: ;上移光标pos_getmov row,dhmov dl,linedec rowcmp row,0je stop1call win4jmp firststop1: mov row,1jmp firstdown: ;下移光标pos_getmov row,dhmov dl,line inc rowcmp row,24je stop3call win4jmp firststop3: mov row,23jmp firstreturns1:jmp returnsenter: ;回车换行pos_getmov row,dhmov line,dlinc rowcmp row,24je returnsmov line,0call win4jmp firstreturns:mov row,24mov line,0jmp firstj6: retcom endpfuc_key proc near ;功能键子程序 next: cmp ah,47h ;homejz homecmp ah,4fh ;endjz _endcmp ah,0eh ;backspacejz bak_spcmp ah,53hjz delcmp ah,44h ;F10jz help_0rethelp_0: call helphome: ;HOME键的功能pos_getmov row,dhmov line,0call win4jmp first _end: ;END键的功能pos_getmov row,dhmov line,79call win4jmp firstbak_sp: ;退格键的功能pos_getmov row,dhmov line,dlcmp line,0je stopdec linejmp abstop: mov line,0ab: pos_get 0,row,linemov ah,2mov dl,00int 21hcall win4jmp firstdel: ;DEL删除pos_getmov row,dhmov line,dldec linepos_get 0,row,linemov ah,2mov dl,00int 21hinc linecall win4jmp firstcm: cmp line,00jz pos_cmpos_cm:pos_curse 0,0,0jmp firsthelp proc near ;显示帮助信息call savedisplay ;显示帮助信息每行的位置pos_getpush dxwin 0,57h,4,5,21,70pos_curse 0,6,25string help_mas1pos_curse 0,8,11string help_mas2pos_curse 0,10,11string help_mas3pos_curse 0,12,11string help_mas4pos_curse 0,14,11string help_mas5pos_curse 0,16,11string help_mas6pos_curse 0,18,11string help_mas7pop dxpos_curse 0,dh,dlmov ah,0int 16hcmp ah,36h ;F10 active helpjnz clscall helpcls: win 0,1eh,9,10,13,70 ;清屏call backdisplayhelp endpfuc_key endpmenu_show proc near ;显示菜单call savedisplaypush cxcmp ah,3bh ;F1功能jz menu_shjmp char_getmenu_sh: ;定义菜单的背景字体颜色pos_getpush dxwin 0,06h,2,1,7,11win 0,65h,1,0,6,10pos_curse 0,1,0string manu_1string manu_2string manu_3string manu_4string manu_5pop dxdec dlpos_curse 0,dh,dlcopmar: red_chrcmp ah,50h jz manu_njmp manu_hidmanu_hid: ;菜单隐藏win 0,1eh,1,1,7,11call backdisplayjmp char_getmanu_n: ;开始定义各个菜单项win 0,65h,5,1,5,8pos_curse 0,5,0string manu_5win 0,15h,1,1,1,8pos_curse 0,1,0string manu_1red_chrcmp ah,48hje manu_ncmp al,0dhjz new_1cmp ah,50hje manu_ojmp manu_hidmanu_n0:jmp manu_nmanu_o:win 0,65h,1,1,1,8pos_curse 0,1,0string manu_1win 0,15h,2,1,2,8pos_curse 0,2,0string manu_2red_chrcmp ah,48hje manu_ocmp al,0dhjz open_1cmp ah,50hje manu_sjmp manu_hidnew_1: jmp new_2manu_s:win 0,65h,2,1,2,8pos_curse 0,2,0string manu_2win 0,15h,3,1,3,8pos_curse 0,3,0string manu_3red_chrcmp al,0dhjz save_1cmp ah,48hje manu_scmp ah,50hje manu_ajmp manu_hidopen_1: jmp open_2manu_n1:jmp manu_nmanu_a:win 0,65h,3,1,3,8pos_curse 0,3,0string manu_3win 0,15h,4,1,4,8pos_curse 0,4,0string manu_4red_chrcmp ah,1chjz save_2cmp ah,48hje manu_acmp ah,50hje manu_ejmp manu_hidmanu_n2:jmp manu_n1new_2: jmp newsave_1: call savesave_2: call saveasmanu_e:win 0,65h,4,1,4,8pos_curse 0,4,0string manu_4win 0,15h,5,1,5,8pos_curse 0,5,0string manu_5red_chrcmp ah,50hje manu_n2cmp ah,48hje manu_ecmp ah,1chje exitjmp manu_hidexit:call backdisplaywin 0,07h,15,10,17,61win 0,24h,14,9,16,60mov dh,15mov dl,9mov bh,0mov ah,2int 10hlea dx,message4mov ah,9 int 21hmov ah,1int 21hcmp al,79h jnz qcall quittq: cmp al,6ehjz quitquit: win 0,07h,0,0,24,79pos_curse 0,0,0mov ah,4chint 21hretmenu_show endpnew proc near ;新建文件pos_getpush dxcall backdisplaywin 0,07h,15,10,17,61win 0,24h,14,9,16,60,mov dh,15mov dl,9mov bh,0mov ah,2int 10hlea dx,message1cmp al,0dhmov ah,9int 21hmov bx,0all:mov ah,1int 21hcmp al,0dhje alllmov pathbx,alinc bxjmp allalll:win 0,3eh,15,9,17,61pop dxpos_curse 0,dh,dllea dx,pathmov ah,3chmov cx,00int 21hmov handle,axmov bx,axmov ah,3ehint 21hwin 0,3eh,1,0,23,79mov dh,1mov dl,0mov bh,0mov ah,2int 10hjmp char_getnew endpopen_2: jmp opensaveas proc near ;另存为文件 ;win 0,3eh,1,0,6,10call backdisplaywin 0,07h,15,10,17,61win 0,24h,14,9,16,60,mov dh,15mov dl,9mov bh,0mov ah,2int 10hlea dx,message2mov ah,9int 21hmov bx,0bll:mov ah,1int 21hcmp al,0dhje blllmov pathbx,alinc bxjmp bllblll:pos_getpush dxwin 0,3eh,1,0,23,79call backdisplaypop dxpos_curse 0,dh,dllea dx,pathmov ah,3chmov cx,00int 21hmov handle,axlea dx,buffermov bx,handlemov cx,2000mov ah,40hint 21hmov bx,handlemov ah,3ehint 21hcall backdisplayjmp char_getsaveas endpopen proc near ;打开文件call backdisplaywin 0,07h,15,10,17,61 win 0,24h,14,9,16,60mov dh,15mov dl,9mov bh,0mov ah,2int 10hlea dx,message3mov ah,9int 21hmov bx,0cll:mov ah,1int 21hcmp al,13je clllmov pathbx,alinc bxjmp cllclll:win 0,3eh,1,0,23,79lea dx,pathmov ah,3dhmov al,0int 21hmov handle,axlea dx,buffermov bx,handlemov cx,2000mov ah,3fhint 21hwin 0,3eh,1,23,1,79mov dh,1mov dl,0mov bh,0mov ah,2int 10hmov cx,1000sub bx,bxreplay:mov dl,bufferbxinc bxmov ah,2int 21hloop replaymov bx,handlemov ah,3ehint 21hmov dh,1mov dl,0mov bh,0mov ah,2int 10hmov cx,10mov bx,0cleapath_3:mov bl,0mov pathbx,blloop cleapath_3jmp char_getopen endpsave proc near ;保存文件pos_getpush dxwin 0,3eh,1,0,6,10call backdisplaymov ah,pathcmp ah,21hjl j_3jmp j_4j_3:win 0,07h,15,10,17,61win 0,24h,14,9,16,60,mov dh,15mov dl,9mov bh,0mov ah,2int 10hlea dx,message2mov ah,9int 21hmov bx,0dll:mov ah,1int 21hcmp al,0dhje dlllmov pathbx,alinc bxjmp dlldlll:win 0,3eh,1,0,23,79pop dxpos_curse 0,dh,dlj_4: lea dx,pathmov ah,3chmov cx,00int 21hmov handle,axlea dx,buffermov bx,handlemov cx,2000mov ah,40hint 21hmov bx,handlemov ah,3ehint 21hcall backdisplayjmp char_getsave endpsavedisplay proc nearpush axpush bxpush cxpush dxpush dsmov ax,0002hint 33hmov bx,0dmov cx,3840dloop1:mov ax,0b800hmov ds,axmov dl,ds:bxmov ax,datamov ds,axmov bakbx,dlinc bxloop loop1mov ax,0001hint 33hpop dspop dxpop cxpop bxpop axsavedisplay endpbackdisplay proc nearpush axpush bxpush cxpush dxpush dsmov bx,0dmov cx,3840dloop11:mov ax,datamov ds,axmov dl,bakbxmov ax,0b800hmov ds,axmov ds:bx,dlinc bxloop loop11pop dspop dxpop cxpop bxpop axretbackdisplay endpquitt proc near ;退出call backdisplaywin 0,07h,15,10,17,61win 0,24h,14,9,16,60,mov dh,15mov dl,9mov bh,0mov ah,2int 10hlea dx,message2mov ah,9int 21hmov bx,0qll:mov ah,1int 21hcmp al,0dhje qlllmov pathbx,alinc bxjmp qllqlll:win
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 英国db3数字货币银行学试题及答案
- 银行运管考试题及答案
- 银行信贷管理试题及答案
- 甜品专业考试题库及答案
- 小学音乐专业试题及答案
- 小学语文人教部编版六年级上册《第六单元语文园地六》课件
- 美术专业试题及答案
- 国贸专业试题及答案盐工
- 湖南省邵阳市2025-2026学年高一上学期9月拔尖创新班联考物理试题(含答案)
- 热能动力专业试题及答案
- 各国见面礼仪英文版
- 2023-2024学年广东广州番禺区四年级数学第一学期期末综合测试试题含答案
- 常见症状-意识障碍的诊断评估(诊断学课件)
- 迭氮化钡(含水大于50%)化学品安全技术说明书MSDS
- 地形地貌与地质构造介绍
- 维克多高中英语3500词汇
- 工业控制系统安全风险评估(工控安全大检查)
- NY 5052-2001无公害食品海水养殖用水水质
- TSZUAVIA 009.4-2019 多旋翼无人机系统实验室环境试验方法 第4部分:低温试验
- 现状调查培训课件
- 初级社会工作实务全本课件
评论
0/150
提交评论