字典匯編程序0001_第1頁(yè)
字典匯編程序0001_第2頁(yè)
字典匯編程序0001_第3頁(yè)
字典匯編程序0001_第4頁(yè)
字典匯編程序0001_第5頁(yè)
已閱讀5頁(yè),還剩22頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、實(shí)驗(yàn)報(bào)告實(shí)驗(yàn)?zāi)?的綜合運(yùn)用已學(xué)知識(shí)獨(dú) 立完成課程設(shè)計(jì),熟練掌握匯編語(yǔ)言程序 設(shè)計(jì)的基礎(chǔ)知識(shí)。 實(shí)驗(yàn)題 目簡(jiǎn)易英英詞典功能要求:1. 單詞及其英文解釋的錄入、修改和刪除( 1) 錄入的新單詞,把它 插入到相應(yīng)的位置 (和一般詞典一樣 );( 2) 可修改單詞英文解釋 ;( 3) 刪除單詞及其英文解 釋?zhuān)?. 查找:( 1) 輸入不完整的 字符串,會(huì)依順序列出單詞前綴和字符串 相匹配的單詞; 如輸入: en列出: enable, enabled, enact 等( 2) 查詢某個(gè)單 詞英文解釋 ( 如 enable: to provide with the means or opportunity

2、; to makepossible, practical, or easy) ,詞 庫(kù)中不存在此單詞,則提 示找不到;( 3) 查詢某個(gè)單詞的同義 詞 (如 accept: approve) ;( 4) 查詢某個(gè)單詞的反義 詞 (如 win: lose) ;3. 顯示: 界面美觀實(shí)驗(yàn)內(nèi) 容 一、數(shù)據(jù)文件結(jié)構(gòu)說(shuō) 明1、每個(gè)詞義(共 4個(gè)) 占 64字節(jié),近義詞占 64字節(jié),反義詞占 64字節(jié),均以 $結(jié) 束。2、單詞索引表置于文件 尾,每個(gè)索引項(xiàng)中單詞占 22 字節(jié)(包含結(jié)束符 $),單詞信息 塊位置信息占 2字節(jié) 。單詞索引表以空格組成的串為結(jié)束標(biāo)志 。3、文件最末尾的 6個(gè)字 節(jié),分別記錄單

3、詞索引表中單詞個(gè)數(shù)(包 含空格組成的串 ), 單詞索引表距文件首 的字節(jié)數(shù)(依次為高位字、低位字 )。一、功能模塊及主要 宏、函數(shù)1、查詢模塊( 1)、mycmps功能:字符串比較參數(shù): mycmpstab0 字符串 1 偏移地址 ; mycmpstab2 字符串 2 偏移地址。 返回: str1 str2 CF= 0,ZF= 0。 ( 2)、halfsearch功能:字符串查找( 折半)參數(shù): halfsearchtab 0 字符串緩沖區(qū)偏移地址; halfsearchtab 2 字符串個(gè)數(shù); halfsearchtab 4 查詢字符串偏移地址; halfsearchtab 6 字符串長(zhǎng)度。

4、返回:查找成功, CF=0 ,ax 返回匹配串的偏 移地址。 查找不成功, CF=1,ax 返回查詢串插入時(shí)偏移地址。2、顯示模塊( 1)、displayword功能:顯示單詞前綴 和字符串相匹配的單詞參數(shù): displaywordtab0 字符串緩沖區(qū)偏移地 址; displaywordtab2顯示字符串個(gè)數(shù);displaywordtab4displaywordtab8字符串長(zhǎng)度; displaywordtab6 亮行位置; 返回光標(biāo)位置; displaywordtab10 實(shí)際顯示字符串個(gè)數(shù)。返回:2)、 功能: 參數(shù):操作成功, displaywordtab10 返回實(shí)際顯示 字符串個(gè)數(shù)

