Skip to content

Commit 13f6e3e

Browse files
authored
Merge pull request #23 from kostyabet/dev
PR #1 Create Main alghoritm
2 parents cece4ec + f692af7 commit 13f6e3e

File tree

14 files changed

+805
-17
lines changed

14 files changed

+805
-17
lines changed

Game/BusinesModel.inc

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@ TickEmpty = 0
22
TickBlock = -1
33
TickExist = 1
44

5+
TickFrom = 2
6+
TickToTop = 3
7+
TickToLeft = 4
8+
TickToRight = 5
9+
TickToBottom = 6
10+
511
; ======================= ;
612
; ;
713
; gameboard: ;
@@ -22,6 +28,7 @@ TickExist = 1
2228
; 0 0 0 0 0 0 0 0 0 ;
2329
; ;
2430
; ======================= ;
31+
2532
TicksMatrix dd TickExist, TickExist, TickExist,\ ; game
2633
TickExist, TickExist, TickExist,\
2734
TickExist, TickExist, TickExist, TickExist, TickExist, TickExist, TickExist,\
@@ -32,3 +39,22 @@ TicksMatrix dd TickExist, TickExist, TickExist,\ ; ga
3239
11 dup(TickEmpty),\ ; garbage
3340
11 dup(TickEmpty),\
3441
9 dup(TickEmpty)
42+
43+
garbgeCounter dd 0
44+
45+
struct TickMoveDirection
46+
BETWEEN dd 0
47+
TO dd 0
48+
ends
49+
50+
struct TicksMoveDirectionsStruct
51+
MULTI_DIRECTION dd 0
52+
POSSIBLE dd 0
53+
FROM dd 0
54+
TOP TickMoveDirection ?
55+
LEFT TickMoveDirection ?
56+
RIGHT TickMoveDirection ?
57+
BOTTOM TickMoveDirection ?
58+
ends
59+
60+
TicksMoveDirections TicksMoveDirectionsStruct ?

Game/Includes.asm

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
include 'Models.inc'
22
include 'BusinesModel.inc'
3-
include '_methods/CentersPrepear.asm'
3+
include '_methods/ConvertModelNumber.asm'
4+
include '_methods/TickWork.asm'
5+
include '_methods/CentersPrepear.asm'
6+
include '_methods/OnTickClick.asm'
7+
include '_methods/MoveTick.asm'

Game/Models.inc

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
struct Ticks
2-
counter dd ?
2+
counter dd 0
33
t1 Circle ?
44
t2 Circle ?
55
t3 Circle ?
@@ -34,7 +34,7 @@ struct Ticks
3434
t32 Circle ?
3535
ends
3636
struct TicksFont
37-
counter dd ?
37+
counter dd 0
3838
t1 Circle ?
3939
t2 Circle ?
4040
t3 Circle ?
@@ -156,7 +156,7 @@ TicksFontDecorate_Centers dd 4,\ ; 33
156156
1117, 298,\ ; center 3
157157
1117, 610 ; center 4
158158

159-
TicksFontList_Radiuses dd 17, 13
159+
TicksFontList_Radiuses dd 17, 13
160160
TicksFontList_Float_c1 TicksFont ?
161161
TicksFontList_Float_c2 TicksFont ?
162162
TicksFontList_Float dd 2,\
@@ -194,4 +194,14 @@ TicksFontList_Centers dd 33,\ ; 33
194194
1038, 609,\ ; center 30
195195
882, 687,\ ; center 31
196196
960, 687,\ ; center 32
197-
1038, 687 ; center 33
197+
1038, 687 ; center 33
198+
199+
TicksFontMltDrList_Float_c1 TicksFont ?
200+
TicksFontMltDrList_Float_c2 TicksFont ?
201+
TicksFontMltDrList_Float dd 2,\
202+
TicksFontMltDrList_Float_c1, TicksFontMltDrList_Float_c2
203+
TicksFontMltDrList_Centers dd 0,\ ; 33
204+
?, ?,\ ; center 1
205+
?, ?,\ ; center 2
206+
?, ?,\ ; center 3
207+
?, ? ; center 4

