;==学生成绩管理系统==;*******************************************************************************;EQUSTATEMENTSGOHEREStructNodeequ32;表达式赋值微操作equpage133Node_nameequ0;类似defineNode_numequ12Node_mathsequ18Node_englishequ20Node_chineseequ22Node_othersequ24Node_totalequ26Node_avgequ28Node_nextequ30max_recordequ100max_menu_indexequ9;*******************************************************************************;*******************************************************************************data_segsegment;definedatasegment;DATAGOESHEREbuf1DB30buf1_slenDB?buf1_dataDB30dup(?)bufnameDB20bufname_slenDB?bufname_dataDB20dup(?)bufgetintDB32bufgetint_slenDB?bufgetint_dataDB32dup(?)str_menuDB0dH,0aH,'=====Studentmarkssystem=====',0dH,0aH,0dH,0aHDB'1)AddRecord',0dH,0aH,0dH,0aHDB'2)PrintAll',0dH,0aH,0dH,0aHDB'3)Save',0dH,0aH,0dH,0aHDB'4)Open',0dH,0aH,0dH,0aH,0dH,0aHDB'5)Find',0dH,0aH,0dH,0aH,0dH,0aHDB'6)Delete',0dH,0aH,0dH,0aH,0dH,0aHDB'0)Exit',0dH,0aHDB'Choice:$';ErrorStringsstr_error_1DB'Errorinput!',0dH,0aH,'$'jump_tbDWcase_0DWcase_1DWcase_2DWcase_3DWcase_4DWcase_5DWcase_6headDW?;表头指针info_0db'inputnum:','$'info_1db'inputmath:','$'info_2db'inputenglish:','$'info_3db'inputchinese:','$'info_4db'inputothers:','$'info_5db'inputname:','$'str_tb_headdb'Num',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(?);全部结点*(100+1)rdata_pdwrdata;下一个可用结点rcountdw00H;当前已分配的结点数newnodedw?pnodedw?file_namedb'c:\student.txt',00Hfile_error1db'Failedcreatefile...',0DH,0AH,'$'file_error2db'Failedwritefile...',0DH,0AH,'$'file_error3db'Failedopenthefile...',0DH,0AH,'$'file_error4db'Failedreadfile...',0DH,0AH,'$'file_info_1db'savingthefile...',0DH,0AH,'$'file_info_2db'Writetofilesuccessfully!',0DH,0AH,'$'file_info_3db'openingthefile...',0DH,0AH,'$'file_info_4db'readthefilesuccessfully!',0DH,0AH,'$'fp1dw?;文件指针data_segends;*******************************************************************************;*******************************************************************************extdata_segsegment;defineextradatasegment;EXTRADATAGOESHEREextdata_segends;*******************************************************************************;*******************************************************************************stack_segsegmentstack;defineextradatasegment;STACKDATAGOESHEREDB100Hdup(?)stack_segends;*******************************************************************************;*******************************************************************************programsegment;definecodesegment;*******************************************************************************mainprocfar;mainpartofprogramassumecs:program,ds:data_seg,es:extdata_seg,ss:stack_segstart:;setupstackforreturnpushdssubax,axpushax;setDSregistertocurrentdatasegmentmovax,data_seg;data_segsegmentaddrmovds,ax;intoDSregistermovax,extdata_seg;extdata_segsegmentaddrmoves,ax;intoESregistermovax,stack_seg;stack_segsegmentaddrmovss,ax;intoSSregister;MAINPARTOFPROGRAMGOESHERE;分配链表头结点movax,rdata_pmovhead,ax;当前头指针就是rdata_paddrdata_p,StructNodemovbx,headmovwordptr[bx+Node_next],00Hlb_print_menu:;打印菜单leadx,str_menumovah,09Hint21Hcallfarptrgetintcmpdx,max_menu_indexjalb_print_menumovdi,dxshldi,1jmpjump_tb[di]jmplb_print_menucase_0:;Exitretcase_1:;添加记录callfarptraddrecordjmplb_print_menucase_2:;打印所有记录callfarptrprint_recordjmplb_print_menucase_3:;保存到文件callfarptrsave_recordjmplb_print_menucase_4:;从文件中读取callfarptrread_recordjmplb_print_menucase_5:;查找callfarptrfind_recordjmplb_print_menucase_6:;删除callfarptrdelete_recordjmplb_print_menuret;returntoDOSmainendp;endofmainpartofprogram;*******************************************************************************;*******************************************************************************sub1procnear;definesubprocedurepushaxpushbxpushcxpushdx;mainportofsubprocedure;exitsubprocedurepopdxpopcxpopbxpopaxretsub1endp;endofsubprocedure;*******************************************************************************;*******************************************************************************;printCRLFcrlfprocfarpushdxpushaxmovdl,0dHmovah,02Hint21Hmovdl,0aHmovah,02Hint21hpopaxpopdxretcrlfendp;*******************************************************************************;*******************************************************************************;从键盘输入一个整数,结果保存到dx中getintprocfar;definesubprocedurepushaxpushbxpushcx;mainportofsubproceduremovdx,offsetbufgetint;offset偏移地址movah,0aHint21Hcallfarptrcrlfmovax,offsetbufgetint_datapushax;字符串首地址moval,bufgetint_slencbw;字节转字pushax;字符串长度pushax;返回值callfarptrdecibinpopdxpopaxpopax;exitsubprocedurepopcxpopbxpopaxretgetintendp;endofsubprocedure;*******************************************************************************;*******************************************************************************;把以十制进数形式存储在字符串中的数转成整数;栈中的参数:;0字符串首地址;1字符串长度;2存放结果decibin_para_lenequ3decibin_str1eq