5、,光標(biāo)位于 displaywordtab8 設(shè)置位置。readwordinfo讀取單詞解釋 、近義詞、反義詞信息readwordinfotab0 單詞信息塊位置; readwordinfotab2 存放信息塊緩沖區(qū) 偏移地址; readwordinfotab4 單詞信息塊大小。返回:操作成功,從 文件中讀取信息塊于主存偏移地址為 readwordinfotab2 緩沖區(qū)中。3)、 功能:4)、 功能: 參數(shù):showasentence 顯示一條單詞 信息 showwordinfo 顯示單詞信息 showwordinfotab0 showwordinfotab2 showwordinfotab4

6、 showwordinfotab6 showwordinfotab8單詞索引表中該單詞的偏移地址;單詞信息緩單詞信息塊返回光標(biāo)位實(shí)際顯示單沖區(qū)偏移地址; 大??; 置; 詞信息條數(shù)。操作成功,顯 示單詞信息, showwordinfotab8 返回實(shí)際顯示單詞 信息條數(shù), 光標(biāo)位于 showwordinfotab6 設(shè)置位置。3、編輯模塊 1)、indexinsert 功能: 參數(shù):返回:在單詞索引表 中插入一個(gè)單詞indexinserttab0單詞索引表偏移地址; indexinserttab2 單詞索引表單詞個(gè)數(shù);單詞大??; indexinserttab6 插入單詞的偏移地址; 插入位置偏移

7、地址。返回:(2)、功能:參數(shù): 數(shù);indexdeletetab4 刪除位置偏移地址。單詞索引表中 刪除一個(gè)單詞,完成索引表信息的維護(hù)。indexinserttab4indexinserttab8單詞索引表中 插入一個(gè)單詞,完成索引表信息的維護(hù)。 indexdelete在單詞索引表 中刪除一個(gè)單詞indexdeletetab0 單詞索引表偏移地址; indexdeletetab2 單詞索引表單詞個(gè)返回:3)、inputnewinfo 功能:接受新的單詞 信息 啞元: bufad 存放新的單詞信息的緩沖區(qū)偏移地址;maxindex 最大下標(biāo)值,信息中 字符個(gè)數(shù)減結(jié)束符減 1; charperl

8、ine 輸入時(shí)每行字符數(shù); specialpoint 鍵入 BackSpace 需 特殊處理的點(diǎn);wndb 窗口屬性; begincursor 接受字符起始光標(biāo)位置。4)、appdnewword 功能:添加新的單詞5)、editnotfind 功能:完成未找到匹 配單詞時(shí)的編輯(添加操作) 參數(shù): editnotfindtab 單詞插入索引表位置偏移地 址。6)、delallwordinfo 功能:刪除一個(gè)單詞 。7)、editfind 功能:完成找到匹配 單詞時(shí)的編輯(修改、刪除操作) 參數(shù): editfindtab 單詞插入索引表位置偏移地址 。4、文件處理模塊( 1)、createfil

9、e功能:創(chuàng)建文件參數(shù): createfiletab0 ASCIZ 串偏移地址; createfiletab2 文件屬性; createfiletab4 出錯(cuò)信息偏移地址; createfiletab6 返回文件代號(hào)。返回:操作成功, createfiletab6 返回文件代號(hào), CF=0 。 操作不成功, 輸出提示信息, CF=1。( 2)、openfile功能:打開(kāi)文件參數(shù): openfiletab 0 ASCIZ 串偏移地址; openfiletab 2 出錯(cuò)信息偏移地址。 返回:操作成功, handle 返 回文件代號(hào), CF=0。操作不成功, 輸出提示信息, CF=1。( 3)、mov

10、fp 功能:移動(dòng)文件指針 參數(shù): handle 文件代號(hào); movfptab 0 移動(dòng)方式碼; movfptab 2 偏移字節(jié)數(shù)(高位 );movfptab 4 偏移字節(jié)數(shù)(低位 ); movfptab 6 出錯(cuò)信息偏移地址。返回:操作成功, CF=0 。 操作不成功,輸出提 示信息, CF=1。( 4)、wrfile功能:讀 /寫(xiě)文件參數(shù): handle 文件代號(hào); wrfiletab 0 讀 / 寫(xiě);wrfiletab 2 數(shù)據(jù)緩沖區(qū) 偏移地址; wrfiletab 4 讀 /寫(xiě)字節(jié) 數(shù); wrfiletab 6 出錯(cuò)信息偏 移地址。返回:操作成功, CF=0 。 操作不成功,輸出提 示信

