实验报告模板—汇编语言_第1页
实验报告模板—汇编语言_第2页
实验报告模板—汇编语言_第3页
已阅读5页,还剩28页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、云南大学软件学院实验报告姓名年级班级学号专业序号实验名称成绩指导教师(签名):实验原理(基本知识简单介绍、算法、流程)开始打幵文件打幵文件賈文件I旨针到文咋屋施冬端按受用户输入的记汞逮一个沪录显示记录记录写入文件关闭文件并返回t4) mDC'fy谎琨圄开始打开文祎文件加针恬谊 TiES写入俺改记录幷矢诩交件r號回qu«y流程图幵贻打幵玄体4个记录逋回I按学成啧廿最并崛计叱庁弋11尾录元錨卄结里T关疲件L返回退岀程序实验结果(截图,提供实验测试/调试的结果等,在空白地方手写注释)Stude nt strucm_sName db 6 dup('')m_sNum d

2、b 8 dup('') m_sScore db 3 dup('')Stude nt endsstsg segme nt stack 's'dw 32 dupstsg endsan ykey macromov ah,7int 21hendman ykeyback macroanykeyshowmsg backendmcrlfm macropush axpush dxmov ah,9leadx,crlfint21hpop dxpop axendmexcha nge macro i,jpush cxpush sipush dimov cx,17;t=i

3、,即 t=前项mov si,ilea di,stutemprep movsbmov cx,17;i=j,si->后项,即前项=后项mov di,i ;rep movsbmov cx,17;j=t,di-> 后项,即后项=t lea si,stutemp rep movsbmov swappedpop dipop sipop ex endmspace macropush dx push ax lea dx,gap mov ah,9 int 21h pop ax pop dx endmshowmsg macro npush axpush dx mov ah,9 lea dx,msg&a

4、mp;n int 21h pop dx pop ax endmmovitem macro dst,srcpush cxpush di push si cldmov cx,17 lea di,dst lea si,src rep movsb pop si pop di pop cx endmdata segme ntstude ntx stude nt 30 dup(<>)stutempdb17 dup (0),'$'studispdb 19 dup(0),'$'n ameparLABELBYTEmaxnlendb7n amele ndb?n amef

5、lddb7 dup(?)nu mparlabelbytemaxmle ndb9nu mle ndb?numflddb9 dup(?)scoparlabel bytemaxscodb4scole ndb?scoflddb4 dup(?);输入文件路径缓冲区pathparlabelbytepathmaxdb40pathle ndb?path namdb40 dup(?)ae90 db 0ae80 db 0ae70 db 0ae60 db 0b60 db 0msg_b60db9,9,'Scores<60:$'msg_ae60db9,9,'Scores>=60:$&

6、#39;msg_ae70db9,9,'Scores>=70:$'msg_ae80db9,9,'Scores>=80:$'msg_ae90db9,9,'Scores>=90:$'cur_i dw ?crlfdb13,10,'$'titl db 'Students Management System',ODH,OAH,'',ODH,OAH,ODH,OAHmenul db ' 1(1 nsert the data of the stude nts)',0dh,0ah;me

7、 numenu2 db ' L(Browse the data of the students)',0dh, Oah menu3 db ' Q(Query the data of the students)',0dh, Oah menu4 db ' D(Delete the data of the students)',0dh, Oah menu5 db ' M(Modify the data of the students)',0dh,0ah menu7 db ' P(Print the data of the stud

8、ents)',0dh, Oah menu8 db ' C(Statistics the data of the students)',0dh, Oah menu9 db ' E(Exit the System)',Odh, Oah,'$'msgme nu5_1 db 0DH,0AH,'1Modify n ame',0DH,0AHmsgme nu5_2 db '2Modify number',0DH,0AH/msgme nu5_3 db '3Modify score',0DH,0AH,'

