|
;说明:用MASM做编译器,,,07软件为旗号,,,,,
;现给代码免费体验游戏(功能完善中...)
.8086
WINDOW MACRO COL1,COL2,LINE1,LINE2
LOCAL L1,L2
MOV SI,LINE1
L1:MOV AH,0CH
MOV DX,COL1
MOV CX,SI
MOV AL,1
INT 10H
MOV DX,COL2
INT 10H
INC SI
CMP SI,LINE2
JNE L1
MOV SI,COL1
L2:MOV AH,0CH
MOV DX,SI
MOV CX,LINE1
MOV AL,1
INT 10H
MOV CX,LINE2
INT 10H
INC SI
CMP SI,COL2
JNE L2
ENDM
SQUARE MACRO SCOL1,SCOL2,SLINE1,SLINE2
LOCAL L1,L2
MOV DI,SCOL1
L1:MOV SI,SLINE1
L2:MOV AH,0CH
MOV DX,DI
MOV CX,SI
MOV AL,6
INT 10H
INC SI
CMP SI,SLINE2
JNE L2
INC DI
CMP DI,SCOL2
JNE L1
ENDM
CLSQUARE MACRO SCOL1,SCOL2,SLINE1,SLINE2
LOCAL L1,L2,L3
INC SCOL1
INC SCOL2
MOV DI,SCOL1
L1:MOV SI,SLINE1
L2:MOV AH,0CH
MOV DX,DI
MOV CX,SI
MOV AL,6
INT 10H
INC SI
CMP SI,SLINE2
JNE L2
INC DI
CMP DI,SCOL2
JNE L1
MOV SI,SLINE1
L3:MOV AH,0CH
MOV DX,SCOL1
DEC DX
MOV CX,SI
MOV AL,0
INT 10H
INC SI
CMP SI,LINE2
JNE L3
ENDM
TIMELATE MACRO
LOCAL TIME
PUSH BX
PUSH CX
MOV BX,0FFH
MOV CX,0FFFFH
TIME:LOOP TIME
DEC BX
JNZ TIME
POP CX
POP BX
ENDM
DATA SEGMENT
COL1 DW 19 ;20
COL2 DW 181 ;180
LINE1 DW 399 ;400
LINE2 DW 626 ;625
SCOL1 DW 20
SCOL2 DW 36
SLINE1 DW 425
SLINE2 DW 475
SBX DW ?
SES DW ?
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE, DS:DATA
START: MOV AX,DATA
MOV DS,AX
MOV AH,0
MOV AL,0EH
INT 10H
;更改键盘中断
MOV AH,35H
MOV AL,09H
INT 21H
MOV AX,ES
MOV SES,AX
MOV SBX,BX
PUSH DS
MOV AX,CODE2
MOV DS,AX
MOV DX,OFFSET INT9
MOV AH,25H
MOV AL,09H
INT 21H
POP DS
;只允许键盘中断
MOV AL,11111101B
OUT 21H,AL
STI
WINDOW COL1,COL2,LINE1,LINE2
L1: SQUARE SCOL1,SCOL2,SLINE1,SLINE2
TIMELATE
JMP PASSL1MID
L1MID:JMP L1
PASSL1MID:CLSQUARE SCOL1,SCOL2,SLINE1,SLINE2
SQUARE SCOL1,SCOL2,SLINE1,SLINE2
MOV AX,SCOL2
CMP AX,COL2
JNE L1MID
CLI
;恢复键盘中断
MOV DX,SBX
MOV DS,SES
MOV AH,25H
MOV AL,09H
INT 21H
MOV AH,4CH
INT 21H
CODE ENDS
;代码段CODE2用于将方块左右移的中断程序
CODE2 SEGMENT
ASSUME CS:CODE2, DS:DATA
INT9 PROC FAR
PUSH AX
PUSH BX
PUSH CX
PUSH DX
PUSH DI
PUSH SI
PUSH DS
PUSH ES
MOV AH,02H
MOV DL,'G'
INT 21H
;从60H端口取字符扫描码
IN AL,60H
CMP AL,4DH
JNE PASSPRO2
ADD SLINE2,25
MOV DI,SLINE1
L21:MOV SI,SCOL1
L22:MOV AH,0CH
MOV DX,SI
MOV CX,DI
MOV AL,6
INT 10H
INC SI
CMP SI,SCOL2
JNE L22
INC DI
CMP DI,LINE2
JNE L21
MOV DI,LINE1
ADD LINE1,25
L123:MOV SI,SCOL1
L124:MOV AH,0CH
MOV DX,SI
MOV CX,DI
MOV AL,0
INT 10H
INC SI
CMP SI,SCOL2
JNE L124
INC DI
CMP DI,LINE1
JNE L123
PASSPRO2:
MOV AL,20H
OUT 20H,AL
POP ES
POP DS
POP SI
POP DI
POP DX
POP CX
POP BX
POP AX
IRET
INT9 ENDP
CODE2 ENDS
END START
|
;如有需要完整版,,留言,,, |
|