11、息, CF=1。5、繪制界面模塊( 1)、drawwnd功能:繪制窗口啞元: attribute 窗口屬性; wndleftr 左上角行號(hào); wndleftc 左上角列號(hào); wndrightr 右上角行號(hào); wndrihgtc 右上角行號(hào)。( 2)、setcursor 功能:設(shè)置光標(biāo)位置啞元: page 頁(yè)號(hào); row 行號(hào); colu mn 歹U號(hào);addp 頁(yè)號(hào)增量;addr 行號(hào)增量; addc 列號(hào)增量。(3) 、in terface功能:繪制界面(4) 、operdeclare功能:顯示操作說(shuō)明、程序流程圖dseg segmentdataindexelemsize equ 24 wo

12、rdmaxsize equ 23 wordinfosize equ 64 wordmeaningsize equ 384 Up equ 48hDown equ 50hLeft equ 4Bh BackSpace equ 08h KeyEsc equ 1bh Dollar equ 24h Enter equ 0dhdictionary db Weeds Dictionary 1.0$ inpmsg db Input the word:$ indexmsg db Index:$ welcomemsg db Welcome to use Weeds Dictionary 1.0$ pathmsg d

13、b Please input the path of words.dat$ escmsgdb Esc: exit$ entermsg db Enter: edit$ bslmsg db BackSpace and Left: step back$ upmsg db Up: line up$ downmsg db Down: line down$ meaningmsg db Meaning:$ synonymsmsg db Synonyms:$ antonymmsg db Antonym:$ nofindmsg0 dbNO FIND! _$ nofindmsg1 db PRESS ENTER T

14、O EDIT THE WORD! _$ editnotfindmsg db Append(A) $ appendmsg db Append:$ editfindmsg db Modify(M) Delete(D) $ modifymsg db Modify:$ deletemsg db Delete:$ optionmsg0 db Word(W) $ optionmsg1 db Meaning(M) Synonyms(S) $ optionmsg2 db Antonym(A) $ optretmsg db Return(R): $ operfinmsg db Operation has fin

15、ished! *_*$ retmsg db Enter R or r to return: $ nosynonymsmsg db no synonyms$ noantonymmsg db no antonym$ meaningnomsg db Meaning NO.(14): $ savechgmsgdb Save the information? Y/N $ delmsmsg db Delete the information? Y/N $ delnotemsg db LOSE ALL WORDS INFORMATION: Y/N $ mdfywdmsg db !_! REALLY TO D

16、O THAT: Y/N $ crefilmsg db ERROR: createfile()$ opefilmsg db ERROR: openfile()$ movfpmsg db ERROR: movfp()$ wrfilemsg db ERROR: wrfile()$ clsfilmsg db ERROR: closefile()$defaultpath db c:weeddic, 0 wndone1r db0 wndone1c db 0 wndone2r db24 wndone2c db 79 wndoneb db 96h barone1r db 1 barone1c db 0 bar

17、one2r db 1 barone2c db 79 baroneb db 70h bartwo1r db 2 bartwo1c db 31 bartwo2r db 24 bartwo2c db 31 bartwob db 70h wndtwo1r db 4 wndtwo1c db 3 wndtwo2r db 5 wndtwo2c db 26 wndtwob db 0fch wndthree1r db 9 wndthree1c db 3 wndthree2r db 22 wndthree2c db 26 wndthreeb db 0f2h wndfour1r db 4 wndfour1c db

