您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 广告经营 > 汇编大作业文本编辑器实验报告
文本编辑器【程序清单】red_chrmacro;读取字符宏定义movah,0int16hendmstringmacrop1;输入字符光标movah,9leadx,p1int21hendmwinmacroopr1,opr2,opr3,opr4,opr5,opr6;建立窗口movah,06hmoval,opr1movbh,opr2movch,opr3movcl,opr4movdh,opr5movdl,opr6int10hendmpos_cursemacroop1,op2,op3;定义光标位置movah,2movbh,op1movdh,op2movdl,op3int10hendmpos_getmacro;显示光标位置movah,03hmovbh,0int10hendmdatasegment;定义数据段menudb'FileHelp$'mass_1db'F1ActivefileF10Activehelp','$'manu_1db'New',13,10,'$'manu_2db'Open',13,10,'$'manu_3db'Save',13,10,'$'manu_4db'Saveas',13,10,'$'manu_5db'Exit','$'handledw?message1db'Pleaseinputfilename:','$'message2db'Pleaseinputsavefilename:','$'message3db'Pleaseinputopenfilename:','$'message4db'***Thefileisnotsave!Saveitnow?(Y/N)***:','$'pathdb50dup(0),'$'bufferdb2000dup(?)bakdb3850dup(0)linedb?rowdb?chardb?help_mas1db'welcomeuseeditor!$';帮助内容help_mas2db'pleasethefirstactivehelp!$'help_mas3db'goodlucky!!$'help_mas4db'==========================================================$'help_mas5db'PressF1toactivefile.$'help_mas6db'YoucanuseDOWNcursorkeytochoosethefuction$'help_mas7db'PressF10toshowthehelpmassage.PressEscToQuit$'datedb'today??/??/','$';调用日期hangliedb'???//???','$';行//列dataendscodesegmentmainprocfar;主程序assumecs:code,ds:datastart:pushdssubax,axpushaxmovax,datamovds,axcallwindcalleditretmainendpwindprocnear;创建窗口子程序win0,3eh,1,0,24,79;定义窗口背景win1,1fh,0,0,0,79win0,1fh,24,0,24,79show:;显示菜单位置及内容pos_curse0,0,1movah,9leadx,menuint21hshow_2:;显示状态栏位置及内容pos_curse0,24,1movah,9leadx,mass_1int21hcallwin3callwin4pos_curse0,1,0movrow,dhmovline,dlwindendpeditprocnearchar_get:;读字符callcomcomprocnear;定义功能鍵pos_getmovrow,dhmovline,dlfirst:pos_curse0,row,linej00:movah,0int16h;从键盘读字符ah=扫描码al=字符码pushaxleadx,buffermovbuffer[bx],alincbxcmpah,48h;上jzup_1cmpah,50h;下jzdown_1cmpah,4bh;左jzleftcmpah,4dh;右jzrightcmpah,1ch;回车jzenter_1callfuc_keymovah,2movdl,alint21hpopaxcallmenu_showjmpj6down_1:jmpdownenter_1:jmpenter_2up_1:jmpupleft:;光标左移pos_getmovrow,dhmovdl,linecmpline,0jnzdirectmovline,79decrowcmprow,0jestop2jmpfirststop2:movrow,1jmpfirstdirect:declinecallwin4;显示光标位置jmpfirstright:;光标右移pos_getmovrow,dhmovdl,linecmpline,79jnzdirect2movline,0incrowcmprow,24jereturns1jmpfirstdirect2:inclinecallwin4jmpfirstenter_2:jmpenterup:;上移光标pos_getmovrow,dhmovdl,linedecrowcmprow,0jestop1callwin4jmpfirststop1:movrow,1jmpfirstdown:;下移光标pos_getmovrow,dhmovdl,lineincrowcmprow,24jestop3callwin4jmpfirststop3:movrow,23jmpfirstreturns1:jmpreturnsenter:;回车换行pos_getmovrow,dhmovline,dlincrowcmprow,24jereturnsmovline,0callwin4jmpfirstreturns:movrow,24movline,0jmpfirstj6:retcomendpfuc_keyprocnear;功能键子程序next:cmpah,47h;homejzhomecmpah,4fh;endjz_endcmpah,0eh;backspacejzbak_spcmpah,53hjzdelcmpah,44h;F10jzhelp_0rethelp_0:callhelphome:;HOME键的功能pos_getmovrow,dhmovline,0callwin4jmpfirst_end:;END键的功能pos_getmovrow,dhmovline,79callwin4jmpfirstbak_sp:;退格键的功能pos_getmovrow,dhmovline,dlcmpline,0jestopdeclinejmpabstop:movline,0ab:pos_get0,row,linemovah,2movdl,00int21hcallwin4jmpfirstdel:;DEL删除pos_getmovrow,dhmovline,dldeclinepos_get0,row,linemovah,2movdl,00int21hinclinecallwin4jmpfirstcm:cmpline,00jzpos_cmpos_cm:pos_curse0,0,0jmpfirsthelpprocnear;显示帮助信息callsavedisplay;显示帮助信息每行的位置pos_getpushdxwin0,57h,4,5,21,70pos_curse0,6,25stringhelp_mas1pos_curse0,8,11stringhelp_mas2pos_curse0,10,11stringhelp_mas3pos_curse0,12,11stringhelp_mas4pos_curse0,14,11stringhelp_mas5pos_curse0,16,11stringhelp_mas6pos_curse0,18,11stringhelp_mas7popdxpos_curse0,dh,dlmovah,0int16hcmpah,36h;F10activehelpjnzclscallhelpcls:win0,1eh,9,10,13,70;清屏callbackdisplayhelpendpfuc_keyendpmenu_showprocnear;显示菜单callsavedisplaypushcxcmpah,3bh;F1功能jzmenu_shjmpchar_getmenu_sh:;定义菜单的背景字体颜色pos_getpushdxwin0,06h,2,1,7,11win0,65h,1,0,6,10pos_curse0,1,0stringmanu_1stringmanu_2stringmanu_3stringmanu_4stringmanu_5popdxdecdlpos_curse0,dh,dlcopmar:red_chrcmpah,50hjzmanu_njmpmanu_hidmanu_hid:;菜单隐藏win0,1eh,1,1,7,11callbackdisplayjmpchar_getmanu_n:;开始定义各个菜单项win0,65h,5,1,5,8pos_curse0,5,0stringmanu_5win0,15h,1,1,1,8pos_curse0,1,0stringmanu_1red_chrcmpah,48hjemanu_ncmpal,0dhjznew_1cmpah,50hjemanu_ojmpmanu_hidmanu_n0:jmpmanu_nmanu_o:win0,65h,1,1,1,8pos_curse0,1,0stringmanu_1win0,15h,2,1,2,8pos_curse0,2,0stringmanu_2red_chrcmpah,48hjemanu_ocmpal,0dhjzopen_1cmpah,50hjemanu_sjmpmanu_hidnew_1:jmpnew_2manu_s:win0,65h,2,1,2,8pos_curse0,2,0stringmanu_2win0,15h,3,1,3,8pos_curse0,3,0stringmanu_3red_chrcmpal,0dhjzsave_1cmpah,48hjemanu_scmpah,50hjemanu_ajmpmanu_hidopen_1:jmpopen_2manu_n1:jmpmanu_nmanu_a:win0,65h,3,1,3,8pos_curse0,3,0stringmanu_3win0,15h,4,1,4,8pos_curse0,4,0stringmanu_4red_chrcmpah,1chjzsave_2cmpah,48hjemanu_acmpah,50hjemanu_ejmpmanu_hidmanu_n2:jmpmanu_n1new_2:jmpnewsave_1:callsavesave_2:callsaveasmanu_e:win0,65h,4,1,4,8pos_curse0,4,0stringmanu_4win0,15h,5,1,5,8pos_curse0,5,0stringmanu_5red_chrcmpah,50hjemanu_n2cmpah,48hjemanu_ecmpah,1chjeexitjmpmanu_hidexit:callbackdisplaywin0,07h,15,10,17,61win0,24h,14,9,16,60movdh,15movdl,9movbh,0movah,2int10hleadx,message4movah,9int21hmovah,1int21hcmpal,79hjnzqcallquittq:cmpal,6ehjzquitquit:win0,07h,0,0,24,79pos_curse0,0,0movah,4chint21hre
本文标题:汇编大作业文本编辑器实验报告
链接地址:https://www.777doc.com/doc-2279413 .html