DATA SEGMENT
SEGMENT1C DW 0
OFF1C DW 0
SCORE DB 5 DUP('0'),'$'
PADMSG DB 44 DUP(219)
TMPMSG DB 25 DUP(?)
STARTMSG1 DB 0DH,0AH,'SELECT SPEED.',0DH,0AH,'$'
STARTMSG2 DB 20H,20H,'1. FAST',0DH,0AH,'$'
STARTMSG3 DB 20H,20H,'2. MIDDLE',0DH,0AH,'$'
STARTMSG4 DB 20H,20H,'3. SLOW',0DH,0AH,'$'
STARTMSG5 DB 20H,20H,'0. EXIT',0DH,0AH,'$'
ENDMSG DB 0DH,0AH,'GOOD BYE!',0DH,0AH,'$'
SCOREMSG1 DB 201,11 DUP(205),187
SCOREMSG2 DB 186,'SCORE: ',186
SCOREMSG3 DB 204,11 DUP(205),185
SCOREMSG4 DB 186,'LEFT : A ',186
SCOREMSG5 DB 186,'RIGHT : D ',186
SCOREMSG6 DB 186,'UP : W ',186
SCOREMSG7 DB 186,'DOWN : S ',186
SCOREMSG8 DB 186,'-----------',186
SCOREMSG9 DB 186,'EXIT : ESC',186
SCOREMSG10 DB 200,11 DUP(205),188
SPEED DB 0
TIM DB 0
CON DB ?
NUM DW ?
PADMSG1 DB 400 DUP(?,?,?)
FORM DB 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
DB 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2
DB 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2
DB 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2
DB 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2
DB 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2
DB 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2
DB 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2
DB 2,0,0,0,0,0,0,0,0,0,0,0,0,0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FSET STARTMSG4
INT 21H
MOV DX,OFFSET STARTMSG5
INT 21H
MOV AH,08H
INT 21H
SUB AL,'0'
MOV CL,AL
AND AL,3
CMP AL,CL
JNE SELECTSPEED
INC AL
INC CL
MUL CL
CMP AL,1H
JE EXIT1
MOV SPEED,AL
;SET GRAPHICS
MOV AH,00H
MOV AL,12H
INT 10H
MOV AH,0BH
MOV BH,01
MOV BL,00H
INT 10H
;START GAME
CALL INITGAME
CALL DISPSCORE
CALL RANDOM
CALL DELAY
MOV TIM,0H
LOOP1:
STI
CMP CON,0
JZ LOOP11
MOV DL,07H
MOV AH,02H
INT 21H
MOV AH,08H
INT 21H
JMP GAMEOVER
LOOP11:
MOV AL,TIM
CMP AL,SPEED
JG TIME
JMP LOOP1
TIME:
MOV TIM,0H
MOV AH,1
INT 16H
JNZ FLAG3
CALL BLANK
JMP LOOP1
FLAG3:
MOV AH,0
INT 16H
PUSH AX
MOV AH,1
INT 16H
JZ FLAG2
POP AX
JMP FLAG3
EXIT1:
JMP EXIT
FLAG2:
POP AX
CMP AL,1BH
JZ EXIT
CMP AL,'a'
JZ KA
CMP AL,'s'
JZ KS
CMP AL,'d'
JZ KD
CMP AL,'w'
JZ KW
CALL BLANK
JMP LOOP1
KA:
CALL LEFT
JMP LOOP1
KS:
CALL DOWN
JMP LOOP1
KD:
CALL RIGHT
JMP LOOP1
KW:
CALL UP
JMP LOOP1
EXIT:
;SET GRAPHICS
MOV AX,0003H
INT 10H
MOV AX,DATA
MOV DS,AX
MOV DX,OFFSET ENDMSG
MOV AH,09H
INT 21H
;SET INT 1C ADRESS
MOV DX,OFF1C
MOV AX,SEGMENT1C
MOV DS,AX
MOV AL,1CH
MOV AH,25H
INT 21H
MOV AX,4C00H
INT 21H
INT1C PROC
STI
PUSH AX
PUSH DX
MOV AX,DATA
MOV DS,AX
INC TIM
POP DX
POP AX
IRET
INT1C ENDP
LEFT PROC NEAR
MOV SI,0
MOV AX,NUM
DEC AX
MOV BX,3
MUL BX
ADD SI,AX
MOV CH,PADMSG1[SI]
MOV CL,PADMSG1[SI+1]
CMP PADMSG1[SI+2],1
JNZ LEFT1
CALL CHECK1
JMP LEXIT1
LEFT1:
CALL CHECK3
LEXIT1:
RET
LEFT ENDP
RIGHT PROC NEAR
MOV SI,0
MOV AX,NUM
DEC AX
MOV BX,3
MUL BX
ADD SI,AX
MOV CH,PADMSG1[SI]
MOV CL,PADMSG1[SI+1]
CMP PADMSG1[SI+2],3
JNZ RIGHT1
CALL CHECK3
JMP REXIT1
RIGHT1:
CALL CHECK1
REXIT1:
RET
RIGHT ENDP
DISPCELL PROC NEAR;DH=ROW DL=COL BH=PAGE BL=COLOR
PUSH AX
PUSH BX
PUSH CX
PUSH DX
PUSH DI
PUSH SI
MOV BP,OFFSET PADMSG
MOV CX,02H
MOV AX,1300H
INT 10H
CMP BL,0H
JE SKIP20
;CALC ROW
MOV AH,0H
MOV AL,DH
MOV CL,16
MUL CL
MOV SI,AX
;CALC COL
MOV AH,0H
MOV AL,DL
MOV CL,8
MUL CL
MOV DI,AX
;DRAW
MOV AX,0C00H
MOV DX,SI
ADD DX,15
MOV CX,16
LOOP21: ADD CX,DI
DEC CX
INT 10H
INC CX
SUB CX,DI
LOOP LOOP21
MOV DX,SI
MOV CX,15
ADD DI,15
LOOP22: PUSH CX
MOV CX,DI
INT 10H
INC DX
POP CX
LOOP LOOP22
SUB DI,2
DEC DX
MOV CX,13
LOOP23: PUSH CX
DEC DX
MOV CX,DI
INT 10H
SUB CX,12
MOV AL,07H
INT 10H
MOV AL,00H
POP CX
LOOP LOOP23
MOV AX,0C07H
MOV DX,SI
ADD DX,1
MOV CX,12
SUB DI,12
LOOP24: ADD CX,DI
INT 10H
SUB CX,DI
LOOP LOOP24
SKIP20: POP SI
POP DI
POP DX
POP CX
POP BX
POP AX
RET
DISPCELL ENDP
CLS PROC NEAR
MOV CX,0
MOV DH,24
MOV DL,79
MOV BH,0
MOV AX,600H
INT 10H
RET
CLS ENDP
RANDOM PROC NEAR
RANDOM1:
IN AX,40H
INC AH
INC AL
AND AH,15
MOV DH,AH
AND AL,15
MOV DL,AL
IN AX,40H
INC AH
INC AL
AND AH,3
ADD DH,AH
AND AL,3
ADD DL,AL
IN AX,40H
INC AH
INC AL
AND AH,1
ADD DH,AH
AND AL,1
ADD DL,AL
MOV SI,0
MOV AL,DH
INC AL
MOV BL,22
MUL BL
ADD SI,AX
MOV AL,DL
INC AL
MOV AH,0
ADD SI,AX
CMP FORM[SI],0
JNZ RANDOM1
MOV FORM[SI],3
ADD DH,4
SHL DL,1
ADD DL,6
MOV BL,01011001B
MOV BH,0
CALL DISPCELL
RET
RANDOM ENDP