18、36 wndfour2r db 22 wndfour2c db 75 wndfourb db 0fdh wndwel1r db 10 wndwel1c db20 wndwel2r db 14 wndwel2c db57 wndwelb db 0e0h wndeditb db 0f5h wndsaveb db 0edh wndeditnb db 0f6hmycmpstab dw 2 dup(?) ;str1ad str2ad halfsearchtab dw 4 dup(?) ;wordsad tablen searchwordad wordsize indexinserttab dw 5 du

19、p(?);indexad indexlen wordsize inswordad insertad indexdeletetab dw 4 dup(?);indexad indexlen wordsize deletead displaywordtab dw 7 dup(?);wordarrad displaynum wordsize lightline retcursor realdispnum showwordinfotab dw 5 dup(?);wordad wordinfoad wordinfosize nonemptynum returncursor readwordinfotab

20、 dw ? ;wordplaceinputpath db 37, 0 pathnamedb 37 dup(?) handle dw ? ;sharecreatefiletab dw 4 dup(?) openfiletab dw 2 dup(?) movfptab dw 4 dup(?) wrfiletab dw 4 dup(?) closefiletab dw ?;ascizad fileattribute msgad rethandle;pathname msgad;movfpway movfph movfpl msgad;w/r, bufferad size msgad;msgadfin

21、dflag dbcpyflag db ? editnotfindtab dw ?editflag db 0 editfindtab dw ?;insertplace;ifedit;deleteadindexinfo dw 3 dup(?) searchword db 23 dup(Dollar) wordmeaning label byte wordm1 db 64 dup(?) wordm2 db 64 dup(?) wordm3 db 64 dup(?) wordm4 db 64 dup(?) similar db 64 dup(?) opposite db64 dup(?)wordsin

22、dex db 10000 dup(?) dseg endsssegsegment stack stack db 256 dup(0)ssegendscseg segment code assumeds:dseg, ss:sseg, cs:cseg pushregister macro r1, r2, r3, r4 push r1 push r2 push r3 push r4endm popregister macro r1, r2, r3, r4pop r1 pop r2 pop r3 pop r4 endm drawwnd macro attribute, wndleftr, wndlef

23、tc, wndrightr, wndrihgtc pushregister ax, bx, cx, dx mov ax, 0600h mov bh, attribute mov ch, wndleftr mov cl, wndleftc mov dh, wndrightr mov dl, wndrihgtcint 10h popregister dx, cx, bx, axendm setcursor macro page, row, column, addp, addr, addc push ax push bx push dx mov ah,2 mov bh, page add bh, a

24、ddp mov dh, row add dh, addr mov dl, column add dl, addc int 10h pop dx pop bx pop axendm printc macro charpush ax push dx mov ah,2mov dl, char int 21h pop dx pop ax endm printstr macro strname push ax push dx mov ah, 9 mov dx, offset strname int 21h pop dx pop ax endm putstr macro straddrpush ax pu

25、sh dx mov ah, 9 mov dx, straddr int 21h pop dx pop axendminterface macrodrawwnd wndoneb, wndone1r, wndone1c, wndone2r, wndone2c drawwnd baroneb, barone1r, barone1c, barone2r, barone2c drawwnd bartwob, bartwo1r, bartwo1c, bartwo2r, bartwo2c drawwnd wndtwob, wndtwo1r, wndtwo1c, wndtwo2r, wndtwo2c draw

26、wnd wndthreeb, wndthree1r, wndthree1c, wndthree2r, wndthree2c drawwnd wndfourb, wndfour1r, wndfour1c, wndfour2r, wndfour2c setcursor 0, 0, 28, 0, 0, 0 printstr dictionarysetcursor 0, 3, 3, 0, 0, 0 printstr inpmsg setcursor 0, 8, 3, 0, 0, 0 printstr indexmsg endm operdeclare macrosetcursor 0, wndfour

27、1r, wndfour1c, 0, 1, 3 printstr escmsgsetcursor 0, wndfour1r, wndfour1c, 0, 2, 3 printstr entermsgsetcursor 0, wndfour1r, wndfour1c, 0, 3, 3 printstr bslmsgsetcursor 0, wndfour1r, wndfour1c, 0, 4, 3printstr upmsgsetcursor 0, wndfour1r, wndfour1c, 0, 5, 3printstr downmsgendmfirstuse macrowndwel2cdraw

