学生成绩管理系统-汇编语言(共19页).docx

上传人:飞****2 文档编号:17085631 上传时间:2022-05-21 格式:DOCX 页数:19 大小:23.63KB
返回 下载 相关 举报
学生成绩管理系统-汇编语言(共19页).docx_第1页
第1页 / 共19页
学生成绩管理系统-汇编语言(共19页).docx_第2页
第2页 / 共19页
点击查看更多>>
资源描述

《学生成绩管理系统-汇编语言(共19页).docx》由会员分享,可在线阅读,更多相关《学生成绩管理系统-汇编语言(共19页).docx(19页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。

1、精选优质文档-倾情为你奉上;=学生成绩管理系统=;*;EQU STATEMENTS GO HEREStructNodeequ32 ;表达式赋值微操作equ page133Node_nameequ0;类似defineNode_numequ12Node_mathsequ18Node_englishequ20Node_chineseequ22Node_othersequ24Node_totalequ26Node_avgequ28Node_nextequ30max_recordequ100max_menu_indexequ9;*;*data_seg segment;define data segmen

2、t;DATA GOES HEREbuf1DB30buf1_slenDB?buf1_dataDB30 dup(?)bufnameDB20bufname_slenDB?bufname_dataDB20 dup(?)bufgetintDB32bufgetint_slenDB?bufgetint_dataDB32 dup(?)str_menuDB0dH, 0aH, =Student marks system=, 0dH, 0aH, 0dH, 0aHDB1)Add Record, 0dH, 0aH, 0dH, 0aHDB2)Print All, 0dH, 0aH, 0dH, 0aHDB3)Save, 0

3、dH, 0aH, 0dH, 0aHDB4)Open, 0dH, 0aH, 0dH, 0aH, 0dH, 0aHDB5)Find, 0dH, 0aH, 0dH, 0aH, 0dH, 0aHDB6)Delete, 0dH, 0aH, 0dH, 0aH, 0dH, 0aHDB0)Exit, 0dH, 0aHDBChoice:$;Error Stringsstr_error_1DBError input!, 0dH, 0aH, $jump_tbDWcase_0DWcase_1DWcase_2DWcase_3DWcase_4DWcase_5DWcase_6headDW?;表头指针info_0dbinpu