9、;$'msgme nu3_1 db 0DH,0AH,'1Search n ame',0DH,0AH/msgme nu3_2 db '2Search number',0DH,0AHmsgme nu3_3 db '3Search score',0DH,0AH,'$'mmenutip db ' choose a number from the menu above',0DH,0AH,'$'msgprinttitle db 0DH,0AH,0DH,0AH,' snosnamescore

10、9;,0DH,0AH,'$'gap db ' $'dwstustustored dw0swapped db0sav_c nt dw?stusaved dw0saveflag db1errcde db0endcdedb0endaddr dw ?fileha ndle dw ?msg_titleln db '',13,10,'$'msgsep In db '',0DH,0AH,'$'msg02dbmsg03dbmsg04dbmsg05dbdb'Please in put the new stud

11、e nt in fo.',13,10,'$' 'Name:','$''ID:','$''Score:','$'msg07 msgdeled db msgmoded db msgin sed db msgqfori ns db msgback msgexit msg09 msg20 msg21 msg22 msg23 msg27dbdb db db db db dbmsgno ext db 'There msgnaminfid db msgnuminfid db msg

12、sco infid db'Successly Saved!',13,10,'$''Successly Deleted a item!',13,10,'$''Successly Modified a item co nten t!',13,10,'$''Successly In serted item(s)!',13,10,'$' 'Insert this item?(y/n):',13,10,'$' db'Press any k

13、ey to back.$''Press any key to exit.$''students out of 30.',13,10,'$''There are more than 30 stude nts.',13,10,'$''Save as:',13,10,'$''Please in put the file you want to operate:',13,10,'$' 'Read successly!',13,10,&#

14、39;$''There isn',27h,'t any student.',13,10,'$'is no such item!',13,10,'$''Please in put a name to fin d:',13,10,'$''Please in put a number to fin d:',13,10,'$''Please input a score to find:',13,10,'$'msgstattit

15、db 9,9,'The result of statistics is listed as follow:',13,10,'$' msg_nn ame db 'Please in put a new on e:',13,10,'$' msg_ nnum db 'Please in put a new nu m.:','$'msgqsave db it now(y/n)?','$'msg_de Inamin dbmsg_mod name dbmsg_modsco dbopnms

16、gdbwrtmsgdbreadmsgdbroutemsgdbmsg_mod num dbmsg_n sco db 'Please in put a new score.:','$''The ducome nt have not saved.Do you want to save'Please in put the name you want to delete:',13,10,'$''Please in put the name field you want to modify:',13,10,'$

17、''Please in put the number field you want to modify:',13,10,'$' 'Please input the score field you want to modify:',13,10,'$''*Error occured while opening file*',13,10,'$''*Error occured while writing file*',13,10,'$''*Error occu

18、red while readi ng file*',13,10,'$' '*Path name is in valid*',13,10,'$'data endscode segme ntassume cs:code,ds:data,ss:stsg,es:datamai n procfarstart:movax,datamovds,axmov es,axmai nmenu:movAX,0600HmovCX,0000HmovDX,174FHmovBH,07int10HmovAH,02 ;set cursormovBH,0movDX,0100H

19、int10Hlea DX,titl ;display menu mov AH,9int 21Hshowmsg _title In leaDX,mme nutipmov AH,9 int 21Hcase:mov ah,0 int16hcmpah,17h;'i'jeadd onecmp ah,26h;T je browsecmpah,19h;'p'jedisplaycmpah,10h;'q'jequerycmpah,20h;'d'jedeln termcmpah,2eh;'c'jestatiscmpah,32h;

20、9;m'jechangecmp ah,12h;'e'je exit display:call display_in anykeyback jmp mainmenuquery:call querynanykeybackjmp mainmenu browse:call browsenanykeybackjmp mainmenu add one:call in sert_i n anykeybackjmp mainmenuexit:call quit statis:call stat_i nanykeybackjmp mainmenu deln term:jmp delete