28、wnd wndwelb, wndwel1r, wndwel1c, wndwel2r, setcursor 0, wndwel1r, wndwel1c, 0, 1,1 printstr welcomemsgsetcursor 0, wndwel1r, wndwel1c, 0, 2,2printstr pathmsgsetcursor 0, wndwel1r, wndwel1c, 0, 3,1mov ah, 0ahmov dx, offset inputpathint 21hmov bh, 0mov bl, inputpath1add bx, 2mov inputpathbx, 0mov crea

29、tefiletab0, offset defaultpathmov createfiletab2, 02mov createfiletab4, offset crefilmsgcall createfilemov ax, createfiletab6mov handle, axmov wrfiletab0, 4000hmov wrfiletab2, offset inputpath1mov wrfiletab4, bxmov wrfiletab6, offset crefilmsgcall wrfile mov closefiletab0, offset clsfilmsg call clos

30、efileendmnotfirstuse macromov wrfiletab0,mov wrfiletab2,mov wrfiletab4, mov wrfiletab6, call wrfile3f00hoffset inputpath11offset wrfilemsgmov wrfiletab2, offset pathnamemov ah, 0mov al, inputpath1mov wrfiletab4, ax call wrfilemov closefiletab0, offset clsfilmsgcall closefilesub wndwel2r, 2drawwnd wn

31、dwelb, wndwel1r, wndwel1c, wndwel2r, wndwel2c setcursor 0, wndwel1r, wndwel1c, 0, 1,1printstr welcomemsgadd wndwel2r, 2mov ah,1or ch, 20hint 10hmov ax, 3000hmov cx, 0ffffhtimedelay:timdly: loop timdlydecaxjnz timedelaymov ah,1mov ch, 0dhmov cl, chint 10hendmmain proc farmov ax, dsegmov ds,axmov es,a

32、xmov ax, 3 ;screeninitializeint 10hinterfacemov ax, 3d00hmov dx, offset defaultpathint 21hmov handle, axjc firsttimenotfirstusejmp dicstartfirsttime:firstusedicstart:interfacemov openfiletab0, offset pathname ;open words.datmov openfiletab2, offset opefilmsgcall openfilejc firsttime operdeclare setc

33、ursor 0, wndtwo1r, wndtwo1c, 0, 0, 3 movmovmovmovfptab0, 4202h movfptab2, 0ffffh movfptab4, 0fffah movfptab6,;read indexinformation:len addmov call movfp jc toclosefile mov wrfiletab0, mov wrfiletab2, mov wrfiletab4, mov wrfiletab6, call wrfileoffset movfpmsg3f00h offset indexinfo 6offset wrfilemsgj

34、c toclosefile;wordsindexmov movfptab0, 4200h mov dx, indexinfo4 mov movfptab2, dx mov cx, indexinfo2 mov movfptab4, cxcall movfpjc toclosefilemov ax, indexinfo0mov dx, indexelemsizemul dxcmp dx, 0jz readwordsindexsetcursor 0, wndfour1r, wndfour1c, 0, 1, 3 putstr openfiletab0jmp toclosefile readwords

35、index:mov wrfiletab2, offset wordsindex mov wrfiletab4, ax call wrfilejc toclosefile redwdindfin:;input search wordmov halfsearchtab0, offset wordsindex mov halfsearchtab4, offset searchword mov halfsearchtab6, indexelemsizemov displaywordtab2, 10mov displaywordtab4, wordmaxsize;not beyond 418hmov d

36、isplaywordtab8, 405hmov readwordinfotab2, offset wordm1 mov readwordinfotab4, wordmeaningsize mov showwordinfotab2, offset wordm1 mov showwordinfotab4, wordinfosizemov cx, 0mov si, 0mov findflag, 2 getchar:mov ah,0int 16hcmp al, KeyEsc jz escape cmp al, Enter jnz notenter cmp byte ptr findflag, 2 jz