4、t num:, $info_1dbinput math:, $info_2dbinput english:, $info_3dbinput chinese:, $ info_4dbinput others:, $info_5dbinput name:, $str_tb_headdbNum, 9,Name, 9, Maths, 9, English, 9, Chinese, 9,Others, 9, Total, 9, Avg, 0dH, 0aHdb=, 0dH, 0aH,$str_tabdb9, $rdatadb(StructNode * (max_record+1) dup(?);全部结点*

5、(100+1)rdata_pdwrdata;下一个可用结点rcountdw00H;当前已分配的结点数newnodedw?pnodedw?file_namedbc:student.txt, 00Hfile_error1dbFailed create file., 0DH, 0AH, $file_error2dbFailed write file., 0DH, 0AH, $file_error3dbFailed open the file., 0DH, 0AH, $file_error4dbFailed read file., 0DH, 0AH, $file_info_1dbsaving the

6、file., 0DH, 0AH, $file_info_2dbWrite to file successfully!, 0DH, 0AH, $file_info_3dbopening the file., 0DH, 0AH, $file_info_4dbread the file successfully!, 0DH, 0AH, $fp1dw?;文件指针data_seg ends;*;*extdata_seg segment;define extra data segment;EXTRA DATA GOES HEREextdata_seg ends;*;*stack_seg segment s

7、tack;define extra data segment;STACK DATA GOES HEREDB100H dup(?)stack_seg ends;*;*program segment;define code segment;*main proc far;main part of programassume cs:program, ds:data_seg, es:extdata_seg, ss:stack_segstart:;set up stack for returnpush dssub ax, axpush ax;set DS register to current data

8、segmentmov ax, data_seg;data_seg segment addrmov ds, ax;into DS registermov ax, extdata_seg;extdata_seg segment addrmov es, ax;into ES registermov ax, stack_seg;stack_seg segment addrmov ss, ax;into SS register;MAIN PART OF PROGRAM GOES HERE;分配链表头结点mov ax, rdata_pmov head, ax;当前头指针就是rdata_padd rdata

9、_p, StructNodemov bx, headmov word ptr bx+Node_next, 00Hlb_print_menu:;打印菜单lea dx, str_menumov ah, 09Hint 21Hcall far ptr getintcmp dx, max_menu_indexja lb_print_menumov di, dxshl di, 1jmp jump_tbdijmp lb_print_menucase_0:;Exitretcase_1:;添加记录call far ptr addrecordjmp lb_print_menucase_2:;打印所有记录call

10、far ptr print_recordjmp lb_print_menucase_3:;保存到文件call far ptr save_recordjmp lb_print_menucase_4:;从文件中读取call far ptr read_recordjmp lb_print_menucase_5:;查找call far ptr find_recordjmp lb_print_menucase_6:;删除call far ptr delete_recordjmp lb_print_menuret;return to DOSmain endp;end of main part of pro

11、gram;*;*sub1 proc near;define subprocedurepush axpush bxpush cxpush dx;main port of sub procedure;exit sub procedurepop dxpop cxpop bxpop axretsub1 endp;end of subprocedure;*;*;print CRLFcrlf proc farpush dxpush axmov dl, 0dHmov ah, 02Hint 21Hmov dl, 0aHmov ah, 02Hint 21hpop axpop dxretcrlf endp;*;*

12、;从键盘输入一个整数,结果保存到dx中getint proc far;define subprocedurepush axpush bxpush cx;main port of sub proceduremov dx, offset bufgetint;offset 偏移地址mov ah, 0aHint 21Hcall far ptr crlfmov ax, offset bufgetint_datapush ax;字符串首地址mov al, bufgetint_slencbw;字节转字push ax;字符串长度push ax;返回值call far ptr decibinpop dxpop

13、axpop ax;exit sub procedurepop cxpop bxpop axretgetint endp;end of subprocedure;*;*;把以十制进数形式存储在字符串中的数转成整数;栈中的参数:;0字符串首地址;1字符串长度;2存放结果decibin_para_lenequ3decibin_str1equword ptrbp+4+(decibin_para_len-0)*2decibin_str1lenequword ptrbp+4+(decibin_para_len-1)*2decibin_retsultequword ptrbp+4+(decibin_para

14、_len-2)*2decibin proc far;save registerspush bpmov bp, sppush axpush bxpush cxpush dxpush sipush dimov bx, 00Hmov cx, decibin_str1lenmov di, decibin_str1decibin_loop1:mov al, byte ptr di ; di为偏移量以字节为单位 把地址送入al and al, 0fHcbwxchg bx, axmov si, 10mul siadd bx, axinc diloop decibin_loop1mov decibin_ret

15、sult, bxexit_decibin:;恢复寄存器pop dipop sipop dxpop cxpop bxpop axpop bpretdecibin endp;*;*;把bx中的数以十进制形式输出;输入:数据存放在bx中binidec proc farpush axpush bxpush cxpush dxpush simov si, 01Hmov cx,10000d;各位依次输出call dec_divmov cx,1000dcall dec_divmov cx,100dcall dec_divmov cx,10dcall dec_divmov cx,1dmov si, 00Hca

16、ll dec_divpop sipop dxpop cxpop bxpop axretbinidec endpdec_div proc nearmov ax,bxmov dx,0div cxmov bx,dx;保留余数mov dl,al;商送入dlcmp si, 00H;输出这一位je lb1_dec_divcmp dl, 00H;处理完毕je exit_dec_divmov si, 00Hlb1_dec_div:add dl,30hmov ah, 02Hint 21Hexit_dec_div:retdec_div endp ;*;*addrecord proc far;define subp

17、rocedurepush axpush bxpush cxpush dxpush sipush dipush es;main port of sub proceduremov ax, rdata_p;当前指针移入axmov newnode, ax;再移入newnode存储单元中add rdata_p, StructNode;相当于指针加一add rcount, 1;计数器加一mov bx, ax;当前指针(newnode所指)移入bxmov cx, 00H ;计算总分mov word ptr bx+Node_next, 00H;Node_next置lea dx, info_0mov ah, 0

18、9Hint 21Hcall far ptr getintcall crlfmov word ptr bx+Node_num, dxlea dx, info_1mov ah, 09Hint 21Hcall far ptr getintcall crlfadd cx, dxmov word ptr bx+Node_maths, dxlea dx, info_2mov ah, 09Hint 21Hcall far ptr getintcall crlfadd cx, dxmov word ptr bx+Node_english, dxlea dx, info_3mov ah, 09Hint 21Hc

19、all far ptr getintcall crlfadd cx, dxmov word ptr bx+Node_chinese, dxlea dx, info_4mov ah, 09Hint 21Hcall far ptr getintcall crlfadd cx, dxmov word ptr bx+Node_others, dxmov word ptr bx+Node_total, cx;计算平均成绩mov ax, cxcwdmov cx, 4div cxmov word ptr bx+Node_avg, axlea dx, info_5mov ah, 09Hint 21H;输入姓名

20、lea dx, bufnamemov ah, 0aHint 21Hcall far ptr crlfmov ax, dsmov es, axmov al, bufname_slencbwmov bx, axmov byte ptr bufname_databx, $lea si, bufname_datamov di, newnodemov cx, bxinc cxcldrep movsb;add the new node to the listmov di, newnode;newnode现在存放的是当前项的地址mov si, head;head存放的是头指针mov ax, word ptr

21、 si+Node_nextmov word ptr di+Node_next, ax;当前加入项指向上次项(head指向的送当前项指针Node_next)mov word ptr si+Node_next, di;头指针指向当前加入项(当前项的地址送head);exit sub procedurepop espop dipop sipop dxpop cxpop bxpop axretaddrecord endp;end of subprocedure;*;*print_record proc far;define subprocedurepush axpush bxpush cxpush d

22、xpush sipush di;main port of sub procedurelea dx, str_tb_headmov ah, 09Hint 21Hmov ax, headmov pnode, axloop1_print_record:mov si, pnodemov ax, si+Node_nextmov pnode, axcmp ax, 00Hje exit_print_record1mov si, pnode;打印学号mov bx, si+Node_numcall far ptr binidec;打印制表符lea dx, str_tabmov ah, 09Hint 21H ex

23、it_print_record1: cmp ax,00hje exit_print_record ;非要分次跳跃;打印名字mov dx, simov ah, 09Hint 21H;打印制表符lea dx, str_tabmov ah, 09Hint 21H;数学成绩mov bx, si+Node_mathscall far ptr binidec;打印制表符lea dx, str_tabmov ah, 09Hint 21H;英语成绩mov bx, si+Node_englishcall far ptr binidec;打印制表符lea dx, str_tabmov ah, 09Hint 21H

24、;语文成绩mov bx, si+Node_chinesecall far ptr binidec;打印制表符lea dx, str_tabmov ah, 09Hint 21H;语文成绩mov bx, si+Node_otherscall far ptr binidecloop1_print_record1:cmp ax,0000hje loop1_print_record;打印制表符lea dx, str_tabmov ah, 09Hint 21H;总成绩mov bx, si+Node_totalcall far ptr binidec;打印制表符lea dx, str_tabmov ah,

25、09Hint 21H;平均成绩mov bx, si+Node_avgcall far ptr binideccall far ptr crlfmov ax,0000hjmp loop1_print_record1exit_print_record:;exit sub procedurepop dipop sipop dxpop cxpop bxpop axretprint_record endp;end of subprocedure;*;*save_record proc far;define subprocedurepush axpush bxpush cxpush dxpush sipu

26、sh di;main port of sub procedure;Create filelea dx, file_namemov cx, 00Hmov ah, 3cHint 21Hjc save_record_error1mov fp1, ax;write record countmov ah, 40Hmov bx, fp1mov cx, 02Hlea dx, rcountint 21Hjc save_record_error2lea dx, file_info_1mov ah, 09Hint 21Hmov ax, headmov pnode, axloop1_save_record:mov

27、si, pnodemov ax, si+Node_nextmov pnode, axcmp ax, 00Hje save_record_ok;write current node to the filemov ah, 40Hmov bx, fp1mov cx, StructNodemov dx, pnodeint 21Hjc save_record_error2jmp loop1_save_recordsave_record_ok:lea dx, file_info_2mov ah, 09Hint 21Hjmp save_record_close_filesave_record_error1:

28、lea dx, file_error1mov ah, 09Hint 21Hjmp exit_save_recordsave_record_error2:lea dx, file_error2mov ah, 09Hint 21Hjmp exit_save_recordsave_record_close_file:mov ah, 3eHmov bx, fp1int 21Hexit_save_record:;exit sub procedurepop dipop sipop dxpop cxpop bxpop axretsave_record endp;end of subprocedure;*;*

29、read_record proc far;define subprocedurepush axpush bxpush cxpush dxpush sipush di;main port of sub procedure;Open filelea dx, file_namemov ah, 3dHmov al, 00Hint 21Hjc read_record_error1mov fp1, ax;read record countmov ah, 3fHmov bx, fp1mov cx, 02Hlea dx, rcountint 21Hjc read_record_error2lea dx, fi

30、le_info_3mov ah, 09Hint 21H;分配链表头结点lea ax, rdatamov head, axmov rdata_p, axadd rdata_p, StructNodemov bx, headmov word ptr bx+Node_next, 00Hmov cx, rcountloop1_read_record:push cxmov ax, rdata_pmov newnode, axadd rdata_p, StructNode;read new nodemov ah, 3fHmov bx, fp1mov cx, StructNodemov dx, newnod

31、eint 21Hjc read_record_error2;add new node to listmov di, newnodemov si, headmov ax, word ptr si+Node_nextmov word ptr di+Node_next, axmov word ptr si+Node_next, dipop cxloop loop1_read_recordread_record_ok:lea dx, file_info_4mov ah, 09Hint 21Hjmp read_record_close_fileread_record_error1:lea dx, fil

32、e_error3mov ah, 09Hint 21Hjmp exit_read_recordread_record_error2:lea dx, file_error4mov ah, 09Hint 21Hjmp exit_read_recordread_record_close_file:mov ah, 3eHmov bx, fp1int 21Hexit_read_record:;exit sub procedurepop dipop sipop dxpop cxpop bxpop axretread_record endp;end of subprocedure;*find_record proc farpush axpush bxpush cxpush dxpush sipush dilea dx, info_0mov ah, 09Hint 21Hcall far ptr getintcall crlfmov si, headmov di, headfind_again: mov di,word ptr di+Node_next

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 教育专区 > 教案示例

本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知淘文阁网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

工信部备案号:黑ICP备15003705号© 2020-2023 www.taowenge.com 淘文阁