21、cha nge:call mod_i nanykeybackjmp mainmenu delete:call del_i nanykeybackjmpmai nmenubeep:movAH,14movAL,7movBH,0int10Hjmpmai nmenumain endpJbrowse_in proc n earcall n ear ptrclearcall n ear ptrcursorcall near ptr readall call n ame_sortcall near ptr print retbrowse_i n endpdel_i n proc n ear call cle

22、ar call cursor call delete_i n retdel_i n endpqueryn proc near call clear call cursor call bg_search retqueryn endp stat_in proc n earcall clearcall cursorcall near ptr stat retstat_i n endp in sert_i n proc n earcall clearcall cursorcall near ptr input call n ame_sort retin sert_i n endpdisplay_i n

23、 proc n ear call clear call cursor call near ptr print retdisplay_i n endpmod_i n proc n ear call clear call cursor call print call bg_modify call n ame_sort retmod_i n endp delete_i n proc n earpush axpush dxcall print crlfmmov ah,9lea dx,msg_de Inaminint 21h-call n ear ptr in put namecall near ptr

24、 delcmp ax,-1je qdelshowmsg deled qdel:pop dxpop ax retdeleten endp bg_search proc n earshowmsg menu3_1mov ah,1int 21h;getch()crlfmcmp al,'1'je q1cmp al,2je q2showmsg sco infidlea bx,stude ntx+14mov dx,3jmp bgsearq1:showmsg naminfidcall n ear ptr in put namelea bx,stude ntxmov dx,1jmp bgsear

25、q2:showmsg numinfidcall n ear ptr in put numlea bx,stude ntx+6mov dx,2bgsear:push bxpush dxcall near ptr search;search(studentx,1) cmp ax,-1je qi nsshowmsg prin ttitleshowmsg sep Inpush simov si,axcall near ptr printlinepop sijmp qqueqin s:showmsg qfori nsmov ah,O1 int 21h crlfm cmp al,'y' j

26、ne qque call in put num call in putsco call stor showmsg in sed mov saveflag,0 qque: ret bg_search endp bg_modify proc n earpush axpush bxpush dxshowmsg menu 5_1;display modify subme numov ah,1int 21h;getch()crlfmcmp al,'1'je t1cmp al,2je t2mov bx,3call in putscojmp cint1:call in put namemov

27、 bx,1jmp cint2:mov bx,2call in put numcin:push bxcall n ear ptrmodifycmp ax,-1je qmodicrlfmshowmsg modedqmodi:pop dxpop bxpop axretbg_modify endp quit proc n earcmp saveflag,0 je qforsav jmp qsys qforsav:call clearcall cursor showmsg qsave mov ah,1 int 21h cmp al,'y' je savit jmp qsys savit:

28、call savemov ah,3eh;close file mov bx,fileha ndle int 21hqsys:mov ax,4c00hint 21h ret quit endp search proc n earpush bp mov bp,sp push di push bx push si push cx push dxmov di,bp+6mov dx,stustoredmov bx,bp+4;bx:type mov bp,di cmp bx,1 je snamcmp bx,2 je snum mov cx,3 mov bx,cx lea ax,scofld jmp loo

29、p1 sn am:mov cx,6mov bx,cx lea ax,n amefldjmp loopl snum:mov cx,8 mov bx,cx lea ax,nu mfld loopl:mov si,ax mov cx,bx repe cmpsb je found add bp,17 mov di,bp dec dh jnz loop1 mov ax,-1 showmsg no ext jmp qsearch found:mov ax,bpmov dx,stustored sub dx,bx mov cur_i,dx qsearch:pop dx pop cx pop si pop b

30、x pop di pop bp ret 4 search endpn ame_sort proc near push si push di push ax push bx push dx push cxcmp stustored,1 je qsortlea bx,stude ntx push bx mov ax,stustored sub ax,1 mov bl,17 mul bl pop bx add bx,ax;dx:imov dx,stustored sub dx,111:mov swapped,。 sub bx,17 mov en daddr,bx push bxlea si,stud