37、 notentercmp byte ptr findflag, 1jnz calleditnotfindchar then di = 1mov di, 0 ;di is use to be a flag, if al is acall editfindjmp dealwithchar calleditnotfind:mov di, 0call editnotfindjmp dealwithchar notenter:cmp word ptr displaywordtab8, 418h ja notletter cmp al, Dollar jz notletter cmp al, 20h jb

38、 notletter cmp al, 7eh jbe isletter isletter:mov ah,2mov bh, 0mov dx, displaywordtab8int 10hmov ah,2mov dl, alint 21hmov di, 1 ;flagmov searchwordsi, alinc si dealwithchar:mov findflag, 1mov cpyflag, 1mov ax, indexinfo0decaxmov halfsearchtab2, axcall halfsearchjnc meaningdisplaymov findflag, 0mov cp

39、yflag, 0drawwnd wndfourb, wndfour1r, wndfour1c, wndfour2r, wndfour2c setcursor 0, wndfour1r, wndfour1c, 0, 1, 3printstr nofindmsg0setcursor 0, wndfour1r, wndfour1c, 0, 3, 3printstr nofindmsg1jmp wordsdisplay meaningdisplay:mov editfindtab, axmov bx, ax ;(ax) is the correct position after call halfse

40、archmov bx, bx+22mov readwordinfotab0, bxcall readwordinfomov showwordinfotab0, axmov bx, displaywordtab8mov showwordinfotab8, bxcall showwordinfomov cx, 0 wordsdisplay:mov editnotfindtab, axmov displaywordtab0, axmov displaywordtab6, 0add displaywordtab8, dicall displaywordjmp getchar notletter:cmp

41、 al, BackSpacejnz notbackspace isbackspace:cmp si, 0jle notbackspacedecsimov searchwordsi, Dollarmov ax, 0600hmov bh, wndtwob dec displaywordtab8 mov cx, displaywordtab8 mov dx, cx int 10h mov ah, 2 mov bh, 0mov dx, displaywordtab8 int 10hmov cx, 0mov di, 0jmp dealwithchar notbackspace:cmp ah, Upjnz

42、 notupcmp cx, 0jle notupdeccxjmp changeline notup:cmp ah, Downjnz notdowncmp cx, displaywordtab10 jge notdown inc cx jmp changeline notdown:cmp ah, Leftjz isbackspacejmp getchar changeline:mov displaywordtab6, cx call displaywordmov bx, displaywordtab0 mov ax, cx cmp cx, 0 jnz chglinenextnz mov dl,

43、cpyflag mov findflag, dl jmp chglinenextz chglinenextnz:mov findflag, 1decaxchglinenextz:mov dx, indexelemsizemul dxadd bx, axmov ax, bx+22mov readwordinfotab0, ax call readwordinfomov showwordinfotab0, bx mov ax, displaywordtab8 mov showwordinfotab8, ax call showwordinfo mov editfindtab, bx jmp get

44、charescape:mov movfptab0, 4200hmov ax, indexinfo2mov dx, indexinfo4mov movfptab2, dxmov movfptab4, axcall movfpmov wrfiletab0, 4000hmov wrfiletab2, offset wordsindexmov ax, indexinfo0mov dx, indexelemsize mul dxmov wrfiletab4, axmov wrfiletab6, offset wrfilemsg call wrfile mov wrfiletab2, offset ind

45、exinfo mov wrfiletab4, 6 call wrfilemov movfptab0, 4202hmov movfptab2, 0ffffhmov movfptab4, 0fffahcall movfpcall wrfile toclosefile:mov closefiletab, offset clsfilmsg call closefileexit:mov ax, 4c00h ;exit to operating system. int 21hmain endp displayword proc near ;wordarrad displaynum wordsize lig

