资源描述:
《汇编--简单文本编辑器的设计与实现.doc》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、题目:简单文本编辑器的设计与实现可以在出现的界面中输入任意文本内容,利用DEL键、BACKSPACE键、HOME键、END键、上下左右光标键对文本进行全屏幕编辑。按f1键激活菜单FILE,下移光标,选择New、Open、Save、Exit子菜单项实现文件的新建、打开、保存和退出功能。按F10激活帮助,按Esc键退出帮助。代码:red_chrmacro;读取字符宏定义movah,0int16hendmstringmacrop1;输入字符光标movah,9leadx,p1int21hendmwinmacroopr1,opr2,opr3,opr4,opr5,opr6;建立窗口movah,0
2、6hmoval,opr1movbh,opr2movch,opr3movcl,opr4movdh,opr5movdl,opr6int10hendmpos_cursemacroop1,op2,op3;定义光标位置movah,2movbh,op1movdh,op2movdl,op3int10hendmpos_getmacro;显示光标位置movah,03hmovbh,0int10hendmdatasegment;定义数据段menudb'FileEditHelp$'mass_1db'F1ActivatefileF10Activatehelp','$'manu_1db'New',13,10,'
3、$'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'***Thefileisnotsaved!Saveitnow?(Y/N)***:','$'pathdb50dup(0),'$'bu
4、fferdb2000dup(?)bakdb3850dup(0)linedb?rowdb?chardb?help_mas1db'welcometouseeditor!$';帮助内容help_mas2db'Thisisthefirstactivehelp!$'help_mas3db'goodluck!$'help_mas4db'==========================================================$'help_mas5db'PressF1toactivateFile.$'help_mas6db'YoucanuseDOWNkeytochoose
5、theMenuItem$'help_mas7db'PressF10toshowthehelpmassage.PressEsctoQuit$'datedb'today??/??/','$' ;调用日期hangliedb'???//???','$' ;行//列dataendscodesegmentmainprocfar;主程序assumecs:code,ds:datastart:pushdssubax,axpushaxmovax,datamovds,axcallwindcalleditretmainendpwindprocnear;创建窗口子程序win0,3eh,1
6、,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,dlf
7、irst: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,alint21hpopaxca