版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)
文檔簡介
1、.計算機(jī)組成原理與匯編語言實驗(2013)云南大學(xué)軟件學(xué)院實驗報告姓名年級班級學(xué)號專業(yè)序號實驗名稱成績指導(dǎo)教師 (簽名):1 實驗原理(基本知識簡單介紹、算法、流程)打開文件讀一個記錄讀錯?NY文件尾?YN顯示記錄顯示錯誤信息關(guān)閉文件返回開始2 實驗結(jié)果(截圖,提供實驗測試/調(diào)試的結(jié)果等,在空白地方手寫注釋)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(?) ;輸入文件路徑緩沖區(qū) 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. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2024年度寵物養(yǎng)護(hù)服務(wù)中介擔(dān)保服務(wù)條款3篇
- 2024-2030年中國垃圾發(fā)電行業(yè)發(fā)展困境與十三五投資建議報告
- 2024年物業(yè)管理合作協(xié)議模板6篇
- 2024年機(jī)器操作安全合同3篇
- 滿洲里俄語職業(yè)學(xué)院《進(jìn)出口業(yè)務(wù)實操二》2023-2024學(xué)年第一學(xué)期期末試卷
- 漯河醫(yī)學(xué)高等??茖W(xué)?!毒频旯芾硇畔⒒浖嶒灐?023-2024學(xué)年第一學(xué)期期末試卷
- 2024套房智能家居系統(tǒng)設(shè)計與安裝服務(wù)合同
- 2025微博微信廣告發(fā)布合同書
- 單位人力資源管理制度品讀選集
- 解碼國家安全智慧樹知到答案章節(jié)測試2023年國際關(guān)系學(xué)院
- 科研項目(課題)證明材料模板
- 2023簡約黃藍(lán)平安校園知識競賽PPT模板
- JJF 1999-2022轉(zhuǎn)子式流速儀校準(zhǔn)規(guī)范
- GB/T 39204-2022信息安全技術(shù)關(guān)鍵信息基礎(chǔ)設(shè)施安全保護(hù)要求
- JJG 736-1991氣體層流流量傳感器
- GB/T 6479-2013高壓化肥設(shè)備用無縫鋼管
- GB/T 6072.1-2008往復(fù)式內(nèi)燃機(jī)性能第1部分:功率、燃料消耗和機(jī)油消耗的標(biāo)定及試驗方法通用發(fā)動機(jī)的附加要求
- GB/T 17622-2008帶電作業(yè)用絕緣手套
- 企業(yè)年終總結(jié)大會PPT模板
- 2023年黑龍江公務(wù)員考試申論真題及答案
評論
0/150
提交評論