下載本文檔
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)
文檔簡介
1、Init_game macro op1,op2,op3,op4,op5,op6 mov cx,00h mov dh,op1 mov dl,op2 op6:mov ah,02h mov bh,00h int 10h push cx mov ah,0ah mov al,op3 mov bh,00h mov cx,01h int 10h pop cx inc cx inc op4 cmp cx,op5 jne op6 endm clear_screen macro op1,op2,op3,op4 ;本段程序主要是通過定義變量和調(diào)用實現(xiàn)清屏宏定義 mov ah,06h mov al,00h mov b
2、h,07h mov ch,op1 mov cl,op2 mov dh,op3 mov dl,op4 int 10h mov ah,02h mov bh,00h mov dh,00h mov dl,00h int 10h endm menu macro op1,op2,op3 ; 本段程序主要是通過定義變量和調(diào)用來實現(xiàn)菜單顯示宏定義 mov ah,02h mov bh,00h mov dh,op1 mov dl,op2 int 10h mov ah,09h lea dx,op3 int 21h endm data segment ZK db "WELCOME TO PLAY$"
3、; no db "date:2010-12-31$" meg db "press Enter key to continue.$" meg1 db "when a letter is dropping,please hit it!$" meg2 db "press space key to pause!$" meg3 db "press ESC key to return main interface!$" meg4 db "press letter 'E' to ex
4、it!$" speed dw 600d letters db "jwmilzoeucgpravskntxhdyqfb" db "iytpkwnxlsvxrmofzhgaebudjq" db "nwimzoexrphysfqtvdcgljukda" letters_bak db "jwmilzoeucgpravskntxhdyqfb" db "iytpkwnxlsvxrmofzhgaebudjq" db "nwimzoexrphysfqtvdcgljukda" let
5、ter_counter db 0 life_flag db 78 dup(0 position_flag db 78 dup(0 present_position db 1 data ends stack segment para stack 'stack' db 64 dup(0 stack ends code segment main proc far assume cs:code,ds:data,ss:stack start: mov ax,data mov ds,ax mov letter_counter,00h mov present_position,1 lea s
6、i,position_flag mov ah,00h mov cx,00h init_postion_flag: mov si,ah inc si inc cx cmp cx,78d jne init_postion_flag lea di,letters lea si,letters_bak mov cx,00h init_letters: mov ah,si mov di,ah inc si inc di inc cx cmp cx,78d jne init_letters mov ah,00h lea si,life_flag mov cx,00h init_life_flag: mov
7、 si,ah inc si inc cx cmp cx,78d jne init_life_flag mov cx,00h mov ah,01h or ch,00010000b int 10h clear_screen 00d,00d,24d,79d ; ; 本段程序主要是對菜單信息的宏調(diào)用 Init_game 00d,00d,0ah,dl,80d,nextsign1 Init_game 24d,00d,0ah,dl,80d,nextsign2 Init_game 00d,00d,0ah,dh,25 d,nextsign3 Init_game 00d,79d,0ah,dh,25d,nextsi
8、gn4 menu 05d,15d,ZK menu 07h,15d,no menu 09d,15d,meg menu 11d,15d,meg1 menu 13d,15d,meg2 menu 15d,15d,meg3 menu 17d,15d,meg4 put: mov ah,02h ;此段用來設(shè)置光標(biāo)位置 mov bh,00h mov dh,22d mov dl,33d int 10h mov ah,01h ;此段用來設(shè)置光標(biāo)位置 int 21h cmp al,0dh je speed3 cmp al,45h je exit exit: mov ah,4ch int 21h speed3: mo
9、v ax,speed+12 mov speed,ax jmp begin begin: clear_screen 01d,01d,23d,78d ;第二次使用清屏宏調(diào)用 clear_screen 01d,01d,23d,78d Init_game 23d,01d,01h,dl,78d,nextsign5 mov ah,02h mov bh,00h mov dh,01h mov dl,01h int 10h mov cx,00h lea si,letters nextletter: mov ah,02h ;用來示字母 mov dl,si int 21h inc si inc cx cmp cx,
10、78d je nextcycle jmp nextletter from_front: sub present_position,78d jmp gobackto_si find_zero: cmp letter_counter,78d je recycle cmp present_position,78d je from_one mov ah,00h nextsi: add present_position,01h inc si cmp si,ah je gobackto_di cmp present_position,78d je from_one jmp nextsi from_one:
11、mov present_position,01h jmp gobackto_si recycle: mov letter_counter,00h mov present_position,01d lea si,position_flag mov cx,00h mov ah,00h clearsi: mov si,ah inc cx cmp cx,78d je nextcycle inc si jmp clearsi nextcycle: lea di,letters lea si,position_flag add present_position,31d cmp present_positi
12、on,78 ja from_front gobackto_si: add si,word ptr present_position dec si mov ah,si cmp ah,01h je find_zero gobackto_di: mov ah,01h mov si,ah add di,word ptr present_position dec di mov dl,present_position mov ah,02h mov bh,00h mov dh,01h int 10h mov cx,00h nextrow: push cx mov cx,00h out_cycle: ;時間的
13、延遲 push cx mov cx,00h in_cycle: ;從鍵盤輸入字符 add cx,01h cmp cx,1000 jne in_cycle push dx mov ah,06h mov dl,0ffh int 21h pop dx jz pass cmp al,1bh ;如果鍵入ESC,則返回主菜單 je to_start1 cmp al," " ;如果 鍵入SPACE,則游戲暫停 je pause cmp al,di ;輸入字母正確!則字母消失 je disappear pass: pop cx inc cx cmp cx,speed je print jm
14、p out_cycle pause: push dx ;用來暫停處理 mov ah,06h mov dl,0ffh int 21h pop dx cmp al," " jne pause jmp pass to_start1: ;用于返回主菜單 jmp start print: mov ah,0ah ;在當(dāng)前光標(biāo)位置寫空格 mov al," " mov bh,00h mov cx,01h int 10h inc dh mov ah,02h ;用來改變光標(biāo)位置 mov bh,00h int 10h mov ah,0ah ;在當(dāng)前光標(biāo)位置寫字母 mov al
15、,di mov bh,00h mov cx,01h int 10h pop cx inc cx cmp cx,21d je print_next_letter jmp nextrow ;下一行 disappear: ;擊中字母后輸出空格 pop cx pop cx mov ah,0ah mov al," " mov bh,00h mov cx,01h int 10h jmp hit print_next_letter: lea si,life_flag add si,word ptr present_position dec si mov ah,0ah mov al,&qu
16、ot; " mov bh,00h mov cx,01h int 10h inc dh mov ah,02h mov bh,00h int 10h mov ah,0ah mov al," " mov bh,00h mov cx,01h int 10h mov ah,1 mov si,ah hit: mov ah,02h mov bh,00h mov dh,01h mov dl,present_position int 10h mov al,di ; 出現(xiàn)下一個新字母的數(shù)法 add al,7 cmp al,7ah ja convey_letter mov ah,0ah
17、 mov bh,00h mov cx,01h int 10h mov di,al add letter_counter,01h jmp nextcycle convey_letter: sub al,7ah add al,61h mov ah,0ah mov bh,00h mov cx,01h int 10h mov di,al add letter_counter,01h jmp nextcycle clear_screen 01,01,23,78 mov ah,02h mov bh,00h mov dh,11d mov dl,20d int 10h inc dh inc dh mov ah,02h mov bh,00h int 10h notkey: mov ah,07h int 21h cmp al,0dh je to_start cmp al,1bh je over jmp notkey to_start: clear_scre
溫馨提示
- 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)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 土地翻耕施工方案
- 生產(chǎn)車間消防施工方案
- 英雄聯(lián)盟網(wǎng)吧活動方案
- 無服務(wù)器架構(gòu)的優(yōu)化策略-深度研究
- 干部休養(yǎng)所產(chǎn)業(yè)生態(tài)構(gòu)建-深度研究
- 大氣氣溶膠對光污染的影響-深度研究
- 并購重組與深證綜指估值關(guān)系-深度研究
- 過街管施工方案
- 價格風(fēng)險管理理論與實務(wù)-深度研究
- 強(qiáng)化學(xué)習(xí)與金融市場預(yù)測-深度研究
- 我的家鄉(xiāng)瓊海
- (2025)專業(yè)技術(shù)人員繼續(xù)教育公需課題庫(附含答案)
- 《互聯(lián)網(wǎng)現(xiàn)狀和發(fā)展》課件
- 【MOOC】計算機(jī)組成原理-電子科技大學(xué) 中國大學(xué)慕課MOOC答案
- 2024年上海健康醫(yī)學(xué)院單招職業(yè)適應(yīng)性測試題庫及答案解析
- 2024年湖北省武漢市中考語文適應(yīng)性試卷
- 非新生兒破傷風(fēng)診療規(guī)范(2024年版)解讀
- EDIFIER漫步者S880使用說明書
- 上海市華東師大二附中2025屆高二數(shù)學(xué)第一學(xué)期期末統(tǒng)考試題含解析
- C語言程序設(shè)計PPT(第7版)高職完整全套教學(xué)課件
- 頭頸外科臨床診療指南2021版
評論
0/150
提交評論