46、htline retcursor realdispnum pushregister ax, bx, cx, dx push sidrawwnd wndthreeb, wndthree1r, wndthree1c, wndthree2r, wndthree2c mov bx, displaywordtab6 cmp bx, 0 jle todisplayindex decbx mov ax, 0600h mov ch, wndthree1r add ch, bl mov cl, wndthree1c mov dh, ch mov dl, wndthree2c mov bh, 0b2h int 1

47、0h todisplayindex:mov bx, displaywordtab0 ;indexadcmp byte ptr bx, 20h jz displayfinish mov si, 0 mov cx, 0 mov dh, wndthree1r mov dl, 5 displayindex:cmp cx, displaywordtab2 ;diplaynum jge displayfinish push bx mov ah, 2 mov bh, 0 int 10h pop bx push dx mov dx, bx add dx, simov ah, 9 int 21h pop dx

48、inc cx add si, displaywordtab4;wordsizeinc sicmp byte ptr bx+si, 20h jz displayfinish inc dhjmp displayindexdisplayfinish:mov ah, 2mov dx, displaywordtab8mov bh, 0int 10hmov displaywordtab10, cxpop si popregister dx, cx, bx, ax retdisplayword endpreadwordinfo proc near ;wordplace wordmeanad wordmean

49、size push ax push dxmov ax, readwordinfotab0mov dx, wordmeaningsize mul dxmov movfptab2, dxmov movfptab4, ax call movfpmov ax, readwordinfotab2mov dx, readwordinfotab4mov wrfiletab0, 3f00hmov wrfiletab2, axmov wrfiletab4, dxcall wrfilepop dxpop axret readwordinfo endp showasentence macro ;accessoria

50、l macrolocal printchar, print, nextsentencemov si, 0mov di, 34printchar:;because somesentence is too longcmp byte ptr bx+si, Dollarjz nextsentencecmp si, dijle printinc clsetcursor 0, wndfour1r, wndfour1c, 0, cl, 3 add di, 34print:mov ah, 2mov dl, bx+siint 21hinc sijmp printchar nextsentence: endm s

51、howwordinfo proc near ;wordad wordinfoad wordinfosize returncursor, nonemptynum略showwordinfo endpmycmps proc near ;str1str2 cf=0 and zf=0 pushregister si, di, dx, axmov si, mycmpstab0 ;offset str1mov di, mycmpstab2 ;offset str2mov dh, 50strcmp:cmp byte ptr si, Dollar;25hlahfmov al, ahcmp byte ptr di

52、, Dollar;25hlahfand al, 41hand ah, 41hcmp ah, aljnz strcmpfinishcmp ah, 40hjnz strcmpcontinuexor ah, ahjmp strcmpfinish strcmpcontinue:mov dl, sicmp dl, dijz strcmpnextjmp strcmpfinish strcmpnext:inc siinc didecdhjnz strcmp strcmpfinish:popregister ax, dx, di, siret mycmps endp halfsearch proc nearp

53、ush si ;low push di ;high push dxmov dx, 0;swordad;wordsadmov si, halfsearchtab4 mov mycmpstab0, si mov si, halfsearchtab0 mov mycmpstab2, si call mycmps jb nofind ja chklast mov ax, si clc jmp hsfinish chklast:mov ax, halfsearchtab2 decaxmul halfsearchtab6 mov di, ax add di, si mov mycmpstab2, di c

54、all mycmps jb search ja lastnofind mov ax, di clc jmp hsfinish search:mov ax, di sub ax,si div halfsearchtab6 shr ax, 1 mul halfsearchtab6 add ax, si mov mycmpstab2, ax call mycmps jb midgreater ja midless clc jmp hsfinish midless:mov si, ax add si, halfsearchtab6jmp hsnextmidgreater:mov di, axsub di, halfsearchtab6hsnext:cmp si, dijbe searchlastnofind:mov ax, di ;ax the correct positionadd ax, halfsearchtab6stcjmp hsfinishnofind:mov ax, sistchsfinish:pop dxpop dipop sirethalfsearch endpindexinsert proc nearpushregister ax, dx, si, dimov

溫馨提示

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

評(píng)論

0/150

提交評(píng)論