学生成绩管理系统设计实验汇编语言

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

实验六学生成绩管理系统设计实验一、实验目的1、熟悉汇编语言程序结构;2、熟悉INT21H的文件操作功能调用;3、熟悉INT21H的1、9号功能和INT10H常用功能的使用方法;4、掌握多子程序复杂问题程序设计方法;5、掌握利用汇编语言实现字符串的输入输出程序设计方法;6、了解多模块程序设计方法。二、实验原理我们把可以多次调用、具有通用性、能完成特定功能的程序段编写成的独立程序模块称为子程序。子程序是把一个程序划分成若干模块所用的主要手段,它便于独立设计、测试程序和编制程序文件。三、实验内容1、实验要求设计一个学生成绩管理系统,要求完成文件建立、学生成绩录入、显示指定学号的学生记录、删除一个学生的记录、修改学生记录、返回等工作。学生成绩包括学号(XH)、姓名(XM)、数学(SX)、语文(YW)、外语(WY)字段。至少包括30名学生信息,每名学生学号字段为4个字符,姓名字段为15个字符(最大),每门成绩字段为3个字符(最大)。程序设计步骤如下:1、编写主程序main.asm;2、编写文件创建子程序create,实现在指定盘指定文件夹“d:\chengji\2009\”下建立一个指定名称的文件2009doc.dat;3、编写成绩录入子程序append,实现在指定文件尾部插入一个学生的成绩记录;4、编写显示子程序display,实现按指定学号显示一个学生的记录;5、编写修改子程序modify,实现按指定学号修改一个学生的记录字段(不需修改直接回车);6、编写删除子程序,实现按指定学号、姓名删除一个学生的记录;7、编译、链接、调试,产生可执行文件main.exe。2、程序流程图3、程序代码程序代码如下:DATASSEGMENTMSG1DB'1.Appendarecord$'MSG2DB'2.Displayarecord$'MSG3DB'3.Modifyarecord$'MSG4DB'4.Deletearecord$'MSG5DB'5.Createfile$'MSG6DB'6.ReturnDOS$'MSGCDB'Pleaseinput1--6:$'MSGEDB'Error!$'MSGC1DB'Pleaseinputfilename:$'MAXLENDB25ACTLENDB?STRINGDB25DUP(?)MAXLEN1DB25ACTLEN1DB?STRING1DB25DUP(?)PATHNMDB'D:\chengji\2009\\',23DUP(?)PATHDB'D:\chengji\2009\2009doc.dat',00MSGA1DB'PleaseinputXH:$'MSGA2DB'PleaseinputXM:$'MSGA3DB'PleaseinputSX:$'MSGA4DB'PleaseinputYW:$'MSGA5DB'PleaseinputWY:$'HANDLEDW?MSGXHDB'Xuehao:$'MSGXMDB'Xingming:$'MSGSXDB'Shuxue:$'MSGYWDB'Yuwen:$'MSGWYDB'Waiyu:$'BUFFERDB2048DUP('')MSGRTDB'Pressanykeytoreturn!$'DELSTRDB33DUP('')DATASENDSSTACKSSEGMENTSTACKDB256DUP(?)STACKSENDSCODESSEGMENTASSUMECS:CODES,DS:DATAS,SS:STACKSSTART:MOVAX,DATASMOVDS,AX;********************************;主程序MAINPROCFARS:;清屏CALLCLS;逐行输出提示信息MOVAH,02HMOVDH,9MOVDL,30INT10HMOVAH,9LEADX,MSG1INT21HMOVAH,02HMOVDH,10MOVDL,30INT10HMOVAH,9LEADX,MSG2INT21HMOVAH,02HMOVDH,11MOVDL,30INT10HMOVAH,9LEADX,MSG3INT21HMOVAH,02HMOVDH,12MOVDL,30INT10HMOVAH,9LEADX,MSG4INT21HMOVAH,02HMOVDH,13MOVDL,30INT10HMOVAH,9LEADX,MSG5INT21HMOVAH,02HMOVDH,14MOVDL,30INT10HMOVAH,9LEADX,MSG6INT21H;提示输入MOVAH,02HMOVDH,15MOVDL,30INT10HMOVAH,9LEADX,MSGCINT21H;从键盘读入一个数字MOVAH,02HMOVDH,15MOVDL,48INT10HMOVAH,1INT21H;按数字对应子程序CMPAL,31HJZCAPPENDCMPAL,32HJZCDISPLAYCMPAL,33HJZCMODIFYCMPAL,34HJZCDELETECMPAL,35HJZCCREATECMPAL,36HJZE;若输入不是1-6数字,则提示错误MOVAH,02HMOVDH,16MOVDL,30INT10HMOVAH,9LEADX,MSGEINT21HCCREATE:CALLCREATEJMPSCDELETE:CALLDELETEJMPSCMODIFY:CALLMODIFYJMPSCDISPLAY:CALLDISPLAYJMPSCAPPEND:CALLAPPENDJMPSE:MOVAH,4CHINT21HMAINENDP;********************************;CREATE程序CREATEPROCNEARPUSHAXPUSHCXPUSHDXPUSHSIPUSHDI;清屏CALLCLS;提示输入文件名MOVAH,2MOVDH,12MOVDL,20INT10HMOVAH,9LEADX,MSGC1INT21H;从键盘读入文件名字符串MOVAH,0AHLEADX,MAXLENINT21H;将文件名字符串加到ASCIZ字符串末尾MOVCX,0MOVCL,ACTLENLEASI,STRINGLEADI,PATHNMADDDI,16LCREATE:MOVAL,BYTEPTR[SI]MOV[DI],ALINCDIINCSILOOPLCREATE;在ASCIZ字符串末尾加00MOVBYTEPTR[DI],0;按ASCIZ字符串创建文件MOVAH,3CHLEADX,PATHNMMOVCX,0INT21HPOPDIPOPSIPOPDXPOPCXPOPAXRETCREATEENDP;********************************;APPEND程序APPENDPROCNEARPUSHAXPUSHBXPUSHCXPUSHDXPUSHSIPUSHDI;清屏CALLCLS;打开文件(只写)MOVAH,3DHMOVAL,01HLEADX,PATHINT21HMOVHANDLE,AX;提示输入学号MOVAH,02HMOVDH,10MOVDL,30INT10HMOVAH,9LEADX,MSGA1INT21H;从键盘读入字符串MOVAH,0AHLEADX,MAXLENINT21H;在字符串末尾补足空格MOVDX,4CALLFILL;将文件指针定位至文件末尾MOVAH,42HMOVAL,2MOVBX,HANDLEMOVCX,0MOVDX,0INT21H;写入文件MOVAH,40HMOVBX,HANDLEMOVCX,0MOVCL,ACTLENLEADX,STRINGINT21H;提示输入姓名MOVAH,02HMOVDH,11MOVDL,30INT10HMOVAH,9LEADX,MSGA2INT21H;从键盘读入字符串MOVAH,0AHLEADX,MAXLENINT21H;在字符串末尾补足空格MOVDX,15CALLFILL;将文件指针定位至文件末尾MOVAH,42HMOVAL,2MOVBX,HANDLEMOVCX,0MOVDX,0INT21H;写入文件MOVAH,40HMOVBX,HANDLEMOVCX,0MOVCL,ACTLENLEADX,STRINGINT21H;提示输入语文成绩MOVAH,02HMOVDH,12MOVDL,30INT10HMOVAH,9LEADX,MSGA3INT21H;从键盘读入字符串MOVAH,0AHLEADX,MAXLENINT21H;在字符串末尾补足空格MOVDX,3CALLFILL;将文件指针定位至文件末尾MOVAH,42HMOVAL,2MOVBX,HANDLEMOVCX,0MOVDX,0INT21H;写入文件MOVAH,40HMOVBX,HANDLEMOVCX,0MOVCL,ACTLENLEADX,STRINGINT21H;提示输入数学成绩MOVAH,02HMOVDH,13MOVDL,30INT10HMOVAH,9LEADX,MSGA4INT21H;从键盘读入字符串MOVAH,0AHLEADX,MAXLENINT21H;在字符串末尾补足空格MOVDX,3CALLFILL;将文件指针定位至文件末尾MOVAH,42HMOVAL,2MOVBX,HANDLEMOVCX,0MOVDX,0INT21H;写入文件MOVAH,40HMOVBX,HANDLEMOVCX,0MOVCL,ACTLENLEADX,STRINGINT21H;提示输入外语成绩MOVAH,02HMOVDH,14MOVDL,30INT10HMOVAH,9LEADX,MSGA5INT21H;从键盘读入字符串MOVAH,0AHLEADX,MAXLENINT21H;在字符串末尾补足空格MOVDX,3CALLFILL;在字符串末尾加回车、换行INCSIMOVBYTEPTR[BX+SI],0DHINCSIMOVBYTEPTR[BX+SI],0AHADDACTLEN,2;将文件指针定位至文件末尾MOVAH,42HMOVAL,2MOVBX,HANDLEMOVCX,0MOVDX,0INT21H;写入文件MOVAH,40HMOVBX,HANDLEMOVCX,0MOVCL,ACTLENLEADX,STRINGINT21H;关闭文件MOVAH,3EHMOVBX,HANDLEINT21HPOPDIPOPSIPOPDXPOPCXPOPBXPOPAXRETAPPENDENDP;********************************DISPLAYPROCNEARPUSHAXPUSHDX;清屏CALLCLS;提示输入学号MOVAH,02HMOVDH,10MOVDL,28INT10HMOVAH,9LEADX,MSGXHINT21H;从键盘读入学号字符串MOVAH,0AHLEADX,MAXLENINT21H;打开文件(只读)MOVAH,3DHMOVAL,00HLEADX,PATHINT21HMOVHANDLE,AX;将文件指针定位至文件开头MOVAH,42HMOVAL,0MOVBX,HANDLEMOVCX,0MOVDX,0INT21H;将文件载入缓存MOVAH,3FHMOVBX,HANDLEMOVCX,2048LEADX,BUFFERINT21H;在缓存中找到对应记录LEASI,BUFFERLEADI,STRINGMOVCX,AXCALLSEARCHCMPDX,0JZOUTPUT;若未找到,则提示错误MOVAH,9LEADX,MSGEINT21HJMPDEND;显示对应信息OUTPUT:MOVAH,02HMOVDH,11MOVDL,28INT10HMOVAH,9LEADX,MSGXMINT21HADDSI,5MOVAH,9MOVDX,SIINT21HMOVAH,02HMOVDH,12MOVDL,28INT10HMOVAH,9LEADX,MSGYWINT21HADDSI,16MOVAH,9MOVDX,SIINT21HMOVAH,02HMOVDH,13MOVDL,28INT10HMOVAH,9LEADX,MSGSXINT21HADDSI,4MOVAH,9MOVDX

1 / 16
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功