Game/_methods/ConvertModelNumber.asm

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
proc Game.Convert.ToMatrix,\
2+
number
3+
mov eax, [number]
4+
cmp eax, -1
5+
je .exit
6+
cmp eax, 2
7+
ja @f
8+
add eax, 2
9+
jmp .exit
10+
@@:
11+
cmp eax, 5
12+
ja @f
13+
add eax, 6
14+
jmp .exit
15+
@@:
16+
cmp eax, 26
17+
ja @f
18+
add eax, 8
19+
jmp .exit
20+
@@:
21+
cmp eax, 29
22+
ja @f
23+
add eax, 10
24+
jmp .exit
25+
@@:
26+
cmp eax, 32
27+
ja .exit
28+
add eax, 14
29+
.exit:
30+
ret
31+
endp
32+
33+
proc Game.Convert.ToBusiness,\
34+
number
35+
mov eax, [number]
36+
cmp eax, -1
37+
je .exit
38+
cmp eax, 4
39+
ja @f
40+
sub eax, 2
41+
jmp .exit
42+
@@:
43+
cmp eax, 11
44+
ja @f
45+
sub eax, 6
46+
jmp .exit
47+
@@:
48+
cmp eax, 34
49+
ja @f
50+
sub eax, 8
51+
jmp .exit
52+
@@:
53+
cmp eax, 39
54+
ja @f
55+
sub eax, 10
56+
jmp .exit
57+
@@:
58+
sub eax, 14
59+
.exit:
60+
ret
61+
endp

