版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、.计算机组成原理与汇编语言实验(2013)云南大学软件学院实验报告姓名年级班级学号专业序号实验名称成绩指导教师 (签名):1 实验原理(基本知识简单介绍、算法、流程)打开文件读一个记录读错?NY文件尾?YN显示记录显示错误信息关闭文件返回开始2 实验结果(截图,提供实验测试/调试的结果等,在空白地方手写注释)Student struc m_sName db 6 dup(' ') m_sNum db 8 dup(' ') m_sScore db 3 dup(' ') Student ends stsg segment stack 's
2、9; dw 32 dup(?) stsg ends anykey macro mov ah,7 int 21h endm 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->后项,
3、即前项=后项 mov di,i ; rep movsb mov cx,17;j=t,di->后项,即后项t lea si,stutemp 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,s
4、rc push cx push di push si cld mov cx,17 lea di,dst lea si,src rep movsb 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 maxmle
5、n db 9 numlen db ? numfld db 9 dup(?) scopar label byte maxsco db 4 scolen db ? scofld db 4 dup(?) ;输入文件路径缓冲区 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_ae60 db 9,9,'Scores>=60
6、:$' 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',0DH,0AH,' ',0DH,0AH,0DH,0AH menu1 db ' I(Insert the data of the student
7、s)',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(Print the
8、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
9、9;,0DH,0AH,'$' msgmenu3_1 db 0DH,0AH,'1-Search name',0DH,0AH 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,'
10、; 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 db 0 endaddr dw ? filehandle dw ? msg_titleln db ' -',13,10,'$' msgsepln db '-',0DH,0AH,'$' msg02 db 'Plea
11、se 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 '
12、;Successly Modified a item 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 'stu
13、dents out of 30.',13,10,'$' msg20 db 'There are more than 30 students.',13,10,'$' msg21 db 'Save as:',13,10,'$' msg22 db 'Please input the file you want to operate:',13,10,'$' msg23 db 'Read successly!',13,10,'$' msg27 db
14、39;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 'Please
15、 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 s
16、core.:','$' msgqsave db 'The ducoment have not saved.Do you want to save it now(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_
17、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 '*Error occured while opening file*',13,10,'$' wrtmsg db '*Error occured while writing file
18、*',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 es,ax mainmenu: mov AX,0600H
19、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'
20、 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 anyke
21、yback jmp mainmenu addone: call insert_in anykeyback 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 en
22、dp ;- browse_in proc near call near ptr clear call 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 ;- st
23、at_in proc near call clear call cursor call near ptr 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 cu
24、rsor call print call bg_modify call name_sort ret 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 m
25、enu3_1 mov ah,1 int 21h;getch() crlfm cmp al,'1' je 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 bgse
26、ar: push bxpush dxcall near ptr search;search(studentx,1)cmp ax,-1 je 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 save
27、flag,0 qque: ret bg_search endp ;- bg_modify proc near push ax push bx push dx showmsg 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: pu
28、sh bx call near ptr modify cmp ax,-1 je qmodi crlfm showmsg moded qmodi: pop dx pop bx pop ax ret bg_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
29、file mov bx,filehandle int 21h qsys: mov ax,4c00h int 21h ret quit endp ;- search proc near push bp mov bp,sp 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
30、 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 cmpsb 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 b
31、p ret 4 search endp ;- name_sort proc near push si push di push ax push bx push dx push cx cmp stustored,1 je 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
32、: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 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
33、cx lea bx,studentx push bx mov bx,1;search(studentx,name) push bx call near ptr search cmp ax,-1 je nomatch mov 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
34、,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 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 end
35、p ;- stor proc near push ax push bx push dx push di push si push cx cmp namelen,0 je qsto cld mov ax,stustored 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
36、 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 c
37、mp ax,-1 je qu_mod mov di,ax; cmp bx,1 je mnam cmp bx,2 je mnum lea dx,msg_nsco mov ah,9 int 21h lea dx,scopar mov ah,0ah int 21h mov cx,3 lea si,scofld jmp mfy mnam: lea dx,msg_nname mov ah,9 int 21h call inputname mov cx,6 lea si,namefld jmp mfy mnum: lea dx,msg_nnum mov ah,9 int 21h lea dx,numpar
38、 mov ah,0ah int 21h mov cx,8 lea si,numfld mfy: rep movsb mov saveflag,0 mov ax,1 qu_mod: pop cx pop di pop dx pop bx pop bp ret 2 modify endp ;- stat proc near push cx push bx push dx push ax mov cx,stustored lea bx,studentx+14 sta: mov dx,bx mov ah,bx+2 cmp dl,'1' je a90 cmp dh,'9'
39、 jae a90 cmp dh,'8' jae a80 cmp dh,'7' jae a70 cmp dh,'6' jae a60 add b60,1 jmp repeat a90:add ae90,1 jmp repeat a80:add ae80,1 jmp repeat a70:add ae70,1 jmp repeat a60:add ae60,1 repeat:add bx,17 loop sta showmsg stattit showmsg _titleln showmsg _b60 mov bl,byte ptr b60 call
40、 deciasc crlfm showmsg _titleln showmsg _ae60 mov bl,byte ptr ae60 call deciasc crlfm showmsg _titleln showmsg _ae70 mov bl,byte ptr ae70 call deciasc crlfm showmsg _titleln showmsg _ae80 mov bl,byte ptr ae80 call deciasc crlfm showmsg _titleln showmsg _ae90 mov bl,byte ptr ae90 call deciasc crlfm s
41、howmsg _titleln mov ae90,0 mov ae80,0 mov ae70,0 mov ae60,0 mov b60,0 pop ax pop dx pop bx pop cx ret stat endp ;- errm proc near push ax mov ah,9 int 21h mov errcde,01 pop ax ret errm endp ;- input proc near push ax push dx call near ptr clear call near ptr cursor cmp stustored,29 ja i1 mov ah,09 lea dx,msg02;display prompt int 21h
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2024年佛山市南海区丹灶镇招聘专管员历年管理单位遴选500模拟题附带答案详解
- 2024装修承包合同版样书
- 2024商标事务代理委托合同
- 2024二级建造师劳动聘用合同
- 重度颅脑损伤的护理
- 护理8分钟讲课比赛
- 抗惊厥药物护理常规
- 2024至2030年中国五套保鲜盒行业投资前景及策略咨询研究报告
- 2024年中国鞋面蒸湿机市场调查研究报告
- 2024年中国极早熟小果型西瓜种市场调查研究报告
- 大数据通识教程全套教学课件
- 民间借贷法律知识讲座
- 高中地理命题培训课件
- 【数学】天津市河北区2024届高三上学期期末质量检测试题(解析版)
- 2024年山东鲁信实业集团有限公司招聘笔试参考题库含答案解析
- 医院保密培训课件
- 干部履历表(中共中央组织部2015年制)
- 畜禽粪污资源化利用项目商业计划书
- Part1-2 Unit2 Health and Fitness教案-【中职专用】高一英语精研课堂(高教版2021·基础模块2)
- 信创安全运维方案设计思路
- 创意嘉年华独特创意的嘉年华活动策划方案
评论
0/150
提交评论