实验报告模板—汇编语言.doc

上传人:飞****2 文档编号:56710326 上传时间:2022-11-03 格式:DOC 页数:32 大小:163KB
返回 下载 相关 举报
实验报告模板—汇编语言.doc_第1页
第1页 / 共32页
实验报告模板—汇编语言.doc_第2页
第2页 / 共32页
点击查看更多>>
资源描述

《实验报告模板—汇编语言.doc》由会员分享,可在线阅读,更多相关《实验报告模板—汇编语言.doc(32页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。

1、云南大学软件学院实验报告姓名年级班级学号专业序号实验名称成绩指导教师 (签名):一 实验原理(基本知识简单介绍、算法、流程)打开文件读一个记录读错?NY文件尾?YN显示记录显示错误信息关闭文件返回开始二 实验结果(截图,提供实验测试/调试的结果等,在空白地方手写注释)Student struc m_sName db 6 dup( ) m_sNum db 8 dup( ) m_sScore db 3 dup( ) Student ends stsg segment stack s dw 32 dup(?) stsg ends anykey macro mov ah,7 int 21h endm

2、anykeyback macro anykey showmsg back endm crlfm macro push ax push dx mov ah,9 lea dx,crlf int 21h pop dx pop ax endm exchange macro i,j push cx push si push di mov cx,17;t=i,即t=前项 mov si,i lea di,stutemp rep movsb mov cx,17;i=j,si-后项,即前项=后项 mov di,i ; rep movsb mov cx,17;j=t,di-后项,即后项t lea si,stute

3、mp rep movsb mov swapped,1 pop di pop si pop cx endm space macro push dx push ax lea dx,gap mov ah,9 int 21h pop ax pop dx endm showmsg macro n push ax push dx mov ah,9 lea dx,msg&n int 21hpop dx pop ax endm movitem macro dst,src push cx push di push si cld mov cx,17 lea di,dst lea si,src rep movsb

4、pop si pop di pop cx endm data segment studentx student 30 dup() stutemp db 17 dup (0),$studisp db 19 dup(0),$ namepar LABEL BYTEmaxnlen db 7 namelen db ? namefld db 7 dup(?) numpar label byte maxmlen db 9 numlen db ? numfld db 9 dup(?) scopar label byte maxsco db 4 scolen db ? scofld db 4 dup(?) ;输

5、入文件路径缓冲区 pathpar label byte pathmax db 40 pathlen db ? pathnam db 40 dup(?) ae90 db 0 ae80 db 0 ae70 db 0 ae60 db 0 b60 db 0 msg_b60 db 9,9,Scores=60:$ msg_ae70 db 9,9,Scores=70:$ msg_ae80 db 9,9,Scores=80:$ msg_ae90 db 9,9,Scores=90:$ cur_i dw ? crlf db 13,10,$ titl db Students Management System,0D

6、H,0AH, ,0DH,0AH,0DH,0AH menu1 db I(Insert the data of the students),0dh,0ah ;menu menu2 db L(Browse the data of the students),0dh, 0ah menu3 db Q(Query the data of the students),0dh, 0ahmenu4 db D(Delete the data of the students),0dh, 0ahmenu5 db M(Modify the data of the students),0dh,0ahmenu7 db P(

7、Print the data of the students),0dh, 0ahmenu8 db C(Statistics the data of the students),0dh, 0ahmenu9 db E(Exit the System),0dh, 0ah,$ msgmenu5_1 db 0DH,0AH,1-Modify name,0DH,0AH msgmenu5_2 db 2-Modify number,0DH,0AH msgmenu5_3 db 3-Modify score,0DH,0AH,$ msgmenu3_1 db 0DH,0AH,1-Search name,0DH,0AH

8、msgmenu3_2 db 2-Search number,0DH,0AH msgmenu3_3 db 3-Search score,0DH,0AH,$ mmenutip db choose a number from the menu above,0DH,0AH,$ msgprinttitle db 0DH,0AH,0DH,0AH, sno sname score ,0DH,0AH,$ gap db $ stu dw ? stustored dw 0swapped db 0 sav_cnt dw ? stusaved dw 0saveflag db 1 errcde db 0endcde d

9、b 0 endaddr dw ? filehandle dw ? msg_titleln db -,13,10,$ msgsepln db -,0DH,0AH,$ msg02 db Please input the new student info.,13,10,$ msg03 db Name:,$ msg04 db ID:,$ msg05 db Score:,$ msg07 db Successly Saved!,13,10,$ msgdeled db Successly Deleted a item!,13,10,$ msgmoded db Successly Modified a ite

10、m content!,13,10,$ msginsed db Successly Inserted item(s)!,13,10,$ msgqforins db Insert this item?(y/n):,13,10,$ msgback db Press any key to back.$ msgexit db Press any key to exit.$ msg09 db students out of 30.,13,10,$ msg20 db There are more than 30 students.,13,10,$ msg21 db Save as:,13,10,$ msg2

11、2 db Please input the file you want to operate:,13,10,$ msg23 db Read successly!,13,10,$ msg27 db There isn,27h,t any student.,13,10,$ msgnoext db There is no such item!,13,10,$ msgnaminfid db Please input a name to find:,13,10,$ msgnuminfid db Please input a number to find:,13,10,$ msgscoinfid db P

12、lease input a score to find:,13,10,$ msgstattit db 9,9,The result of statistics is listed as follow:,13,10,$ msg_nname db Please input a new one:,13,10,$ msg_nnum db Please input a new num.:,$ msg_nsco db Please input a new score.:,$ msgqsave db The ducoment have not saved.Do you want to save it now

13、(y/n)?,$ msg_delnamin db Please input the name you want to delete:,13,10,$ msg_modname db Please input the name field you want to modify:,13,10,$ msg_modnum db Please input the number field you want to modify:,13,10,$ msg_modsco db Please input the score field you want to modify:,13,10,$ opnmsg db *

14、Error occured while opening file*,13,10,$ wrtmsg db *Error occured while writing file*,13,10,$ readmsg db *Error occured while reading file*,13,10,$ routemsg db *Path name is invalid*,13,10,$ data ends code segment assume cs:code,ds:data,ss:stsg,es:data main proc far start: mov ax,data mov ds,ax mov

15、 es,ax mainmenu: mov AX,0600H mov CX,0000H mov DX,174FH mov BH,07 int 10H mov AH,02 ;set cursor mov BH,0 mov DX,0100H int 10H lea DX,titl ;display menu mov AH,9 int 21H showmsg _titleln lea DX,mmenutip mov AH,9 int 21H case: mov ah,0 int 16h cmp ah,17h;i je addone cmp ah,26h;l je browse cmp ah,19h;p

16、 je display cmp ah,10h;q je query cmp ah,20h;d je del_interm cmp ah,2eh;c je statis cmp ah,32h;m je change cmp ah,12h;e je exit display: call display_in anykeyback jmp mainmenu query: call query_in anykeyback jmp mainmenu browse: call browse_in anykeyback jmp mainmenu addone: call insert_in anykeyba

17、ck jmp mainmenu exit: call quit statis: call stat_in anykeyback jmp mainmenu del_interm: jmp delete change: call mod_in anykeyback jmp mainmenu delete: call del_in anykeyback jmp mainmenu beep: mov AH,14 mov AL,7 mov BH,0 int 10H jmp mainmenu main endp ;- browse_in proc near call near ptr clear call

18、 near ptr cursor call near ptr readall call name_sort call near ptr print ret browse_in endp ;- del_in proc near call clear call cursor call delete_in ret del_in endp ;- query_in proc near call clear call cursor call bg_search ret query_in endp ;- stat_in proc near call clear call cursor call near p

19、tr stat ret stat_in endp ;- insert_in proc near call clear call cursor call near ptr input call name_sort ret insert_in endp ;- display_in proc near call clear call cursor call near ptr print ret display_in endp ;- mod_in proc near call clear call cursor call print call bg_modify call name_sort ret

20、mod_in endp ;- delete_in proc near push ax push dx call print crlfm mov ah,9 lea dx,msg_delnamin int 21h call near ptr inputname call near ptr del cmp ax,-1 je qdel showmsg deled qdel: pop dx pop ax ret delete_in endp ;- bg_search proc near showmsg menu3_1 mov ah,1 int 21h;getch() crlfm cmp al,1 je

21、q1 cmp al,2 je q2 showmsg scoinfid lea bx,studentx+14 mov dx,3 jmp bgsear q1: showmsg naminfid call near ptr inputname lea bx,studentx mov dx,1 jmp bgsear q2: showmsg numinfid call near ptr inputnum lea bx,studentx+6 mov dx,2 bgsear: push bxpush dxcall near ptr search;search(studentx,1)cmp ax,-1 je

22、qins showmsg printtitle showmsg sepln push si mov si,ax call near ptr printline pop si jmp qque qins: showmsg qforins mov ah,01 int 21h crlfm cmp al,y jne qque call inputnum call inputsco call stor showmsg insed mov saveflag,0 qque: ret bg_search endp ;- bg_modify proc near push ax push bx push dx s

23、howmsg menu5_1;display modify submenu mov ah,1 int 21h;getch() crlfm cmp al,1 je t1 cmp al,2 je t2 mov bx,3 call inputsco jmp cin t1: call inputname mov bx,1 jmp cin t2: mov bx,2 call inputnum cin: push bx call near ptr modify cmp ax,-1 je qmodi crlfm showmsg moded qmodi: pop dx pop bx pop ax ret bg

24、_modify endp ;- quit proc near cmp saveflag,0 je qforsav jmp qsys qforsav: call clear call cursor showmsg qsave mov ah,1 int 21h cmp al,y je savit jmp qsys savit: call save mov ah,3eh;close file mov bx,filehandle int 21h qsys: mov ax,4c00h int 21h ret quit endp ;- search proc near push bp mov bp,sp

25、push di push bx push si push cx push dx mov di,bp+6 mov dx,stustored mov bx,bp+4;bx:type mov bp,di cmp bx,1 je snam cmp bx,2 je snum mov cx,3 mov bx,cx lea ax,scofld jmp loop1 snam: mov cx,6 mov bx,cx lea ax,namefld jmp loop1 snum: mov cx,8 mov bx,cx lea ax,numfld loop1: mov si,ax mov cx,bx repe cmp

26、sb je found add bp,17 mov di,bp dec dh jnz loop1 mov ax,-1 showmsg noext jmp qsearch found: mov ax,bp mov dx,stustored sub dx,bx mov cur_i,dx qsearch:pop dx pop cx pop si pop bx pop di pop bp ret 4 search endp ;- name_sort proc near push si push di push ax push bx push dx push cx cmp stustored,1 je

27、qsort lea bx,studentx push bx mov ax,stustored sub ax,1 mov bl,17 mul bl pop bx add bx,ax mov dx,stustored sub dx,1 ;dx:il1: mov swapped,0 sub bx,17 mov endaddr,bx push bx lea si,studentx;si:j,j=0 l2: mov cx,6 mov di,si add di,17 mov bx,di mov ax,si repe cmpsb jbe s3 exchange ax,bx s3: mov si,ax add

28、 si,17;j+ cmp si,endaddr jbe l2 pop bx cmp swapped,0 je qsort dec dx jnz l1 qsort: pop cx pop dx pop bx pop ax pop di pop si ret name_sort endp ;- del proc near push bx push di push si push cx lea bx,studentx push bx mov bx,1;search(studentx,name) push bx call near ptr search cmp ax,-1 je nomatch mo

29、v di,ax mov si,di add si,17;si:j,di:i mov 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,1 nomatch: pop cx pop si pop di pop bx ret del endp ;- insert proc near push si push di push ax push bx push

30、cx cmp stustored,0 je exi lea si,stutemp lea di,studentx mov ax,stustored mov bl,17 mul bl add di,ax mov cx,17; rep movsb inc stustored exi: pop cx pop bx pop ax pop di pop si ret insert endp ;- stor proc near push ax push bx push dx push di push si push cx cmp namelen,0 je qsto cld mov ax,stustored

31、 mov bl,17 mul bl lea dx,studentx mov stu,dx add stu,ax mov di,stu lea si,namefld mov cx,6 rep movsb lea si,numfld mov cx,8 rep movsb mov cx,3 lea si,scofld rep movsb inc stustored qsto: pop cx pop si pop di pop dx pop bx pop ax ret stor endp ;- modify proc near push bp mov bp,sp push bx push dx push di push cx mov bx,bp+4 cmp bx,1 je mdnam cmp bx,2 je mdnum lea dx,studentx+14 jmp find mdnam: lea dx,studentx jmp find mdnum: lea dx,studentx+6 find: push dx push bx call near ptr search cmp ax,-1 je qu_mod mov di,ax; cmp bx,1 je

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

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

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

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