-
Notifications
You must be signed in to change notification settings - Fork 0
/
program.asm
140 lines (139 loc) · 1.6 KB
/
program.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# anjali's_code
# tic-tac-toe-in-assembly-language
.model small
mesg macro msg ;message for invalid input
lea dx,invalid_input
mov ah,9
int 21h
endm
.data
n1 db 13,10,"$"
game_name db"TIC TAC TOE",13,10."$"
invalid_input db"INVALID INPUT.GIVE ANOTHER INPUT",13,10,"$"
X DW 100
Y DW 100
INCRE DW 0
INCRE1 DW 0
XX DB 0
MOVX DB ?
MOVY DW ?
WINMSG DB "PLAYER1 IS WINNER!!$"
WINMSG1 DB "PLAYER2 IS WINNER!!!$"
X1 DB ?
X2 DB ?
BOX1 DW 0
BOX2 DW 0
BOX3 DW 0
BOX4 DW 0
BOX5 DW 0
BOX6 DW 0
BOX7 DW 0
BOX8 DW 0
BOX9 DW 0
PLAYER1 DW 1
INFO DW 3 ;THESE DIFFERENT VALUES BECAUSE NO THREE INFO MUST HAVE SAME VALUE
INFO1 DW 3
INFO2 DW 4
INFO3 DW 4
INFO4 DW 5
INFO5 DW 5
INFO6 DW 6
INFO7 DW 6
INFO8 DW 7
INFO9 DW 7
.CODE
START:
MOV DX,@DATA
MOV DS,DX
MOV AH,0H
MOV AL,12H
INT 10H
MOV AH,9H
LEA DX,N1
INT 21H
MOV AH,9H
LEA DX,N1
INT 21H
MOV AH,9H
LEA DX,GAME_NAME
INT 21H
L1: ;BEGIN TO DRAW BOARD
MOV AH,0CH
MOV AL,15
MOV BH,0
MOV CX,X
MOV DX,Y
INT 10H ;INTERRUPT FOR GRAPHICS
ADD X,10
CMP X,300
JL L1
MOV X,150
MOV Y,50
L2:
MOV AH,0CH
MOV AL,15
MOV BH,0
MOV CX,X
MOV DX,Y
INT 10H
ADD Y,10
CMP Y,240
JL L2
MOV X,100
MOV Y,170
L3:
MOV AH,0CH
MOV AL,15H
MOV BH,0
MOV CX,X
MOV DX,Y
INT 10H
ADD X,10
CMP X,300
JL L3
MOV X,240
MOV Y,50
L4:
MOV AH,0CH
MOV AL,15H
MOV BH,0
MOV CX,X
MOV DX,Y
INT 10H
ADD Y,10
CMP Y,240
JL L4
MOV X,110
MOV Y,70 ;END OF BOARD
MOV AH,9H
LEA DX,N1
INT 21H
MOV AH,9H
LEA DX,N1
INT 21H
TIKLEVEL:
MOV CX,5H
mov AH,1
INT 16H
JNZ KEYPRESS
KPS:
JNE KEYPRESS
KEYPRESS:
MOV AH,0H
INT 16H
MOV X1,AL
COMP1:
CMP X1,'1'
JE LEVEL1
JMP COMP2
LEVEL1:
CMP BOX1,0
JE LEVEL_1
MESG
JMP KPS
LEVEL_1:
MOV BOX1,1H
CMP PLAYER1,1
JE TIK1
JNE CROSS1
TIK1: