新汇编语言程序设计-课程设计-打字练习游戏-源程序

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

;=================打字游戏===============;制作人:王涛;制作日期:2011/06/24;========================================;宏名:INIT_GAME;功能描述:初始化游戏;入口参数:;OP1:设置光标行号;OP2:设置光标列号;OP3:在光标处显示的字符;OP4:未知;OP5:未知;OP6:跳转的标号INIT_GAMEMACROOP1,OP2,OP3,OP4,OP5,OP6MOVCX,00HMOVDH,OP1MOVDL,OP2OP6:MOVAH,02HMOVBH,00HINT10HPUSHCXMOVAH,0AHMOVAL,OP3MOVBH,00HMOVCX,01HINT10HPOPCXINCCXINCOP4CMPCX,OP5JNEOP6ENDM;功能描述:初始化屏幕;参数:(OP1,OP2)为左上角坐标;(OP3,OP4)为右下角坐标CLEAR_SCREENMACROOP1,OP2,OP3,OP4MOVAH,06HMOVAL,00HMOVBH,07HMOVCH,OP1MOVCL,OP2MOVDH,OP3MOVDL,OP4INT10HMOVAH,02HMOVBH,00HMOVDH,00HMOVDL,00HINT10HENDMMENUMACROOP1,OP2,OP3MOVAH,02HMOVBH,00HMOVDH,OP1MOVDL,OP2INT10HMOVAH,09HLEADX,OP3INT21HENDMDATASEGMENTLINJIANGDBMADEBYwangtao$NODBNO:2011/06/24$MEGDBLet'sstart!!!$MEG1DB**SELECTMENU**$MEG2DBPLEASESELECTTHEGAMESPEED,ESCTOQUIT.$MEG3DB1.VERYSLOW$MEG4DB2.SLOW$MEG5DB3.NOMAL$MEG6DB4.FAST$MEG7DB5.VERYFAST$MEG8DB6.FASTEST$MEG9DB*SELECTTHENUMBERANDPRESSENTERTOSTART!*$MEG10DBGAMESPEED:$HOTKEYDBWHENYOUAREPLAYINGGAMES:$HOTKEY1DBESCTORETURNTOMENU$HOTKEY2DBSPACETOPAUSETHEGAME$HOTKEY3DBPRESSANYKEYTOPLAYGAMES......$HOTKEY4DBAREYOUREADY??$FAILMEGDBTHELETTERISARRIVETHEBOTTOM,YOULOSE!*.*$FAILMEG0DBPRESSENTERTOGOON......$FAILMEG1DBGAMEISOVER!$FAILMEG2DBPRESSENTERTORETURNMENUANDPRESSESCTOEXIT!$FAILMEG3DBBYE-BYE!THANKFORYOURPLAYING!!$FAILMEG4DBPRESSANYKEYTOQUIT......$SPEEDDW00D,2400D,2000D,1600D,1200D,800D,600DLETTERSDBJWMILZOEUCGPRAVSKNTXHDYQFBDBIYTPKWNXLSVXRMOFZHGAEBUDJQDBNWIMZOEXRPHYSFQTVDCGLJUKDALETTERS_BAKDBJWMILZOEUCGPRAVSKNTXHDYQFBDBIYTPKWNXLSVXRMOFZHGAEBUDJQDBNWIMZOEXRPHYSFQTVDCGLJUKDALETTER_COUNTERDB0LIFE_FLAGDB78DUP(0)POSITION_FLAGDB78DUP(0)PRESENT_POSITIONDB1DATAENDSSTACKSEGMENTPARASTACK'STACK'DB64DUP(0)STACKENDSCODESEGMENTMAINPROCFARASSUMECS:CODE,DS:DATA,SS:STACKSTART:MOVAX,DATAMOVDS,AXMOVLETTER_COUNTER,00HMOVPRESENT_POSITION,1LEASI,POSITION_FLAGMOVAH,00HMOVCX,00HINIT_POSTION_FLAG:MOV[SI],AHINCSIINCCXCMPCX,78DJNEINIT_POSTION_FLAGLEADI,LETTERSLEASI,LETTERS_BAKMOVCX,00HINIT_LETTERS:MOVAH,[SI]MOV[DI],AHINCSIINCDIINCCXCMPCX,78DJNEINIT_LETTERSMOVAH,00HLEASI,LIFE_FLAGMOVCX,00HINIT_LIFE_FLAG:MOV[SI],AHINCSIINCCXCMPCX,78DJNEINIT_LIFE_FLAGMOVCX,00HMOVAH,01HORCH,00010000BINT10HCLEAR_SCREEN00D,00D,24D,79DINIT_GAME00D,00D,0AH,DL,80D,NEXTSIGN1INIT_GAME24D,00D,0AH,DL,80D,NEXTSIGN2INIT_GAME00D,00D,0AH,DH,25D,NEXTSIGN3INIT_GAME00D,79D,0AH,DH,25D,NEXTSIGN4MENU01D,15D,MEG;菜单信息的宏展开MENU01H,61D,LINJIANGMENU03D,20D,MEG1MENU03D,68D,NOMENU05D,15D,MEG2MENU07D,15D,MEG3MENU09D,15D,MEG4MENU11D,15D,MEG5MENU13D,15D,MEG6MENU15D,15D,MEG7MENU17D,15D,MEG8MENU19D,15D,MEG9MENU22D,15D,MEG10INPUT:MOVAH,02HMOVBH,00HMOVDH,22DMOVDL,33DINT10HMOVAH,0AHMOVAL,MOVBH,00HMOVCX,01HINT10HMOVAH,01HINT21HRETRY:CMPAL,1JESPEED1CMPAL,2JESPEED2CMPAL,3JESPEED3CMPAL,4JESPEED4CMPAL,5JESPEED5CMPAL,6JESPEED6CMPAL,1BHJETO_OVER0JMPINPUTTO_OVER0:JMPOVERSPEED1:MOVAH,01HINT21HCMPAL,0DHJNEOTHERKEYMOVAX,SPEED+2MOVSPEED,AXJMPBEGINSPEED2:MOVAH,01HINT21HCMPAL,0DHJNEOTHERKEYMOVAX,SPEED+4MOVSPEED,AXJMPBEGINSPEED3:MOVAH,01HINT21HCMPAL,0DHJNEOTHERKEYMOVAX,SPEED+6MOVSPEED,AXJMPBEGINSPEED4:MOVAH,01HINT21HCMPAL,0DHJNEOTHERKEYMOVAX,SPEED+8MOVSPEED,AXJMPBEGINSPEED5:MOVAH,01HINT21HCMPAL,0DHJNEOTHERKEYMOVAX,SPEED+10MOVSPEED,AXJMPBEGINSPEED6:MOVAH,01HINT21HCMPAL,0DHJNEOTHERKEYMOVAX,SPEED+12MOVSPEED,AXJMPBEGINOTHERKEY:;处理重复输入的代码段PUSHAXMOVAH,02HMOVBH,00HMOVDH,22DMOVDL,34DINT10HMOVAH,0AHMOVAL,MOVBH,00HMOVCX,01HINT10HMOVAH,02HMOVBH,00HMOVDH,22DMOVDL,33DINT10HPOPAXMOVDX,AXMOVAH,02HINT21HJMPRETRYBEGIN:CLEAR_SCREEN01D,01D,23D,78DMENU08D,20D,HOTKEYMENU10D,20D,HOTKEY1MENU12D,20D,HOTKEY2MENU14D,20D,HOTKEY4MENU16D,20D,HOTKEY3MOVAH,07HINT21HCLEAR_SCREEN01D,01D,23D,78DINIT_GAME23D,01D,01H,DL,78D,NEXTSIGN5MOVAH,02H;光标初始化MOVBH,00HMOVDH,01HMOVDL,01HINT10HMOVCX,00HLEASI,LETTERSNEXTLETTER:;初始化屏幕上方的字母MOVAH,02HMOVDL,[SI]INT21HINCSIINCCXCMPCX,78DJENEXTCYCLEJMPNEXTLETTERFROM_FRONT:;相关循环的算法SUBPRESENT_POSITION,78DJMPGOBACKTO_SIFIND_ZERO:CMPLETTER_COUNTER,78DJERECYCLECMPPRESENT_POSITION,78DJEFROM_ONEMOVAH,00HNEXTSI:ADDPRESENT_POSITION,01HINCSICMP[SI],AHJEGOBACKTO_DICMPPRESENT_POSITION,78DJEFROM_ONEJMPNEXTSIFROM_ONE:MOVPRESENT_POSITION,01HJMPGOBACKTO_SIRECYCLE:MOVLETTER_COUNTER,00HMOVPRESENT_POSITION,01DLEASI,POSITION_FLAGMOVCX,00HMOVAH,00HCLEARSI:MOV[SI],AHINCCXCMPCX,78DJENEXTCYCLEINCSIJMPCLEARSINEXTCYCLE:LEADI,LETTERSLEASI,POSITION_FLAGADDPRESENT_POSITION,31DCMPPRESENT_POSITION,78JAFROM_FRONTGOBACKTO_SI:ADDSI,WORDPTRPRESENT_POSITIONDECSIMOVAH,[SI]CMPAH,01HJEFIND_ZEROGOBACKTO_DI:MOVAH,01HMOV[SI],AHADDDI,WORDPTRPRESENT_POSITIONDECDIMOVDL,PRESENT_POSITIONMOVAH,02H;字母下落的代码段部分MOVBH,00HMOVDH,01HINT10HMOVCX,00HNEXTROW:PUSHCX;新的一行MOVCX,00HOUT_CYCLE:;延迟PUSHCXMOVCX,00HIN_CYCLE:ADDCX,01HCMPCX,50000DJNEIN_CYCLEPUSHDXMOVAH,06HMOVDL,0FFHINT21HPOPDXJZPASS;如果键盘缓冲区部分为空,则跳转CMPAL,1BH;如果键入ESC,则返回主菜单JETO_START1CMPAL,;如果键入SPACE,则游戏暂停JEPAUSECMPAL,[DI];输入字母正确!跳转!JEDISAPPEARPASS:POPCXINCCXCMPCX,SPEEDJEPRINTJMPOUT_CYCLEPAUSE:PUSHDX;暂停处理MOVAH,06HMOVDL,0FFHINT21HPOPDXCMPAL,JNEPAUSEJMPPASSTO_START1:;返回主菜单JMPSTARTPRINT:MOVAH,0AHMOVAL,MOVBH,00HMOVCX,01HINT10HINCDHMOVAH,02HMOVBH,00HINT10HMOVAH,0AHMOVAL,[DI

1 / 32
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功