31、entx;s: j,j=O12:mov cx,6mov di,si add di,17 mov bx,di mov ax,si repe cmpsb jbe s3 excha nge ax,bxs3:mov si,axadd si,17;j+ cmp si,e ndaddr jbe l2 pop bxcmp swapped,0 je qsort dec dx jnz 11qsort:pop cx pop dx pop bx pop ax pop di pop si ret n ame_sort endpdel proc n earpush bxpush dipush sipush cxlea

32、bx,stude ntxpush bxmov bx,1;search(stude ntx, name)push bxcall near ptr searchcmp ax,-1 je no match mov di,ax mov si,di add si,17;si:j,di:imov cx,stustored sub cx,cur_i movit:movitem di,si mov di,si;si:j+1 ,di:j mov dx,di add dx,17 mov si,dx loop movit mov ax,1 mov saveflag,0 sub stustored,1no match

33、:pop cx pop si pop di pop bx ret del endpstustored,0 ;xisi,stutemp di,stude ntx ax,stustored bl,17 bl di,ax cx,17; movsb stustoredin sert proc near push si push di push ax push bx push cxcmp st jeexilea leamovmov mul add mov rep inc exi:pop cx pop bx pop ax pop dipop si ret in sert endpJstorprocnear

34、push axpush bxpush dxpush dipush sipush cxcmp n amele n,0je qstocldmovax,stustoredmovbl,17mulblleadx,stude ntxmovstu,dxaddstu,axmovdi,stuleasi, namefidmovcx,6repmovsbleasi, nu mfldmovcx,8repmovsbmovcx,3leasi,scofldrepmovsbincstustoredqsto:pop cxpop sipop dipop dxpop bxpop axretstorendpmodify proc ne

35、ar push bp mov bp,sp push bx push dx push di push exmov bx,bp+4cmp bx,1 je mdnam cmp bx,2 je mdnum lea dx,stude ntx+14 jmp find mdn am:lea dx,stude ntx jmp find mdnum:lea dx,stude ntx+6 find:push dx push bx call near ptr search cmp ax,-1 je qu_mod mov di,ax;cmp bx,1 je mnam cmp bx,2 je mnumlea dx,ms

36、g_ nsco mov ah,9 int 21h lea dx,scopar mov ah,0ah int 21h mov cx,3 lea si,scofld jmp mfymn am:lea dx,msg_ nn ame mov ah,9 int 21hcall in put name mov cx,6 lea si, namefid jmp mfymnum:lea dx,msg_ nnum mov ah,9 int 21hlea dx,nu mpar mov ah,0ah int 21h mov cx,8 lea si, nu mfldmfy:rep movsbmov saveflag,

37、0 mov ax,1 qu_mod:pop expop dipop dx pop bxpop bp ret 2modify endp stat proc n earpush cx push bx push dx push axmov cx,stustored lea bx,stude ntx+14 sta:mov dx,bx mov ah,bx+2 cmp dl,'1' je a90 cmp dh,9 jae a90 cmp dh,8 jae a80 cmp dh,'7' jae a70 cmp dh,'6' jae a60 add b60,1

38、jmp repeat a90:add ae90,1jmp repeat a80:add ae80,1jmp repeat a70:add ae70,1jmp repeat a60:add ae60,1 repeat:add bx,17 loop stashowmsg stattitshowmsg _title Inshowmsg _b60 mov bl,byte ptr b60 call deciasc crlfmshowmsg _title Inshowmsg _ae60 / mov bl,byte ptr ae60 call deciasc crlfmshowmsg _title Insh

39、owmsg _ae70 mov bl,byte ptr ae70 call deciasc crlfmshowmsg _title Inshowmsg _ae80 mov bl,byte ptr ae80 call deciasc crlfmshowmsg _title Inshowmsg _ae90 mov bl,byte ptr ae90 call deciasc crlfmshowmsg _title Inmov ae90,0mov ae80,0mov ae70,0mov ae60,0mov b60,0pop ax pop dx pop bx pop cx retstat endperr

