【精品】推箱子游戏汇编源程序18.doc

上传人:laozhun 文档编号:3026318 上传时间:2023-03-09 格式:DOC 页数:31 大小:98.50KB
返回 下载 相关 举报
【精品】推箱子游戏汇编源程序18.doc_第1页
第1页 / 共31页
【精品】推箱子游戏汇编源程序18.doc_第2页
第2页 / 共31页
【精品】推箱子游戏汇编源程序18.doc_第3页
第3页 / 共31页
【精品】推箱子游戏汇编源程序18.doc_第4页
第4页 / 共31页
【精品】推箱子游戏汇编源程序18.doc_第5页
第5页 / 共31页
点击查看更多>>
资源描述

《【精品】推箱子游戏汇编源程序18.doc》由会员分享,可在线阅读,更多相关《【精品】推箱子游戏汇编源程序18.doc(31页珍藏版)》请在三一办公上搜索。

1、; 推箱子游戏汇编源程序; ;-up EQU 48h ;定义扫描码down EQU 50hLEft EQU 4bhright EQU 4dhF1 EQU 3bhF2 EQU 3chF3 EQU 3dhF4 EQU 3ehF5 EQU 3fhF8 EQU 42h;-;宏定义;- setpos MACRO x0,y0;设置光标位置 MOV BH,0 MOV DH,x0 MOV DL,y0 MOV AH,2 INT 10h ENDM;-show_char MACRO x,y,attr,CHa,no ;显示字符,x,y为坐标,attr为属性, PUSH CX;cha为字符ASCII码,no为重复次数

2、setpos x,y MOV AL,CHa MOV BL,attr MOV CX,no MOV AH,09h INT 10h POP CX ENDM;- INitchar MACRO cno,pno ;初始化字符,cno为字符串,pno为行数 LEA BP,cno MOV CX,15 MOV DH,pno MOV DL,51 MOV BL,00000010b MOV AL,1 MOV AH,13h INT 10h ENDM;- INitstor MACRO cno,pno;初始化仓库,cno为字符串,pno为行数 LEA BP,cno MOV CX,20 MOV DH,pno MOV DL,2

3、0 MOV BL,00001011b MOV AL,1 MOV AH,13h INT 10h ENDM;-DIsplaymsg MACRO msg PUSH AX PUSH BX PUSH CX PUSH DX PUSH DI MOV AH,13h MOV AL,0 MOV BL,00000100b MOV BP,OFFSET msg MOV CX,51 MOV BH,0 MOV DH,23 MOV DL,3 INT 10h POP DI POP DX POP CX POP BX POP AX ENDM;- setcolor MACRO no MOV AH,0bh MOV BH,00 MOV

4、BL,no INT 10hENDM;*;* 堆栈段 ;*STACK_SEG SEGMENT STACK;= STACK_BUF DW 120 DUP(?) TOP EQU $-STACK_BUFSTACK_SEG ENDS;= ;*DATA_SEG SEGMENT PARA;=s1 DB 201,9,40 DUP(205,9),203,9,19 DUP(205,9),187,9;s1-s3为画边框s2 DB 186,9,40 DUP( ,9),186,9,19 DUP( ,9),186,9s3 DB 200,9,40 DUP(205,9),202,9,19 DUP(205,9),188,9s4

5、 DB F1:, ,Start Game;s4-s12为功能说明s5 DB F2:, ,Save s6 DB F3:, ,Load s7 DB F4:, ,Select s8 DB F5:, ,Option s9 DB F8:, ,Quit s10 DB No.:, s11 DB Game, ,Time:, s12 DB Current, ,Time:, GameName DB Hammal Game;游戏名ying DB 11 DUP(223) ;阴影 g1 DB 20 DUP(177);g1-g8为仓库ASCII码定义g2 DB 2 DUP(177),4 DUP( ),4 DUP(177)

6、,4 DUP( ),6 DUP(177)g3 DB 2 DUP(177),16 DUP( ),2 DUP(177)g4 DB 2 DUP(177),4 DUP(176),4 DUP(177),2 DUP(234),2 DUP(219),4 DUP( ),2 DUP(177)g5 DB 2 DUP(177),4 DUP(176),4 DUP(177),2 DUP( ),2 DUP(219),4 DUP( ),2 DUP(177)g6 DB 2 DUP(177),16 DUP( ),2 DUP(177)g7 DB 2 DUP(177),4 DUP( ),4 DUP(177),4 DUP( ),6

7、DUP(177)g8 DB 20 DUP(177)manx DB ?;小人的坐标many DB ?welcommsg DB Welcome to Hammal Game! selectmsg DB Press F1 to case1,F2 to case2 Optionmsg DB Press 0.9 to set color errormsg DB It is error! ;错误提示temp DB ?,?,?,?;临时变量ISwin DB 0;标志youwin DB Clever! You win! PRESS ANY KEY TO CONTINUE. err1 DB Creat File

8、 Error! err2 DB Open File Error! err3 DB Read File Error! err4 DB Write File Error! err5 DB Close File Error! correct DB It is OK! flag DB 0caseno DB ?;=DATA_SEG ENDS;*;时间数据段 ;*TDATA_SEG SEGMENT PARA;=count DW 0sec DW 0min DW 0hours DW 0 ran DB 0rbn DB 0rcn DB 0rdn DW 0ren DW 0fla DW 0 ;=TDATA_SEG E

