班級通信錄管理系統(tǒng)的設計與實現(xiàn)匯編語言課程實習報告_第1頁
班級通信錄管理系統(tǒng)的設計與實現(xiàn)匯編語言課程實習報告_第2頁
班級通信錄管理系統(tǒng)的設計與實現(xiàn)匯編語言課程實習報告_第3頁
班級通信錄管理系統(tǒng)的設計與實現(xiàn)匯編語言課程實習報告_第4頁
班級通信錄管理系統(tǒng)的設計與實現(xiàn)匯編語言課程實習報告_第5頁
已閱讀5頁,還剩16頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領

文檔簡介

1、 匯編語言課程實習報告實習題目 班級通信錄管理系統(tǒng)的設計與實現(xiàn)學生姓名 班級(學號) 院系 信息學院計算機系指導老師 葉曉霞提交時間 班級通信錄管理系統(tǒng)的設計與實現(xiàn)1.需求說明: 建立一個班級通信錄,可以實現(xiàn)添加、刪除、修改、查詢一個同學的通信記錄;顯示所有同學的通信記錄;能根據(jù)姓名或宿舍號進行排序。通信錄包括學號、姓名、電話號碼、宿舍號等信息,所有信息最終用文件保存。2.設計說明:以參數(shù)形式建立個人的文件,如:你名字為cac,則調(diào)用tongxun.exe文件時,以cac為參數(shù),你應輸入c: tongxun cac,這樣就建立了一個cac的文件記錄你收藏的通信資料。將段前綴的說明部分單獨作為一

2、段,并將ds固定指向該段;其他數(shù)據(jù)單元(提示信息等)另設一段,以es固定指向該段,在引用該段變量時加上es段前綴即可。3.詳細的算法描述: 3.1 程序界面 如上圖,0-8八個選項分別實現(xiàn)不同的功能。依次是增加、刪除、修改、查詢、顯示全部信息、生成、按名排列、按寢室排序、退出。3.2 程序思想 在這個實驗中,主要的就是子程序的應用這方面,其中修改,刪除的子程序都以查找核心算法為基礎。這方面的鋪墊工作做好后再做好每一塊的工作,最后檢查下,程序就能完好的運行了。4.源程序與執(zhí)行結(jié)果: 4.1.主要程序代碼: dataseg segmenttitlestrdbstudent no. name pho

3、ne dormitory ,0dh,0ah,$titlelen equ $ - titlestritemrowdbtitlelen dup ( ),0dh,0ah,$handledw?showindb0memptrdw?searchnumberdb20dup( )searchstrdb30dup( )searchphonedb20dup( )searchdormdb20dup( )searchndb0exactmatchdb0inputbufdb34actlendb?inputstrdb34dup( )infomsg1dbinfo: give your command below ,0dh,0

4、ah,$ infomsg2dbwarning: unrecognized command,type again ,0dh,0ah,$ infomsg3dbinfo: input your name below ,0dh,0ah,$ infomsg4dbinfo: input your phone number below ,0dh,0ah,$ infomsg5dbinfo: input the number of item below ,0dh,0ah,$ infomsg6dbinfo: input your student no. below ,0dh,0ah,$ infomsg7dbinf

5、o: input your dormitory number below ,0dh,0ah,$ msgemptydb,0dh,0ah,$ msg0 db=,0dh,0ah db| |,0dh,0ah db| welcome to use address list 0.1 alpha |,0dh,0ah db| |,0dh,0ah db=,0dh,0ah,$msgmenu db0dh,0ah db-,0dh,0ah dbplease choose an operation:(0-8),0dh,0ah db1- add 2- delete 3- modify,0dh,0ah db4- query

6、5- list 6- create,0dh,0ah db7- sort(name) 8- sort(dorm) 0- exit ,0dh,0ah db-,0dh,0ah,$ msgblank db ,$ pathname dbaddress.txt,0 msg1 db cannot find address.txt ,0dh,0ah,$ msg2 db program will create the file address.txt ,0dh,0ah,$ msg4 db open file successfully ,0dh,0ah,$ msg5 db create file fail ,0d

7、h,0ah,$ msg6 db program terminate ,0dh,0ah,$ msg7 db create file successfully ,0dh,0ah,$ msg8 db read file failed,exit ,0dh,0ah,$ msg9 db write file failed,exit ,0dh,0ah,$ msgfind db the item you found is: ,0dh,0ah,$ msgferr db cannot find the item ,0dh,0ah,$ msgferr2 db check your input! ,0dh,0ah,$