Game/_methods/MoveTick.asm

Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
proc Game.MoveTick uses eax ebx,\
2+
from, between, to
3+
; from
4+
mov eax, [from]
5+
mov ebx, 4
6+
imul ebx
7+
xchg ebx, eax
8+
mov [TicksMatrix + ebx], TickEmpty
9+
; to
10+
mov eax, [to]
11+
mov ebx, 4
12+
imul ebx
13+
xchg ebx, eax
14+
mov [TicksMatrix + ebx], TickExist
15+
; between
16+
; reset on board
17+
mov eax, [between]
18+
mov ebx, 4
19+
imul ebx
20+
xchg ebx, eax
21+
mov [TicksMatrix + ebx], TickEmpty
22+
; go to garbage
23+
mov eax, [garbgeCounter]
24+
add eax, 33
25+
mov ebx, 4
26+
imul ebx
27+
xchg ebx, eax
28+
mov [TicksMatrix + ebx], TickExist
29+
inc [garbgeCounter]
30+
ret
31+
endp
32+
33+
proc Game.Move.SetMultiTicksCoords uses eax
34+
locals
35+
currentOffset dd 0
36+
multiplier dd 8
37+
endl
38+
39+
mov eax, [TicksMoveDirections.POSSIBLE]
40+
mov [TicksFontMltDrList_Centers], eax
41+
42+
cmp [TicksMoveDirections.TOP.TO], -1
43+
je @F
44+
mov eax, [TicksMoveDirections.TOP.TO]
45+
imul dword [multiplier]
46+
mov ebx, TicksFontList_Centers
47+
add ebx, eax
48+
add ebx, 4
49+
50+
mov eax, [currentOffset]
51+
imul dword [multiplier]
52+
mov edi, TicksFontMltDrList_Centers
53+
add edi, eax
54+
add edi, 4
55+
56+
mov eax, [ebx]
57+
mov [edi], eax
58+
mov eax, [ebx + 4]
59+
mov [edi + 4], eax
60+
61+
inc [currentOffset]
62+
@@:
63+
cmp [TicksMoveDirections.LEFT.TO], -1
64+
je @F
65+
mov eax, [TicksMoveDirections.LEFT.TO]
66+
imul dword [multiplier]
67+
mov ebx, TicksFontList_Centers
68+
add ebx, eax
69+
add ebx, 4
70+
71+
mov eax, [currentOffset]
72+
imul dword [multiplier]
73+
mov edi, TicksFontMltDrList_Centers
74+
add edi, eax
75+
add edi, 4
76+
77+
mov eax, [ebx]
78+
mov [edi], eax
79+
mov eax, [ebx + 4]
80+
mov [edi + 4], eax
81+
82+
inc [currentOffset]
83+
@@:
84+
cmp [TicksMoveDirections.RIGHT.TO], -1
85+
je @F
86+
mov eax, [TicksMoveDirections.RIGHT.TO]
87+
imul dword [multiplier]
88+
mov ebx, TicksFontList_Centers
89+
add ebx, eax
90+
add ebx, 4
91+
92+
mov eax, [currentOffset]
93+
imul dword [multiplier]
94+
mov edi, TicksFontMltDrList_Centers
95+
add edi, eax
96+
add edi, 4
97+
98+
mov eax, [ebx]
99+
mov [edi], eax
100+
mov eax, [ebx + 4]
101+
mov [edi + 4], eax
102+
103+
inc [currentOffset]
104+
@@:
105+
cmp [TicksMoveDirections.BOTTOM.TO], -1
106+
je .exit
107+
mov eax, [TicksMoveDirections.BOTTOM.TO]
108+
imul dword [multiplier]
109+
mov ebx, TicksFontList_Centers
110+
add ebx, eax
111+
add ebx, 4
112+
113+
mov eax, [currentOffset]
114+
imul dword [multiplier]
115+
mov edi, TicksFontMltDrList_Centers
116+
add edi, eax
117+
add edi, 4
118+
119+
mov eax, [ebx]
120+
mov [edi], eax
121+
mov eax, [ebx + 4]
122+
mov [edi + 4], eax
123+
124+
inc [currentOffset]
125+
.exit:
126+
ret
127+
endp
128+
129+
proc Game.ResetDirectionsMltTicksCoords uses eax
130+
mov [TicksFontMltDrList_Centers], 0
131+
ret
132+
endp
133+
134+
proc Game.ResetDirectionsTick uses eax
135+
xor eax, eax
136+
mov [TicksMoveDirections.MULTI_DIRECTION], eax
137+
mov [TicksMoveDirections.POSSIBLE], eax
138+
mov [TicksMoveDirections.FROM], eax
139+
mov [TicksMoveDirections.TOP.BETWEEN], eax
140+
mov [TicksMoveDirections.TOP.TO], eax
141+
mov [TicksMoveDirections.LEFT.BETWEEN], eax
142+
mov [TicksMoveDirections.LEFT.TO], eax
143+
mov [TicksMoveDirections.RIGHT.BETWEEN], eax
144+
mov [TicksMoveDirections.RIGHT.TO], eax
145+
mov [TicksMoveDirections.BOTTOM.BETWEEN], eax
146+
mov [TicksMoveDirections.BOTTOM.TO], eax
147+
ret
148+
endp
149+
150+
proc Game.Move.CheckDirectionByTo uses eax,\
151+
number
152+
mov eax, [TicksMoveDirections.TOP.TO]
153+
cmp eax, [number]
154+
jne @F
155+
mov [TicksMoveDirections.LEFT.TO], -1
156+
mov [TicksMoveDirections.RIGHT.TO], -1
157+
mov [TicksMoveDirections.BOTTOM.TO], -1
158+
jmp .exit
159+
@@:
160+
mov eax, [TicksMoveDirections.LEFT.TO]
161+
cmp eax, [number]
162+
jne @F
163+
mov [TicksMoveDirections.TOP.TO], -1
164+
mov [TicksMoveDirections.RIGHT.TO], -1
165+
mov [TicksMoveDirections.BOTTOM.TO], -1
166+
jmp .exit
167+
@@:
168+
mov eax, [TicksMoveDirections.RIGHT.TO]
169+
cmp eax, [number]
170+
jne @F
171+
mov [TicksMoveDirections.LEFT.TO], -1
172+
mov [TicksMoveDirections.TOP.TO], -1
173+
mov [TicksMoveDirections.BOTTOM.TO], -1
174+
jmp .exit
175+
@@:
176+
mov eax, [TicksMoveDirections.BOTTOM.TO]
177+
cmp eax, [number]
178+
jne .exit
179+
mov [TicksMoveDirections.LEFT.TO], -1
180+
mov [TicksMoveDirections.RIGHT.TO], -1
181+
mov [TicksMoveDirections.TOP.TO], -1
182+
.exit:
183+
ret
184+
endp

0 commit comments

Comments
 (0)