9、NDS ;*;音乐数据段;*MDATA_SEG SEGMENT PARA;=mus_freq DW 330,392,330,294,330,392,330,294,330 DW 330,392,330,294,262,294,330,392,294 DW 262,262,220,196,196,220,262,294,330,262 DW -1mus_time DW 3 DUP(500),250,250,500,250,250,1000 DW 2 DUP(500,500,250,250),1000 DW 3 DUP(500,250,250),1000;=MDATA_SEG ENDS;*;文件数

10、据段;*FDATA_SEG SEGMENT PARA;=fhle DW ? ;文件句柄 fname DB ./data.dat,0 ;ASCIIZ串下段数据存入文件list.dat,(一共39字节)relist LABEL BYTE ;将relist为标志的数据段存入指定文件x DB ?y DB ?;=FDATA_SEG ENDS;* ;* 代码段 ;*CODE_SEG SEGMENT PARA;=MAIN PROC FAR;主过程开始 ASSUME CS:CODE_SEG,ES:DATA_SEG ASSUME SS:STACK_SEGSTART: MOV AX,STACK_SEG MOV S

11、S,AX MOV SP,TOP MOV AX,DATA_SEG MOV ES,AX;- MOV AH,0 MOV AL,3 INT 10h CALL INit CALL storage CALL music GEt_key:;接受键入键 MOV AH,7 INT 21h CMP AL,0 JE GEt_ec JMP GEt_keyGEt_ec: MOV AH,7 INT 21h CMP AL,F1;根据扫描码转入相应处理过程 JE Start_G CMP AL,F4 JE Select_G CMP AL,F8 JE exit JMP GEt_keySelect_G: CALL SelectCa

12、se Start_G: ;游戏开始; CALL Gametime CALL Startgame;-exit: MOV AX,4C00H INT 21HMAIN ENDP ;主程序结束;+ SelectCase PROC NEAR;选择子程序DIsplaymsg selectmsgsel_key: ;接受键入键 MOV AH,7 INT 21h CMP AL,0 JE sel_ec JMP sel_keysel_ec: MOV AH,7 INT 21h CMP AL,F8 JE exit11 CMP AL,F2 JE sel2 CMP AL,F1 JE sel1 JMP sel_keyexit1

13、1: RETsel1: JMP FAR PTR Start_G sel2: MOV caseno,32h show_char 13,58,00000011b,caseno,1 show_char 12,32,00001101b, ,2 show_char 13,24,00001101b,219,2 show_char 11,30,10001110b, ,2 show_char 10,34,10001110b,234,2 MOV manx,10 MOV many,34 JMP FAR PTR Start_GSelectCase ENDP;+INit PROC NEAR;初始化子过程 MOV AH

14、,0bh MOV BH,00 MOV BL,9 INT 10h MOV BP,OFFSET s1 MOV CX,62 MOV BH,0 MOV DH,4 MOV DL,9 MOV AL,3 MOV AH,13h INT 10h MOV CX,17 MOV AX,5down_loop: MOV BP,OFFSET s2 PUSH CX MOV CX,62 MOV BH,0 MOV DH,AL MOV DL,9 PUSH AX MOV AL,3 MOV AH,13h INT 10h POP AX POP CX INC AX LOOP down_loop MOV BP,OFFSET s3 MOV C

15、X,62 MOV BH,0 MOV DH,22 MOV DL,9 MOV AL,3 MOV AH,13h INT 10h show_char 1,32,00000001b,222,1 MOV BP,OFFSET GameName MOV CX,12 MOV BH,0 MOV BL,00011110b MOV DH,1 MOV DL,33 MOV AL,0 MOV AH,13h INT 10h show_char 1,44,00000111b,220,1 MOV BP,OFFSET Ying MOV CX,11 MOV BH,0 MOV BL,00000111b MOV DH,2 MOV DL,

16、34 MOV AL,0 MOV AH,13h INT 10h INitchar s4,5 INitchar s5,6 INitchar s6,7 INitchar s7,8 INitchar s8,9 INitchar s9,11 INitchar s10,13 INitchar s11,15 INitchar s12,18 DIsplaymsg welcommsg MOV flag,0 MOV iswin,0 RETINit ENDP;+ storage PROC NEAR;初始化仓库子过程 INitstor g1,8 INitstor g2,9 INitstor g3,10 INitsto

17、r g4,11 INitstor g5,12 INitstor g6,13 INitstor g7,14 INitstor g8,15 show_char 11,22,00000111b,176,2 show_char 11,24,00000111b,176,2 show_char 12,22,00000111b,176,2 show_char 12,24,00000111b,176,2 show_char 10,32,00001101b,219,2 show_char 11,32,00001101b,219,2 show_char 12,32,00001101b,219,2 show_char 13,32,00001101b,219,2 MOV caseno,31h show_char 13,58,00000011b,caseno,1 MOV AH,2 MOV BH,0 MOV DH,11 MOV DL,30 INT 10h MOV AH,09h MOV AL,234 MOV BH,0 MOV BL,10001110b MOV CX,2 INT 10h MOV manx,11 MOV many,30 MOV AH,1 MOV CH,4 MOV CL,0 INT 10h RETstorage ENDP;+StartGame PROC NEAR ;游戏子过程

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 教育教学 > 成人教育


备案号:宁ICP备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号