8、msglen equ$ - msgferr2;file buffer recordsizeequ20+30+20+20 filebufdb0 itemlistdb10 dup(20 dup(0),30 dup(0),20 dup(0),20 dup(0)dataseg endscodeseg segmentassume cs:codeseg,ds:dataseg,es:dataseg,ss:datasegmainprocfarpush dsxor ax,axpush axmov ax,datasegmov ds,axmov es,axlea dx,msg0call showmsgcall fi

9、ndfilecall getcommandretmainendpshowmsgprocnearmov ah,9int 21hretshowmsgendpgetcommandprocneargcinput:lea dx,msgmenumov ah,9int 21hmov ah,7 ; get inputint 21hgetcom:cmp al,1jne gc2call additemjmp gcinputgc2:cmp al,2jne gc3call delitemjmp gcinputgc3:cmp al,3jne gc4call edititemjmp gcinputgc4:cmp al,4

10、jne gc5call queryitemjmp gcinputgc5:cmp al,5jne gc6call listitemsjmp gcinputgc6:cmp al,6jne gc7call createfilejmp gcinputgc7:cmp al,7jne gc8call sortnamejmp gcinputgc8:cmp al,8jne gc9call sortdormjmp gcinputgc9:cmp al,0jne gc10call closefileretgc10:jmp gcinputgcexit:retgetcommandendpadditem proc nea

11、rcall getnumbercall getnamecall getphonecall getdormlea di,filebuf ;content starts here inc di mov al,filebuf mov bl,recordsize mul bl add di,ax addstr: lea si,searchnumber mov cx,20 cld rep movsb lea si,searchstr mov cx,30 cld rep movsb mov cx,20 lea si,searchphone cld rep movsb lea si,searchdorm m

12、ov cx,20 cld rep movsb inc filebufretadditem endpgetnumber proc near lea dx,infomsg6 mov ah,9 int 21hgetno: mov ah,0ah lea dx,inputbuf int 21h cmp actlen,0 jbe getno cmp actlen,20 jbe getnonext mov actlen,20getnonext: mov cl,actlen mov ch,0 lea si,inputstr lea di,searchnumber cld rep movsb retgetnum

13、ber endpgetname proc nearlea dx,infomsg3 mov ah,9 int 21hgetn: mov ah,0ah lea dx,inputbuf int 21h cmp actlen,0 jbe getn cmp actlen,20 jbe getnnext mov actlen,20getnnext: mov cl,actlen mov ch,0 lea si,inputstr lea di,searchstr cld rep movsb retgetname endpgetphone proc near lea dx,infomsg4 mov ah,9 i

14、nt 21hgetp: mov ah,0ah lea dx,inputbuf int 21h cmp actlen,0 jbe getp cmp actlen,20 jbe getpnext mov actlen,20getpnext: mov cl,actlen mov ch,0 lea si,inputstr lea di,searchphone cld rep movsb retgetphone endpgetdorm proc nearlea dx,infomsg7 mov ah,9 int 21hgetd: mov ah,0ah lea dx,inputbuf int 21h cmp

15、 actlen,0 jbe getd cmp actlen,20 jbe getdnext mov actlen,20getdnext: mov cl,actlen mov ch,0 lea si,inputstr lea di,searchdorm cld rep movsb retgetdorm endpsearchprocnearmov exactmatch,0lea si,filebufmov al,siinc simov di,sisub di,recordsizepush disealoop:pop di ; cuz cmpsb chaned it, so restoreadd d

16、i,recordsizelea si,searchnumberpush didec almov cx,20cldrepe cmpsbjne seanextmov exactmatch,1sub di,20mov memptr,dijmp searetseanext:cmp al,0jne sealoopsearet:retsearchendpdelitem proc nearcall getnumbercall searchcmp exactmatch,1jne delretmov bl,filebufmov si,memptrdelloop:mov di,siadd si,recordsiz

17、ecldrep movsbdec bljnz delloopdec filebufdelret:retdelitem endpedititem proc nearcall getnumbercall searchcmp exactmatch,1jne editretcall getnamecall getphonecall getdormmov di,memptr editstr: lea si,searchnumber mov cx,20 cld rep movsb lea si,searchstr mov cx,30 cld rep movsb mov cx,20 lea si,searc

18、hphone cld rep movsb lea si,searchdorm mov cx,20 cld rep movsb editret:retedititem endpqueryitem proc nearcall getnumbercall searchcmp exactmatch,1jne queryretmov si,memptrlea di,itemrowmov cx,16rep movsbadd si,4mov cx,16rep movsbadd si,14mov cx,16rep movsbadd si,4mov cx,16rep movsbmov ah,9lea dx,it

19、emrowint 21hqueryret:retqueryitem endplistitems proc nearlea dx,titlestrcall showmsglea si,filebufcmp filebuf,0je listemptymov bl,filebufinc sisub si,recordsizelistloop:add si,recordsizelea di,itemrowmov cx,16rep movsbadd si,4mov cx,16rep movsbadd si,14mov cx,16rep movsbadd si,4mov cx,16rep movsbmov

20、 ah,9lea dx,itemrowint 21hdec blcmp bl,0jne listloopretlistempty:lea dx,msgemptymov ah,9int 21hretlistitems endpcreatefile proc nearmov ah,3chmov cx,0lea dx,pathnameint 21hlea dx,msg7call showmsgretcreatefile endpsortname proc nearretsortname endpsortdorm proc nearretsortdorm endpreadfile proc nearm

21、ov ah,3fhmov bx,handlemov cx,1+recordsize*10lea dx,filebufint 21hsub filebuf,30hretreadfile endpclosefile proc nearmov ah,42hmov al,0mov bx,handlemov cx,0mov dx,0int 21hlea dx,filebufmov bx,handlemov cx,1+10*recordsizemov ah,40hint 21hmov ah,3ehint 21hcall exitproretclosefile endpfindfile proc near;

22、find file ,exist open not exist ,creat mov ah,3dh mov al,2 lea dx,pathname int 21h jc fif ;jump when file not exist mov handle,ax call readfile lea dx,msg4 call showmsg ret fif: lea dx,msg1 call showmsg lea dx,msg2 call showmsg mov ah,3ch mov al,0 mov cx,0 lea dx,pathname int 21h jc ffwrong mov handle,ax lea dx,msg7 ;create file call showmsg call fillitem ret ffwrong: lea dx,msg5 call showmsg lea dx,msg6 call showmsg call exitpro ;exit when creat failedfindfile endpfillitem proc nea

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
  • 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論