简易文本编辑器 MC 兰州理工课设Word格式.docx
- 文档编号:18803117
- 上传时间:2023-01-01
- 格式:DOCX
- 页数:35
- 大小:112.59KB
简易文本编辑器 MC 兰州理工课设Word格式.docx
《简易文本编辑器 MC 兰州理工课设Word格式.docx》由会员分享,可在线阅读,更多相关《简易文本编辑器 MC 兰州理工课设Word格式.docx(35页珍藏版)》请在冰豆网上搜索。
2、设计思路
利用BIOS功能调用中的10H中断类型,调用06号功能,设置窗口背景;
调用DOS功能中的09号功能,实现显示菜单信息字符串;
3、详细设计
3.1程序设计图
图2.1文本编辑器流程图
3.2定义模块设计
该部分说明了程序所需要的模块,3.1定义模块设计
该部分说明了程序所需要的模块,如字符定义模块、输入字符串定义模块、建立窗口模块、光标定义模块等。
3.1.1字符宏定义模块
字符定义模块主要定义了字符的读取、
输入、从键盘读入等功能
red_chrmacro;
读取字符宏定义
movah,0
int16h;
中断调用从键盘读入字符
endm
movah,06h
moval,opr1
movbh,opr2
movch,opr3
movcl,opr4
movdh,opr5
movdl,opr6
int10h
endm
3.2.4光标位置宏定义模块
该模块通过调用2号功能,实现了对文本编辑器中光标的定义。
pos_cursemacroop1,op2,op3
;
定义光标位置
movah,2
movbh,op1
movdh,op2
movdl,op3
int10h
3.2.5显示光标宏定义
pos_getmacro
;
显示光标位置
movah,03h
movbh,0
int10h
;
状态栏显示
manu_2db'
Open'
13,10,'
$'
manu_3db'
Save'
manu_4db'
Saveas'
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'
//?
;
行//列
dataends
3.2.6数据段定义模块设计
datasegment;
定义数据段
menudb'
FileEditHelp$'
标题
mass_1b'
F1ActivefileF10Activehelp'
$
3.3代码段模块程序设计
3.3.1主程序设计模块
该设计模块主要通过调用子程序,创建了初始化界面,更有利于用户操作。
codesegment
mainprocfar;
主程序定义开始
assumecs:
code,ds:
data
start:
pushds
subax,ax
pushax
movax,data
movds,ax
callwind ;
用创建窗口子程序
calledit;
调用设置菜单子程序
ret
mainendp
3.3.2创建窗口子程序设计模块
该部分程序代码主要实现了创建窗口的功能。
在show处调用函数显示菜单等。
。
在弹出菜单后再判断是不是方向键或者ENTER键,跳到相应的地方并做出相应的处理。
windprocnear;
创建窗口子程序
win0,3eh,1,0,24,79;
定义窗口背景
win1,1fh,0,0,0,79;
定义菜单项背景
win0,1fh,24,0,24,79;
定义状态栏背景
show:
显示菜单位置及内容
pos_curse0,0,1;
movah,9
leadx,menu
int21h
show_2:
显示状态栏位置及内容
pos_curse0,24,1;
leadx,mass_1
int21h;
状态栏提示信息显示
callwin3;
调用设置时间子程序
callwin4;
调用设置行列子程序
pos_curse0,1,0;
置光标位置
movrow,dh
movline,dl;
保存行列
windendp
3.3.3菜单项模块设计
菜单项主要实现了菜单的选项功能,通过各个选项,调用相应的子程序,实现不同的功能。
保存文件,输入文件,显示时间等功能。
editprocnear
char_get:
读字符
callcom
comprocnear;
定义功能鍵
pos_get
movline,dl
first:
pos_curse0,row,line
j00:
movah,0
int16h;
从键盘读字符ah=扫描码
al=字符码
leadx,buffer
movbuffer[bx],al
incbx
cmpah,48h;
上
jzup_1
cmpah,50h;
下
jzdown_1
cmpah,4bh;
左
jzleft
cmpah,4dh;
右
jzright
cmpah,1ch;
回车
jzenter_1
callfuc_key
movdl,al
popax
callmenu_show
jmpj6
down_1:
jmpdown
enter_1:
jmpenter_2
up_1:
jmpup
left:
光标左移
movdl,line
cmpline,0
jnzdirect
movline,79
decrow
cmprow,0
jestop2
jmpfirst
stop2:
movrow,1
direct:
decline
callwin4;
jmpfirst
right:
光标右移
cmpline,79
jnzdirect2
movline,0
incrow
cmprow,24
jereturns1
direct2:
incline
callwin4
enter_2:
jmpenter
up:
上移光标
jestop1
stop1:
down:
下移光标
movdl,line
jestop3
stop3:
movrow,23
returns1:
jmpreturns
enter:
回车换行
jereturns
returns:
movrow,24
movline,0
j6:
comendp
fuc_keyprocnear;
功能键子程序
next:
cmpah,47h;
home
jzhome
cmpah,4fh;
end
jz_end
cmpah,0eh;
backspace
jzbak_sp
cmpah,53h
jzdel
cmpah,44h;
F10
jzhelp_0
help_0:
callhelp
home:
HOME键的功能
jmpfirst
_end:
END键的功能
pos_get
bak_sp:
退格键的功能
jestop
jmpab
stop:
movline,0
ab:
pos_get0,row,line
movdl,00
del:
;
DEL删除
cm:
cmpline,00
jzpos_cm
pos_cm:
pos_curse0,0,0
helpprocnear;
显示帮助信息
callsavedisplay;
显示帮助信息每
行的位置
pushdx
win0,57h,4,5,21,70
pos_curse0,6,25
stringhelp_mas1
pos_curse0,8,11
stringhelp_mas2
pos_curse0,10,11
stringhelp_mas3
pos_curse0,12,11
stringhelp_mas4
pos_curse0,14,11
stringhelp_mas5
pos_curse0,16,11
stringhelp_mas6
pos_curse0,18,11
stringhelp_mas7
popdx
pos_curse0,dh,dl
int16h
cmpah,36h;
F10activehelp
jnzcls
cls:
win0,1eh,9,10,13,70;
清屏
callbackdisplay
helpendp
fuc_keyendp
menu_showprocnear;
显示菜单
callsavedisplay
pushcx
cmpah,3bh;
F1功能
jzmenu_sh
jmpchar_get
menu_sh:
定义菜单的背景字体颜色
win0,06h,2,1,7,11
win0,65h,1,0,6,10
pos_curse0,1,0
stringmanu_1
stringmanu_2
stringmanu_3
stringmanu_4
stringmanu_5
decdl
copmar:
red_chr
cmpah,50h
jzmanu_n
jmpmanu_hid
manu_hid:
菜单隐藏
win0,1eh,1,1,7,11
manu_n:
;
开始定义各个菜单项
win0,65h,5,1,5,8
pos_curse0,5,0
win0,15h,1,1,1,8
red_chr
cmpah,48h
jemanu_n
cmpal,0dh
jznew_1
cmpah,50h
jemanu_o
manu_n0:
jmpmanu_n
manu_o:
win0,65h,1,1,1,8
win0,15h,2,1,2,8
pos_curse0,2,0
jzopen_1
jemanu_s
new_1:
jmpnew_2
manu_s:
win0,65h,2,1,2,8
win0,15h,3,1,3,8
pos_curse0,3,0
jzsave_1
jemanu_a
open_1:
jmpopen_2
manu_n1:
manu_a:
win0,65h,3,1,3,8
win0,15h,4,1,4,8
pos_curse0,4,0
stringmanu_4
cmpah,1ch
jzsave_2
jemanu_e
manu_n2:
jmpmanu_n1
new_2:
jmpnew
save_1:
callsave
save_2:
callsaveas
manu_e:
win0,65h,4,1,4,8
win0,15h,5,1,5,8
jemanu_n2
jeexit
exit:
win0,07h,15,10,17,61
win0,24h,14,9,16,60
movdh,15
movdl,9
movbh,0
leadx,message4
movah,9
movah,1
cmpal,79h
jnzq
callquitt
q:
cmpal,6eh
jzquit
quit:
win0,07h,0,0,24,79
movah,4ch
menu_showendp
newprocnear;
新建文件
win0,24h,14,9,16,60,
leadx,message1
movbx,0
all:
jealll
movpath[bx],al
jmpall
alll:
win0,3eh,15,9,17,61
leadx,path
movah,3ch
movcx,00
movhandle,ax
movbx,ax
movah,3eh
win0,3eh,1,0,23,79
movdh,1
movdl,0
newendp
open_2:
jmpopen
saveasprocnear
另存为文件win0,3eh,1,0,6,10
leadx,message2
bll:
jeblll
jmpbll
blll:
movbx,handle
movcx,2000
movah,40h
callbackdisplay
saveasendp
openprocnear;
打开文件
c
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 简易文本编辑器 MC 兰州理工课设 简易 文本 编辑器 兰州 理工