




已阅读5页,还剩16页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
汇编语言课程实习报告实习题目 班级通信录管理系统的设计与实现学生姓名 班级(学号) 院系 信息学院计算机系指导老师 叶晓霞提交时间 班级通信录管理系统的设计与实现1.需求说明: 建立一个班级通信录,可以实现添加、删除、修改、查询一个同学的通信记录;显示所有同学的通信记录;能根据姓名或宿舍号进行排序。通信录包括学号、姓名、电话号码、宿舍号等信息,所有信息最终用文件保存。2.设计说明:以参数形式建立个人的文件,如:你名字为cac,则调用tongxun.exe文件时,以cac为参数,你应输入c: tongxun cac,这样就建立了一个cac的文件记录你收藏的通信资料。将段前缀的说明部分单独作为一段,并将ds固定指向该段;其他数据单元(提示信息等)另设一段,以es固定指向该段,在引用该段变量时加上es段前缀即可。3.详细的算法描述: 3.1 程序界面 如上图,0-8八个选项分别实现不同的功能。依次是增加、删除、修改、查询、显示全部信息、生成、按名排列、按寝室排序、退出。3.2 程序思想 在这个实验中,主要的就是子程序的应用这方面,其中修改,删除的子程序都以查找核心算法为基础。这方面的铺垫工作做好后再做好每一块的工作,最后检查下,程序就能完好的运行了。4.源程序与执行结果: 4.1.主要程序代码: dataseg segmenttitlestrdbstudent no. name phone dormitory ,0dh,0ah,$titlelen equ $ - titlestritemrowdbtitlelen dup ( ),0dh,0ah,$handledw?showindb0memptrdw?searchnumberdb20dup( )searchstrdb30dup( )searchphonedb20dup( )searchdormdb20dup( )searchndb0exactmatchdb0inputbufdb34actlendb?inputstrdb34dup( )infomsg1dbinfo: give your command below ,0dh,0ah,$ infomsg2dbwarning: unrecognized command,type again ,0dh,0ah,$ infomsg3dbinfo: input your name below ,0dh,0ah,$ infomsg4dbinfo: input your phone number below ,0dh,0ah,$ infomsg5dbinfo: input the number of item below ,0dh,0ah,$ infomsg6dbinfo: input your student no. below ,0dh,0ah,$ infomsg7dbinfo: input your dormitory number below ,0dh,0ah,$ msgemptydb,0dh,0ah,$ msg0 db=,0dh,0ah db| |,0dh,0ah db| welcome to use address list 0.1 alpha |,0dh,0ah db| |,0dh,0ah db=,0dh,0ah,$msgmenu db0dh,0ah db-,0dh,0ah dbplease choose an operation:(0-8),0dh,0ah db1- add 2- delete 3- modify,0dh,0ah db4- query 5- list 6- create,0dh,0ah db7- sort(name) 8- sort(dorm) 0- exit ,0dh,0ah db-,0dh,0ah,$ msgblank db ,$ pathname dbaddress.txt,0 msg1 db cannot find address.txt ,0dh,0ah,$ msg2 db program will create the file address.txt ,0dh,0ah,$ msg4 db open file successfully ,0dh,0ah,$ msg5 db create file fail ,0dh,0ah,$ msg6 db program terminate ,0dh,0ah,$ msg7 db create file successfully ,0dh,0ah,$ msg8 db read file failed,exit ,0dh,0ah,$ msg9 db write file failed,exit ,0dh,0ah,$ msgfind db the item you found is: ,0dh,0ah,$ msgferr db cannot find the item ,0dh,0ah,$ msgferr2 db check your input! ,0dh,0ah,$msglen equ$ - msgferr2;file buffer recordsizeequ20+30+20+20 filebufdb0 itemlistdb10 dup(20 dup(0),30 dup(0),20 dup(0),20 dup(0)dataseg endscodeseg segmentassume cs:codeseg,ds:dataseg,es:dataseg,ss:datasegmainprocfarpush dsxor ax,axpush axmov ax,datasegmov ds,axmov es,axlea dx,msg0call showmsgcall findfilecall getcommandretmainendpshowmsgprocnearmov ah,9int 21hretshowmsgendpgetcommandprocneargcinput:lea dx,msgmenumov ah,9int 21hmov ah,7 ; get inputint 21hgetcom:cmp al,1jne gc2call additemjmp gcinputgc2:cmp al,2jne gc3call delitemjmp gcinputgc3:cmp al,3jne gc4call edititemjmp gcinputgc4:cmp al,4jne gc5call queryitemjmp gcinputgc5:cmp al,5jne gc6call listitemsjmp gcinputgc6:cmp al,6jne gc7call createfilejmp gcinputgc7:cmp al,7jne gc8call sortnamejmp gcinputgc8:cmp al,8jne gc9call sortdormjmp gcinputgc9:cmp al,0jne gc10call closefileretgc10:jmp gcinputgcexit:retgetcommandendpadditem proc nearcall getnumbercall getnamecall getphonecall getdormlea di,filebuf ;content starts here inc di mov al,filebuf mov bl,recordsize mul bl add di,ax addstr: lea si,searchnumber mov cx,20 cld rep movsb lea si,searchstr mov cx,30 cld rep movsb mov cx,20 lea si,searchphone cld rep movsb lea si,searchdorm mov cx,20 cld rep movsb inc filebufretadditem endpgetnumber proc near lea dx,infomsg6 mov ah,9 int 21hgetno: mov ah,0ah lea dx,inputbuf int 21h cmp actlen,0 jbe getno cmp actlen,20 jbe getnonext mov actlen,20getnonext: mov cl,actlen mov ch,0 lea si,inputstr lea di,searchnumber cld rep movsb retgetnumber endpgetname proc nearlea dx,infomsg3 mov ah,9 int 21hgetn: mov ah,0ah lea dx,inputbuf int 21h cmp actlen,0 jbe getn cmp actlen,20 jbe getnnext mov actlen,20getnnext: mov cl,actlen mov ch,0 lea si,inputstr lea di,searchstr cld rep movsb retgetname endpgetphone proc near lea dx,infomsg4 mov ah,9 int 21hgetp: mov ah,0ah lea dx,inputbuf int 21h cmp actlen,0 jbe getp cmp actlen,20 jbe getpnext mov actlen,20getpnext: mov cl,actlen mov ch,0 lea si,inputstr lea di,searchphone cld rep movsb retgetphone endpgetdorm proc nearlea dx,infomsg7 mov ah,9 int 21hgetd: mov ah,0ah lea dx,inputbuf int 21h cmp actlen,0 jbe getd cmp actlen,20 jbe getdnext mov actlen,20getdnext: mov cl,actlen mov ch,0 lea si,inputstr lea di,searchdorm cld rep movsb retgetdorm endpsearchprocnearmov exactmatch,0lea si,filebufmov al,siinc simov di,sisub di,recordsizepush disealoop:pop di ; cuz cmpsb chaned it, so restoreadd di,recordsizelea si,searchnumberpush didec almov cx,20cldrepe cmpsbjne seanextmov exactmatch,1sub di,20mov memptr,dijmp searetseanext:cmp al,0jne sealoopsearet:retsearchendpdelitem proc nearcall getnumbercall searchcmp exactmatch,1jne delretmov bl,filebufmov si,memptrdelloop:mov di,siadd si,recordsizecldrep movsbdec bljnz delloopdec filebufdelret:retdelitem endpedititem proc nearcall getnumbercall searchcmp exactmatch,1jne editretcall getnamecall getphonecall getdormmov di,memptr editstr: lea si,searchnumber mov cx,20 cld rep movsb lea si,searchstr mov cx,30 cld rep movsb mov cx,20 lea si,searchphone cld rep movsb lea si,searchdorm mov cx,20 cld rep movsb editret:retedititem endpqueryitem proc nearcall getnumbercall searchcmp exactmatch,1jne queryretmov si,memptrlea di,itemrowmov cx,16rep movsbadd si,4mov cx,16rep movsbadd si,14mov cx,16rep movsbadd si,4mov cx,16rep movsbmov ah,9lea dx,itemrowint 21hqueryret:retqueryitem endplistitems proc nearlea dx,titlestrcall showmsglea si,filebufcmp filebuf,0je listemptymov bl,filebufinc sisub si,recordsizelistloop:add si,recordsizelea di,itemrowmov cx,16rep movsbadd si,4mov cx,16rep movsbadd si,14mov cx,16rep movsbadd si,4mov cx,16rep movsbmov ah,9lea dx,itemrowint 21hdec blcmp bl,0jne listloopretlistempty:lea dx,msgemptymov ah,9int 21hretlistitems endpcreatefile proc nearmov ah,3chmov cx,0lea dx,pathnameint 21hlea dx,msg7call showmsgretcreatefile endpsortname proc nearretsortname endpsortdorm proc nearretsortdorm endpreadfile proc nearmov ah,3fhmov bx,handlemov cx,1+recordsize*10lea dx,filebufint 21hsub filebuf,30hretreadfile endpclosefile proc nearmov ah,42hmov al,0mov bx,handlemov cx,0mov dx,0int 21hlea dx,filebufmov bx,handlemov cx,1+10*recordsizemov ah,40hint 21hmov ah,3ehint 21hcall exitproretclosefile endpfindfile proc near;find file ,exist open not exist ,creat mov ah,3dh mov al,2 lea dx,pathname int 21h jc fif ;jump when file not exist mov handle,ax call readfile lea dx,msg4 call showmsg ret fif: lea dx,msg1 call showmsg lea dx,msg2 call showmsg mov ah,3ch mov al,0 mov cx,0 lea dx,pathname int 21h jc ffwrong mov handle,ax lea dx,msg7 ;create file call showmsg call fillitem ret ffwrong: lea dx,msg5 call showmsg lea dx,msg6 call showmsg call exitpro ;exit when creat failedfindfile endpfillitem proc nea
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 工业废水处理实验设计与效果评估
- 工业机器人技术在教学与培训中的应用
- 工业控制系统数据安全防护
- 工业污染控制与绿色生产模式
- 工业机器人产品技术介绍与市场前景
- 工业污染防治的科技创新方案
- 工业节能与绿色制造技术探讨
- 工业设计中的创新技术与设计理念研究
- 工业设计与智能产品开发策略探讨
- 工业遗存建筑的再生利用研究
- 消化道穿孔患者的护理课件
- 作物栽培学智慧树知到期末考试答案章节答案2024年中国农业大学
- 汽车修理厂应急预案汽修厂安全生产事故应急救援综合预案2019-2020新标准完整版实施文件
- 建筑智能化系统工程挂靠协议
- 司法鉴定的奥秘智慧树知到期末考试答案2024年
- 2024春期国开电大专本科《教育学》在线形考 (形考论坛4)试题及答案
- MOOC 高速铁路运营与维护-西南交通大学 中国大学慕课答案
- 11-轮藻植物门课件
- (2024年)健康评估教学教案心电图检查教案
- 方法模型:展开图、还原立体图形
- 2023年广东省中考生物试卷(含答案)
评论
0/150
提交评论