40、mprocn earpush ax mov intmovah,921h errcde,01 pop ax reterrm endpin putprocn earpush ax push dxcall n ear ptrclearcall n ear ptrcursorcmpstustored,29jai1movah,09leadx,msg02;display promptint21hiloop:cmpstustored,29jai1call n ear ptrin put namecmpn amele n,0jei2call n ear ptrin put numcall n ear ptri

41、n putscocall n ear ptrstorjmpiloopmov saveflag,0jmpi2i1:movah,9leadx,msg20;'There are more tha n 30 stude nts.'int21hi2:showmsg back;'Press any key to back.'i3:movsaveflag,0pop dxpop axretin putendpin put name procnearpush axpush dxpush bxpush cxshowmsg 03 movah,0ahleadx,n ameparint2

42、1hcrlfmmovmovmov sub n10:bh,0bl, namele ncx,7cx,bxmov inc loopn amefldbx,20h bx n10pop expop bxpop dxpop axret in put name endpin put numproen earpush ax push dx push bx push exshowmsg mov lea int erlfm mov mov mov sub n20:mov inc loop04ah,0ah dx,nu mpar 21hbh,0bl, nu mle ncx,9cx,bxnu mfldbx bxn20en

43、dpprocpop cx pop bx pop dx pop ax ret in put numin putscopush axpush dxpush bxpush cxmov lea intcrlfm mov mov mov subshowmsg 05ah,Oah dx,scopar 21hbh,0bl,scole n cx,4 cx,bxn21:mov inc loopscofldbx,20hbxn21pop cx pop bx pop dxpop ax retin putscoendp print proc n earpush sipush cxpush dxpush axcmp stu

44、stored,0je qpri ntcrlfmcrlfmshowmsg prin ttitle showmsg sep In lea si,stude ntx mov cx,stustored pline: call near ptr printline loop pli nepop axpop dx pop cx pop siqprint: ret print endp prin tl ine proc nearpush dipush ex push dx push axlea di,studisp;stutemp=stude ntxi mov ex,6 rep movsbmov studi

45、sp+6,9 add di,1mov cx,8 rep movsbmov studisp+15,9 add di,1mov cx,3 rep movsbmov ah,9 lea dx,studisp int 21h crlfm showmsg sep Inpop ax pop dx pop cx pop di ret prin tli ne endp deciasc proc near mov ch,100d mov cl,10d re:cmp ch,0 je qdecimov al,bl; cbwdiv ch;mov bl,ahcall near ptr printit mov al,chc

46、bwdiv clmov ch,aljmp reqdeci:ret deciasc endpJprin titproc n earadd al,30h mov dl,al mov ah,2 int 21h retprin tit endpJstor2procn earpush si push di push ax push bx push cxcmpstutemp,0jeexittleasi,stutempleadi,stude ntxmovax,stustoredmovbl,17mulbladddi,axmovcx,17;repmovsbincstustoredpop cx pop bxpop

47、 ax pop di pop si exitt:retstor2endpJget_pathprocn earpush ax push bx push dxshowmsg22;'Please in put the file you want to operate:movah,0ahleadx,pathparint21h;crlfmmovbl,pathle nmovbh,0movpath nambx,0pop dxpop bxpop axret get_path endpJope nhpush ax push ex push dxprocn earcall nearptrget_pathmovah,3dhmovcx,0leadx,path namint21hjco1movfileha ndle,axpop dxpop cxpop axreto1:moven dcde,01leadx,op nmsgcall nearptrerrmpop dxpop cxpop axretope nh endpJreadallprocn earpush axmoven dcde,0call nearptrope nhcmpen dcde,0jnerexit;e ndcde=1movstustored,0contin:call nearptrreadhcmpen dcde,0jner2

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论