Rev 131 | Rev 205 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 131 | Rev 180 | ||
---|---|---|---|
1 | ; Date : 1st April 2001 |
1 | ; Date : 1st April 2001 |
2 | ; TETRIS for MENUET |
2 | ; TETRIS for MENUET |
3 | ; Author : Paolo Minazzi (email paolo.minazzi@inwind.it) |
3 | ; Author : Paolo Minazzi (email paolo.minazzi@inwind.it) |
4 | ; |
4 | ; |
5 | ; -Note- |
5 | ; -Note- |
6 | ; 1. This program requires a PENTIUM or higher because uses the RDTSC |
6 | ; 1. This program requires a PENTIUM or higher because uses the RDTSC |
7 | ; instrucion for get a random number. |
7 | ; instrucion for get a random number. |
8 | ; 2. You must use NASM to compile. Compiling is OK with NASM 0.98, I |
8 | ; 2. You must use NASM to compile. Compiling is OK with NASM 0.98, I |
9 | ; don't know what happen with other versions. |
9 | ; don't know what happen with other versions. |
10 | ; 3. You must use the arrow key to move and rotate a block. |
10 | ; 3. You must use the arrow key to move and rotate a block. |
11 | ; 4. In the near future there will be a new version of TETRIS. This is |
11 | ; 4. In the near future there will be a new version of TETRIS. This is |
12 | ; only the beginning. |
12 | ; only the beginning. |
13 | ; |
13 | ; |
14 | ; Thanks to Ville, the author of this wonderful OS ! |
14 | ; Thanks to Ville, the author of this wonderful OS ! |
15 | ; Join with us to code ! |
15 | ; Join with us to code ! |
16 | ; |
16 | ; |
17 | ; |
17 | ; |
18 | ; Changelog: |
18 | ; Changelog: |
19 | ; 09.11.2005 - fix for work under MeosDebug & better random - Andrey Halyavin |
19 | ; 09.11.2005 - fix for work under MeosDebug & better random - Andrey Halyavin |
20 | ; 23.09.2005 - fixed bug, when 011111111111111-like sequence interpreted |
20 | ; 23.09.2005 - fixed bug, when 011111111111111-like sequence interpreted |
21 | ; as _11111111111111 in check_full_line - Sergey Kuzmin aka Wildwest |
21 | ; as _11111111111111 in check_full_line - Sergey Kuzmin aka Wildwest |
22 | ; 18.09.2005 - added 'Pause' button and made appropriate code and interface redesign |
22 | ; 18.09.2005 - added 'Pause' button and made appropriate code and interface redesign |
23 | ; BTW, you can MOVE and ROTATE block during Pause ;) - Sergey Kuzmin aka Wildwest |
23 | ; BTW, you can MOVE and ROTATE block during Pause ;) - Sergey Kuzmin aka Wildwest |
24 | ; 03.11.2003 - added new blocks & random - Ivan Poddubny |
24 | ; 03.11.2003 - added new blocks & random - Ivan Poddubny |
25 | ; 31.10.2001 - rdtsc replaced - quickcode |
25 | ; 31.10.2001 - rdtsc replaced - quickcode |
26 | ; 28.06.2001 - fasm port & framed blocks - Ville Turjanmaa |
26 | ; 28.06.2001 - fasm port & framed blocks - Ville Turjanmaa |
27 | ; |
27 | ; |
28 | ; |
28 | ; |
29 | 29 | ||
30 | LEN_X equ 19 ;width of table |
30 | LEN_X equ 19 ;width of table |
31 | LEN_Y equ 29 ; height of table |
31 | LEN_Y equ 29 ; height of table |
32 | BORDER_LEFT equ 1 |
32 | BORDER_LEFT equ 1 |
33 | BORDER_RIGHT equ 1 |
33 | BORDER_RIGHT equ 1 |
34 | BORDER_TOP equ 1 |
34 | BORDER_TOP equ 1 |
35 | BORDER_BOTTOM equ 1 |
35 | BORDER_BOTTOM equ 1 |
36 | ADOBE_SIZE equ 12 |
36 | ADOBE_SIZE equ 12 |
37 | 37 | ||
38 | X_LOCATION equ 30 ; distance to table from left side |
38 | X_LOCATION equ 30 ; distance to table from left side |
39 | Y_LOCATION equ 50 ; distance to table from header |
39 | Y_LOCATION equ 50 ; distance to table from header |
40 | 40 | ||
41 | UP_KEY equ 130+48 |
41 | UP_KEY equ 130+48 |
42 | DOWN_KEY equ 129+48 |
42 | DOWN_KEY equ 129+48 |
43 | LEFT_KEY equ 128+48 |
43 | LEFT_KEY equ 128+48 |
44 | RIGHT_KEY equ 131+48 |
44 | RIGHT_KEY equ 131+48 |
45 | BACKGROUND equ 03000080h |
45 | ;BACKGROUND equ 03000080h |
46 | 46 | ||
47 | _MAXBLOCKS_ = 7*4 |
47 | _MAXBLOCKS_ = 7*4 |
48 | 48 | ||
49 | use32 |
49 | use32 |
50 | 50 | ||
51 | org 0x0 |
51 | org 0x0 |
52 | 52 | ||
53 | db 'MENUET01' ; 8 byte id |
53 | db 'MENUET01' ; 8 byte id |
54 | dd 0x01 ; header version |
54 | dd 0x01 ; header version |
55 | dd START ; program start |
55 | dd START ; program start |
56 | dd I_END ; program image size |
56 | dd I_END ; program image size |
57 | dd I_END+1024 ; reguired amount of memory |
57 | dd I_END+1024 ; reguired amount of memory |
58 | dd I_END+1024 ; esp |
58 | dd I_END+1024 ; esp |
59 | dd 0x0,0x0 ; I_PARAM, I_ICON |
59 | dd 0x0,0x0 ; I_PARAM, I_ICON |
60 | include 'lang.inc' |
60 | include 'lang.inc' |
61 | include 'macros.inc' |
61 | include 'macros.inc' |
62 | 62 | ||
63 | 63 | ||
64 | START: ; start of execution |
64 | START: ; start of execution |
65 | 65 | ||
66 | 66 | ||
67 | ; -- quickcode - start |
67 | ; -- quickcode - start |
68 | 68 | ||
69 | mov eax,3 |
69 | mov eax,3 |
70 | int 0x40 |
70 | int 0x40 |
71 | mov cl,16 |
71 | mov cl,16 |
72 | ror eax,cl ; to make seconds more significant |
72 | ror eax,cl ; to make seconds more significant |
73 | mov [generator],eax |
73 | mov [generator],eax |
74 | call random |
74 | call random |
75 | 75 | ||
76 | ; -- quickcode - end |
76 | ; -- quickcode - end |
77 | 77 | ||
78 | 78 | ||
79 | call clear_table_tetris |
79 | call clear_table_tetris |
80 | call new_block |
80 | call new_block |
81 | call draw_window ; at first, draw the window |
81 | call draw_window ; at first, draw the window |
82 | 82 | ||
83 | still: |
83 | still: |
84 | xor edx,edx |
84 | xor edx,edx |
85 | call draw_block |
85 | call draw_block |
86 | 86 | ||
87 | attesa: |
87 | attesa: |
88 | 88 | ||
89 | mov eax,11 ; get event |
89 | mov eax,11 ; get event |
90 | int 0x40 |
90 | int 0x40 |
91 | 91 | ||
92 | cmp eax,1 ; redraw request ? |
92 | cmp eax,1 ; redraw request ? |
93 | jz red |
93 | jz red |
94 | cmp eax,2 ; key in buffer ? |
94 | cmp eax,2 ; key in buffer ? |
95 | jnz check_button |
95 | jnz check_button |
96 | jmp key |
96 | jmp key |
97 | check_button: |
97 | check_button: |
98 | cmp eax,3 ; button in buffer ? |
98 | cmp eax,3 ; button in buffer ? |
99 | jnz scendi |
99 | jnz scendi |
100 | jmp button |
100 | jmp button |
101 | 101 | ||
102 | red: ; redraw |
102 | red: ; redraw |
103 | call draw_window |
103 | call draw_window |
104 | jmp still |
104 | jmp still |
105 | 105 | ||
106 | 106 | ||
107 | 107 | ||
108 | scendi: |
108 | scendi: |
109 | ;///////////////////////////////////////////////// Wildwest |
109 | ;///////////////////////////////////////////////// Wildwest |
110 | cmp dword [pauses], 0 |
110 | cmp dword [pauses], 0 |
111 | je ok |
111 | je ok |
112 | jne not_ok |
112 | jne not_ok |
113 | not_ok: |
113 | not_ok: |
114 | inc dword [current_block_y] |
114 | inc dword [current_block_y] |
115 | dec dword [current_block_y] |
115 | dec dword [current_block_y] |
116 | call check_crash |
116 | call check_crash |
117 | jne block_crash |
117 | jne block_crash |
118 | jmp draw |
118 | jmp draw |
119 | ok: |
119 | ok: |
120 | ;///////////////////////////////////////////////// |
120 | ;///////////////////////////////////////////////// |
121 | inc dword [current_block_y] |
121 | inc dword [current_block_y] |
122 | call check_crash |
122 | call check_crash |
123 | jne block_crash |
123 | jne block_crash |
124 | draw: movzx edx,byte [current_block_color] |
124 | draw: movzx edx,byte [current_block_color] |
125 | call draw_block |
125 | call draw_block |
126 | mov eax,5 |
126 | mov eax,5 |
127 | movzx ebx,byte [delay] |
127 | movzx ebx,byte [delay] |
128 | int 0x40 |
128 | int 0x40 |
129 | jmp still |
129 | jmp still |
130 | 130 | ||
131 | block_crash: dec dword [current_block_y] |
131 | block_crash: dec dword [current_block_y] |
132 | movzx edx,byte [current_block_color] |
132 | movzx edx,byte [current_block_color] |
133 | call draw_block |
133 | call draw_block |
134 | call fix_block |
134 | call fix_block |
135 | call check_full_line |
135 | call check_full_line |
136 | call draw_table |
136 | call draw_table |
137 | call new_block |
137 | call new_block |
138 | inc dword [score] |
138 | inc dword [score] |
139 | call write_score |
139 | call write_score |
140 | call check_crash |
140 | call check_crash |
141 | jz adr400 |
141 | jz adr400 |
142 | aspetta: mov eax,10 |
142 | aspetta: mov eax,10 |
143 | int 0x40 |
143 | int 0x40 |
144 | cmp eax,1 |
144 | cmp eax,1 |
145 | jne adr10000 |
145 | jne adr10000 |
146 | call draw_window |
146 | call draw_window |
147 | adr10000: cmp eax,3 |
147 | adr10000: cmp eax,3 |
148 | jne aspetta |
148 | jne aspetta |
149 | new_game: mov eax,17 |
149 | new_game: mov eax,17 |
150 | int 0x40 |
150 | int 0x40 |
151 | cmp ah,1 |
151 | cmp ah,1 |
152 | jnz adr401 |
152 | jnz adr401 |
153 | jmp end_program |
153 | jmp end_program |
154 | adr401: |
154 | adr401: |
155 | ;///////////////////////////////////////////////////// Wildwest |
155 | ;///////////////////////////////////////////////////// Wildwest |
156 | mov dword [pauses], 0 |
156 | mov dword [pauses], 0 |
157 | ;//////////////////////////////////////////////////// |
157 | ;//////////////////////////////////////////////////// |
158 | mov dword [score],0 |
158 | mov dword [score],0 |
159 | call clear_table_tetris |
159 | call clear_table_tetris |
160 | call new_block |
160 | call new_block |
161 | call draw_window |
161 | call draw_window |
162 | 162 | ||
163 | adr400: movzx edx,byte [current_block_color] |
163 | adr400: movzx edx,byte [current_block_color] |
164 | call draw_block |
164 | call draw_block |
165 | mov eax,5 |
165 | mov eax,5 |
166 | movzx ebx,byte [delay] |
166 | movzx ebx,byte [delay] |
167 | int 0x40 |
167 | int 0x40 |
168 | jmp still |
168 | jmp still |
169 | 169 | ||
170 | key: mov eax,2 |
170 | key: mov eax,2 |
171 | int 0x40 |
171 | int 0x40 |
172 | 172 | ||
173 | adr32: cmp ah,LEFT_KEY |
173 | adr32: cmp ah,LEFT_KEY |
174 | jne adr_30 |
174 | jne adr_30 |
175 | dec dword [current_block_x] |
175 | dec dword [current_block_x] |
176 | call check_crash |
176 | call check_crash |
177 | jz adr4000 |
177 | jz adr4000 |
178 | inc dword [current_block_x] |
178 | inc dword [current_block_x] |
179 | adr4000: jmp scendi |
179 | adr4000: jmp scendi |
180 | 180 | ||
181 | adr_30: cmp ah,RIGHT_KEY |
181 | adr_30: cmp ah,RIGHT_KEY |
182 | jne adr_31 |
182 | jne adr_31 |
183 | inc dword [current_block_x] |
183 | inc dword [current_block_x] |
184 | call check_crash |
184 | call check_crash |
185 | jz adr3000 |
185 | jz adr3000 |
186 | dec dword [current_block_x] |
186 | dec dword [current_block_x] |
187 | adr3000: jmp scendi |
187 | adr3000: jmp scendi |
188 | 188 | ||
189 | adr_31: cmp ah,UP_KEY |
189 | adr_31: cmp ah,UP_KEY |
190 | jne adr51 |
190 | jne adr51 |
191 | mov edx,[current_block_pointer] |
191 | mov edx,[current_block_pointer] |
192 | mov edx,[edx+16] |
192 | mov edx,[edx+16] |
193 | mov esi,[current_block_pointer] |
193 | mov esi,[current_block_pointer] |
194 | mov [current_block_pointer],edx |
194 | mov [current_block_pointer],edx |
195 | call check_crash |
195 | call check_crash |
196 | jz adr50 |
196 | jz adr50 |
197 | mov [current_block_pointer],esi |
197 | mov [current_block_pointer],esi |
198 | adr50: jmp scendi |
198 | adr50: jmp scendi |
199 | 199 | ||
200 | adr51: cmp ah,DOWN_KEY |
200 | adr51: cmp ah,DOWN_KEY |
201 | jne adr61 |
201 | jne adr61 |
202 | mov byte [delay],5 ;!!! 2 |
202 | mov byte [delay],5 ;!!! 2 |
203 | adr52: jmp scendi |
203 | adr52: jmp scendi |
204 | 204 | ||
205 | adr61: cmp ah,' ' |
205 | adr61: cmp ah,' ' |
206 | jne adr62 |
206 | jne adr62 |
207 | mov byte [delay],5 ;!!! 2 |
207 | mov byte [delay],5 ;!!! 2 |
208 | adr62: jmp scendi |
208 | adr62: jmp scendi |
209 | 209 | ||
210 | 210 | ||
211 | button: ; button |
211 | button: ; button |
212 | mov eax,17 |
212 | mov eax,17 |
213 | int 0x40 |
213 | int 0x40 |
214 | cmp ah,1 ; button id=1 ? |
214 | cmp ah,1 ; button id=1 ? |
215 | jz end_program |
215 | jz end_program |
216 | cmp ah,2 |
216 | cmp ah,2 |
217 | jz go_new_game |
217 | jz go_new_game |
218 | cmp ah,3 ; button id=3 ? ///Wildwest's 'Pause' button |
218 | cmp ah,3 ; button id=3 ? ///Wildwest's 'Pause' button |
219 | jz pause_program |
219 | jz pause_program |
220 | jmp still |
220 | jmp still |
221 | 221 | ||
222 | end_program: |
222 | end_program: |
223 | mov eax,0xffffffff ; close this program |
223 | mov eax,-1 ; close this program |
224 | int 0x40 |
224 | int 0x40 |
225 | 225 | ||
226 | go_new_game: |
226 | go_new_game: |
227 | jmp new_game |
227 | jmp new_game |
228 | ;//////////////////////////////////////////////////// Wildwest |
228 | ;//////////////////////////////////////////////////// Wildwest |
229 | pause_program: |
229 | pause_program: |
230 | cmp dword [pauses], 0 |
230 | cmp dword [pauses], 0 |
231 | je incr |
231 | je incr |
232 | mov dword [pauses], 0 |
232 | mov dword [pauses], 0 |
233 | jmp still |
233 | jmp still |
234 | incr: |
234 | incr: |
235 | mov dword [pauses], 1 |
235 | mov dword [pauses], 1 |
236 | jmp still |
236 | jmp still |
237 | ;//////////////////////////////////////////////////// |
237 | ;//////////////////////////////////////////////////// |
238 | ; ********************************************* |
238 | ; ********************************************* |
239 | ; ******* WINDOW DEFINITIONS AND DRAW ******** |
239 | ; ******* WINDOW DEFINITIONS AND DRAW ******** |
240 | ; ********************************************* |
240 | ; ********************************************* |
241 | draw_window: |
241 | draw_window: |
242 | 242 | ||
- | 243 | ||
- | 244 | mov eax,48 |
|
- | 245 | mov ebx,3 |
|
- | 246 | mov ecx,sc |
|
- | 247 | mov edx,sizeof.system_colors |
|
- | 248 | int 0x40 |
|
243 | 249 | ||
244 | mov eax,12 ; function 12:tell os about windowdraw |
250 | mov eax,12 ; function 12:tell os about windowdraw |
245 | mov ebx,1 ; 1, start of draw |
251 | mov ebx,1 ; 1, start of draw |
246 | int 0x40 |
252 | int 0x40 |
247 | 253 | ||
248 | ; DRAW WINDOW |
254 | ; DRAW WINDOW |
249 | mov eax,0 ; function 0 : define and draw window |
255 | xor eax,eax ; function 0 : define and draw window |
250 | mov ebx,320*65536+(LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2 |
256 | mov ebx,320*65536+(LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2 |
251 | mov ecx,25*65536+ (LEN_Y-BORDER_TOP-BORDER_BOTTOM)*ADOBE_SIZE+Y_LOCATION+30 |
257 | mov ecx,25*65536+ (LEN_Y-BORDER_TOP-BORDER_BOTTOM)*ADOBE_SIZE+Y_LOCATION+30 |
252 | mov edx,BACKGROUND ; color of work area RRGGBB |
258 | mov edx,[sc.work] ; color of work area RRGGBB |
253 | mov esi,0x006688ee;99bbff ; color of grab bar RRGGBB,8->col |
259 | or edx,0x13000000 |
254 | mov edi,0x007799ff;99bbee ; color of frames RRGGBB |
260 | mov edi,header ; WINDOW LABEL |
255 | int 0x40 |
261 | int 0x40 |
256 | - | ||
257 | ; WINDOW LABEL |
- | |
258 | mov eax,4 ; function 4 : write text to window |
- | |
259 | mov ebx,8*65536+8 ; [x start] *65536 + [y start] |
- | |
260 | mov ecx,0x10ffffff ; color of text RRGGBB |
- | |
261 | mov edx,labelt ; pointer to text beginning |
- | |
262 | mov esi,labellen-labelt ; text length |
- | |
263 | int 0x40 |
- | |
264 | - | ||
265 | ; CLOSE BUTTON |
- | |
266 | ; mov eax,8 ; function 8 : define and draw button |
- | |
267 | ; mov ebx,243*65536+12 ; [x start] *65536 + [x size] |
- | |
268 | ; mov ecx,5*65536+12 ; [y start] *65536 + [y size] |
- | |
269 | ; mov edx,1 ; button id |
- | |
270 | ; mov esi,0x5580cc;22aacc ; button color RRGGBB |
- | |
271 | ; int 0x40 |
262 | |
272 | 263 | ||
273 | mov eax,8 |
264 | mov eax,8 |
274 | mov ebx,30*65536+102 |
265 | mov ebx,30*65536+100 |
275 | mov ecx,378*65536+18 |
266 | mov ecx,378*65536+18 |
276 | mov edx,2 |
267 | mov edx,2 |
277 | mov esi,0xA24466;5580cc;22aacc |
268 | mov esi,[sc.work_button] |
278 | int 0x40 |
269 | int 0x40 |
279 | ;/////////////////////////////////////////////// Wildwest's 'Pause' button |
270 | ;/////////////////////////////////////////////// Wildwest's 'Pause' button |
280 | mov eax,8 |
271 | ;mov eax,8 |
281 | mov ebx,132*65536+102 |
272 | mov ebx,132*65536+102 |
282 | mov ecx,378*65536+18 |
273 | mov ecx,378*65536+18 |
283 | mov edx,3 |
274 | mov edx,3 |
284 | mov esi,0x0FA0F0; |
275 | mov esi,[sc.work_button]; |
285 | int 0x40 |
276 | int 0x40 |
286 | 277 | ||
287 | mov eax,4 ; function 4 : write text to window |
278 | mov eax,4 ; function 4 : write text to window |
288 | mov ebx,164*65536+384 ; [x start] *65536 + [y start] |
279 | mov ebx,164*65536+384 ; [x start] *65536 + [y start] |
289 | mov ecx,0x10ffffff ; color of text RRGGBB |
280 | mov ecx,[sc.work_button_text] ; color of text RRGGBB |
290 | mov edx,labe ; pointer to text beginning |
281 | or ecx,0x90000000 |
291 | mov esi,labelen-labe ; text length |
282 | mov edx,labe ; pointer to text |
292 | int 0x40 |
283 | int 0x40 |
293 | ;/////////////////////////////////////////////// |
284 | ;/////////////////////////////////////////////// |
294 | mov eax,4 |
285 | ;mov eax,4 |
295 | mov ebx,49*65536+384 |
286 | mov ebx,49*65536+384 |
296 | xor ecx,ecx |
- | |
297 | mov ecx,0x10ffffff |
- | |
298 | mov edx,game_finished |
287 | mov edx,game_finished |
299 | mov esi,size_of_game_finished-game_finished |
- | |
300 | int 0x40 |
288 | int 0x40 |
301 | - | ||
302 | call draw_table |
289 | call draw_table |
303 | 290 | ||
304 | movzx edx,byte [current_block_color] |
291 | movzx edx,byte [current_block_color] |
305 | call draw_block |
292 | call draw_block |
306 | 293 | ||
307 | cld |
294 | cld |
308 | mov ebx,38*65536+35 ; draw info text with function 4 |
295 | mov ebx,38*65536+35 ; draw info text with function 4 |
309 | mov ecx,0x10ffffff ; color |
296 | mov ecx,[sc.work_text] ; color |
- | 297 | or ecx,0x90000000 |
|
310 | mov edx,text |
298 | mov edx,text |
311 | mov esi,7 |
- | |
312 | mov eax,4 |
299 | mov eax,4 |
313 | int 0x40 |
300 | int 0x40 |
314 | 301 | ||
315 | call write_score |
302 | call write_score |
316 | 303 | ||
317 | mov eax,12 ; function 12:tell os about windowdraw |
304 | mov eax,12 ; function 12:tell os about windowdraw |
318 | mov ebx,2 ; 2, end of draw |
305 | mov ebx,2 ; 2, end of draw |
319 | int 0x40 |
306 | int 0x40 |
320 | 307 | ||
321 | ret |
308 | ret |
322 | 309 | ||
323 | ;------------------------------------------------------------- |
310 | ;------------------------------------------------------------- |
324 | ; CHECK CRASH |
311 | ; CHECK CRASH |
325 | ; output Z flag => OK |
312 | ; output Z flag => OK |
326 | ; NZ flag => NO |
313 | ; NZ flag => NO |
327 | ;------------------------------------------------------------- |
314 | ;------------------------------------------------------------- |
328 | 315 | ||
329 | check_crash: mov ebx,[current_block_pointer] |
316 | check_crash: mov ebx,[current_block_pointer] |
330 | 317 | ||
331 | mov edx,[current_block_y] |
318 | mov edx,[current_block_y] |
332 | imul edx,LEN_X |
319 | imul edx,LEN_X |
333 | add edx,[current_block_x] ;find the offset in tetris_t |
320 | add edx,[current_block_x] ;find the offset in tetris_t |
334 | 321 | ||
335 | add edx,table_tetris |
322 | add edx,table_tetris |
336 | 323 | ||
337 | mov ecx,4 |
324 | mov ecx,4 |
338 | xor ax,ax |
325 | xor ax,ax |
339 | 326 | ||
340 | adr_1: cmp byte [ebx],1 |
327 | adr_1: cmp byte [ebx],1 |
341 | jne adr_2 |
328 | jne adr_2 |
342 | add al,[edx] |
329 | add al,[edx] |
343 | adc ah,0 |
330 | adc ah,0 |
344 | adr_2: inc ebx |
331 | adr_2: inc ebx |
345 | inc edx |
332 | inc edx |
346 | 333 | ||
347 | cmp byte [ebx],1 |
334 | cmp byte [ebx],1 |
348 | jne adr_3 |
335 | jne adr_3 |
349 | add al,[edx] |
336 | add al,[edx] |
350 | adc ah,0 |
337 | adc ah,0 |
351 | adr_3: inc ebx |
338 | adr_3: inc ebx |
352 | inc edx |
339 | inc edx |
353 | 340 | ||
354 | cmp byte [ebx],1 |
341 | cmp byte [ebx],1 |
355 | jne adr_4 |
342 | jne adr_4 |
356 | add al,[edx] |
343 | add al,[edx] |
357 | adc ah,0 |
344 | adc ah,0 |
358 | adr_4: inc ebx |
345 | adr_4: inc ebx |
359 | inc edx |
346 | inc edx |
360 | 347 | ||
361 | cmp byte [ebx],1 |
348 | cmp byte [ebx],1 |
362 | jne adr_5 |
349 | jne adr_5 |
363 | add al,[edx] |
350 | add al,[edx] |
364 | adc ah,0 |
351 | adc ah,0 |
365 | adr_5: inc ebx |
352 | adr_5: inc ebx |
366 | add edx,LEN_X-3 |
353 | add edx,LEN_X-3 |
367 | 354 | ||
368 | loop adr_1 |
355 | loop adr_1 |
369 | or ax,ax |
356 | or ax,ax |
370 | ret |
357 | ret |
371 | ;------------------------------------------------------------- |
358 | ;------------------------------------------------------------- |
372 | ;NEW BLOCK |
359 | ;NEW BLOCK |
373 | ;------------------------------------------------------------- |
360 | ;------------------------------------------------------------- |
374 | new_block: mov dword [current_block_y],1 |
361 | new_block: mov dword [current_block_y],1 |
375 | mov dword [current_block_x],7 |
362 | mov dword [current_block_x],7 |
376 | 363 | ||
377 | call random |
364 | call random |
378 | and al,7 |
365 | and al,7 |
379 | setz ah |
366 | setz ah |
380 | add al,ah |
367 | add al,ah |
381 | mov [current_block_color],al |
368 | mov [current_block_color],al |
382 | 369 | ||
383 | call random |
370 | call random |
384 | ;and eax,15 |
371 | ;and eax,15 |
385 | ; ---- Ivan ---- |
372 | ; ---- Ivan ---- |
386 | and eax,0xff |
373 | and eax,0xff |
387 | @@: |
374 | @@: |
388 | cmp eax,_MAXBLOCKS_ |
375 | cmp eax,_MAXBLOCKS_ |
389 | jl @f |
376 | jl @f |
390 | add eax,-(_MAXBLOCKS_) |
377 | add eax,-(_MAXBLOCKS_) |
391 | jmp @b |
378 | jmp @b |
392 | @@: |
379 | @@: |
393 | ; ---- Ivan ---- |
380 | ; ---- Ivan ---- |
394 | mov edx,[block_table+eax*4] |
381 | mov edx,[block_table+eax*4] |
395 | mov [current_block_pointer],edx |
382 | mov [current_block_pointer],edx |
396 | 383 | ||
397 | mov byte [delay],22 ;19 ;!!! 15 |
384 | mov byte [delay],22 ;19 ;!!! 15 |
398 | ret |
385 | ret |
399 | ;------------------------------------------------------------- |
386 | ;------------------------------------------------------------- |
400 | ; FIX BLOCK |
387 | ; FIX BLOCK |
401 | ;------------------------------------------------------------- |
388 | ;------------------------------------------------------------- |
402 | fix_block: mov ebx,[current_block_pointer] |
389 | fix_block: mov ebx,[current_block_pointer] |
403 | 390 | ||
404 | mov edx,[current_block_y] |
391 | mov edx,[current_block_y] |
405 | imul edx,LEN_X |
392 | imul edx,LEN_X |
406 | add edx,[current_block_x] ;find the offset in tetris_t |
393 | add edx,[current_block_x] ;find the offset in tetris_t |
407 | 394 | ||
408 | add edx,table_tetris |
395 | add edx,table_tetris |
409 | 396 | ||
410 | mov ecx,4 |
397 | mov ecx,4 |
411 | mov al,[current_block_color] |
398 | mov al,[current_block_color] |
412 | 399 | ||
413 | adr_21: cmp byte [ebx],1 |
400 | adr_21: cmp byte [ebx],1 |
414 | jne adr_22 |
401 | jne adr_22 |
415 | mov [edx],al |
402 | mov [edx],al |
416 | adr_22: inc ebx |
403 | adr_22: inc ebx |
417 | inc edx |
404 | inc edx |
418 | 405 | ||
419 | cmp byte [ebx],1 |
406 | cmp byte [ebx],1 |
420 | jne adr_23 |
407 | jne adr_23 |
421 | mov [edx],al |
408 | mov [edx],al |
422 | adr_23: inc ebx |
409 | adr_23: inc ebx |
423 | inc edx |
410 | inc edx |
424 | 411 | ||
425 | cmp byte [ebx],1 |
412 | cmp byte [ebx],1 |
426 | jne adr_24 |
413 | jne adr_24 |
427 | mov [edx],al |
414 | mov [edx],al |
428 | adr_24: inc ebx |
415 | adr_24: inc ebx |
429 | inc edx |
416 | inc edx |
430 | 417 | ||
431 | cmp byte [ebx],1 |
418 | cmp byte [ebx],1 |
432 | jne adr_25 |
419 | jne adr_25 |
433 | mov [edx],al |
420 | mov [edx],al |
434 | adr_25: inc ebx |
421 | adr_25: inc ebx |
435 | add edx,LEN_X-3 |
422 | add edx,LEN_X-3 |
436 | 423 | ||
437 | loop adr_21 |
424 | loop adr_21 |
438 | ret |
425 | ret |
439 | 426 | ||
440 | ;-------------------------------------------------------------- |
427 | ;-------------------------------------------------------------- |
441 | ; DRAW_TABLE |
428 | ; DRAW_TABLE |
442 | ;-------------------------------------------------------------- |
429 | ;-------------------------------------------------------------- |
443 | draw_table: mov esi,table_tetris+LEN_X*BORDER_TOP+BORDER_LEFT |
430 | draw_table: mov esi,table_tetris+LEN_X*BORDER_TOP+BORDER_LEFT |
444 | 431 | ||
445 | mov ebx,X_LOCATION*65536+ADOBE_SIZE |
432 | mov ebx,X_LOCATION*65536+ADOBE_SIZE |
446 | mov ecx,Y_LOCATION*65536+ADOBE_SIZE |
433 | mov ecx,Y_LOCATION*65536+ADOBE_SIZE |
447 | mov edi,LEN_Y-BORDER_TOP-BORDER_BOTTOM |
434 | mov edi,LEN_Y-BORDER_TOP-BORDER_BOTTOM |
448 | y_draw: push edi |
435 | y_draw: push edi |
449 | 436 | ||
450 | mov edi,LEN_X-BORDER_LEFT-BORDER_RIGHT |
437 | mov edi,LEN_X-BORDER_LEFT-BORDER_RIGHT |
451 | x_draw: push edi |
438 | x_draw: push edi |
452 | ; pusha |
439 | ; pusha |
453 | ; mov eax,5 |
440 | ; mov eax,5 |
454 | ; mov ebx,10 |
441 | ; mov ebx,10 |
455 | ; int 0x40 |
442 | ; int 0x40 |
456 | ; popa |
443 | ; popa |
457 | mov ax,13 |
444 | mov eax,13 |
458 | movzx edx,byte [esi] |
445 | movzx edx,byte [esi] |
459 | mov edx,[color_table+edx*4] |
446 | mov edx,[color_table+edx*4] |
460 | int 0x40 |
447 | int 0x40 |
461 | call draw_frames |
448 | call draw_frames |
462 | inc esi |
449 | inc esi |
463 | add ebx,65536*ADOBE_SIZE |
450 | add ebx,65536*ADOBE_SIZE |
464 | pop edi |
451 | pop edi |
465 | dec edi |
452 | dec edi |
466 | jnz x_draw |
453 | jnz x_draw |
467 | 454 | ||
468 | add esi,BORDER_LEFT+BORDER_RIGHT |
455 | add esi,BORDER_LEFT+BORDER_RIGHT |
469 | mov ebx,X_LOCATION*65536+ADOBE_SIZE |
456 | mov ebx,X_LOCATION*65536+ADOBE_SIZE |
470 | add ecx,65536*ADOBE_SIZE |
457 | add ecx,65536*ADOBE_SIZE |
471 | pop edi |
458 | pop edi |
472 | dec edi |
459 | dec edi |
473 | jnz y_draw |
460 | jnz y_draw |
474 | 461 | ||
475 | ret |
462 | ret |
476 | ;-------------------------------------------------------------- |
463 | ;-------------------------------------------------------------- |
477 | ;DRAW BLOCK |
464 | ;DRAW BLOCK |
478 | ; |
465 | ; |
479 | ; ebx=x [0..LEN_X-1] |
466 | ; ebx=x [0..LEN_X-1] |
480 | ; ecx=y [0..LEN_Y-1] |
467 | ; ecx=y [0..LEN_Y-1] |
481 | ; edi=pointer block |
468 | ; edi=pointer block |
482 | ;-------------------------------------------------------------- |
469 | ;-------------------------------------------------------------- |
483 | draw_block: |
470 | draw_block: |
484 | 471 | ||
485 | mov eax,13 |
472 | mov eax,13 |
486 | mov edx,[color_table+edx*4] |
473 | mov edx,[color_table+edx*4] |
487 | 474 | ||
488 | mov ebx,[current_block_x] |
475 | mov ebx,[current_block_x] |
489 | mov ecx,[current_block_y] |
476 | mov ecx,[current_block_y] |
490 | mov edi,[current_block_pointer] |
477 | mov edi,[current_block_pointer] |
491 | 478 | ||
492 | sub ebx,BORDER_LEFT |
479 | sub ebx,BORDER_LEFT |
493 | imul ebx,ADOBE_SIZE |
480 | imul ebx,ADOBE_SIZE |
494 | add ebx,X_LOCATION |
481 | add ebx,X_LOCATION |
495 | shl ebx,16 |
482 | shl ebx,16 |
496 | mov bx,ADOBE_SIZE |
483 | mov bx,ADOBE_SIZE |
497 | 484 | ||
498 | sub ecx,BORDER_TOP |
485 | sub ecx,BORDER_TOP |
499 | imul ecx,ADOBE_SIZE |
486 | imul ecx,ADOBE_SIZE |
500 | add ecx,Y_LOCATION |
487 | add ecx,Y_LOCATION |
501 | shl ecx,16 |
488 | shl ecx,16 |
502 | mov cx,ADOBE_SIZE |
489 | mov cx,ADOBE_SIZE |
503 | 490 | ||
504 | mov dword [TMP_1],4 |
491 | mov dword [TMP_1],4 |
505 | adr_122: mov dword [TMP_0],4 |
492 | adr_122: mov dword [TMP_0],4 |
506 | adr_121: cmp byte [edi],0 |
493 | adr_121: cmp byte [edi],0 |
507 | je adr_120 |
494 | je adr_120 |
508 | 495 | ||
509 | int 040h |
496 | int 040h |
510 | 497 | ||
511 | call draw_frames |
498 | call draw_frames |
512 | 499 | ||
513 | adr_120: inc edi |
500 | adr_120: inc edi |
514 | add ebx,ADOBE_SIZE*65536 |
501 | add ebx,ADOBE_SIZE*65536 |
515 | dec dword [TMP_0] |
502 | dec dword [TMP_0] |
516 | jnz adr_121 |
503 | jnz adr_121 |
517 | sub ebx,4*ADOBE_SIZE*65536 |
504 | sub ebx,4*ADOBE_SIZE*65536 |
518 | add ecx,ADOBE_SIZE*65536 |
505 | add ecx,ADOBE_SIZE*65536 |
519 | dec dword [TMP_1] |
506 | dec dword [TMP_1] |
520 | jnz adr_122 |
507 | jnz adr_122 |
521 | 508 | ||
522 | ret |
509 | ret |
523 | 510 | ||
524 | draw_frames: |
511 | draw_frames: |
525 | cmp edx,0 |
512 | cmp edx,0 |
526 | jne df1 |
513 | jne df1 |
527 | ret |
514 | ret |
528 | df1: |
515 | df1: |
529 | pusha |
516 | pusha |
530 | mov bx,1 |
517 | mov bx,1 |
531 | add edx,0x282828 |
518 | add edx,0x282828 |
532 | mov eax,13 |
519 | mov eax,13 |
533 | int 0x40 |
520 | int 0x40 |
534 | popa |
521 | popa |
535 | 522 | ||
536 | pusha |
523 | pusha |
537 | mov cx,1 |
524 | mov cx,1 |
538 | add edx,0x282828 |
525 | add edx,0x282828 |
539 | mov eax,13 |
526 | mov eax,13 |
540 | int 0x40 |
527 | int 0x40 |
541 | popa |
528 | popa |
542 | 529 | ||
543 | pusha |
530 | pusha |
544 | push ebx |
531 | push ebx |
545 | sub bx,1 |
532 | sub bx,1 |
546 | add [esp+2],bx |
533 | add [esp+2],bx |
547 | pop ebx |
534 | pop ebx |
548 | mov bx,1 |
535 | mov bx,1 |
549 | shr edx,1 |
536 | shr edx,1 |
550 | and edx,0x7f7f7f |
537 | and edx,0x7f7f7f |
551 | mov eax,13 |
538 | mov eax,13 |
552 | int 0x40 |
539 | int 0x40 |
553 | popa |
540 | popa |
554 | 541 | ||
555 | pusha |
542 | pusha |
556 | push ecx |
543 | push ecx |
557 | sub cx,1 |
544 | sub cx,1 |
558 | add [esp+2],cx |
545 | add [esp+2],cx |
559 | pop ecx |
546 | pop ecx |
560 | mov cx,1 |
547 | mov cx,1 |
561 | shr edx,1 |
548 | shr edx,1 |
562 | and edx,0x7f7f7f |
549 | and edx,0x7f7f7f |
563 | mov eax,13 |
550 | mov eax,13 |
564 | int 0x40 |
551 | int 0x40 |
565 | popa |
552 | popa |
566 | 553 | ||
567 | ret |
554 | ret |
568 | 555 | ||
569 | 556 | ||
570 | ;-------------------------------------------------------------- |
557 | ;-------------------------------------------------------------- |
571 | clear_table_tetris: |
558 | clear_table_tetris: |
572 | cld |
559 | cld |
573 | mov al,1 |
560 | mov al,1 |
574 | mov edi,table_tetris |
561 | mov edi,table_tetris |
575 | mov ecx,LEN_X*BORDER_TOP |
562 | mov ecx,LEN_X*BORDER_TOP |
576 | rep stosb |
563 | rep stosb |
577 | 564 | ||
578 | mov edx,LEN_Y-BORDER_TOP-BORDER_BOTTOM |
565 | mov edx,LEN_Y-BORDER_TOP-BORDER_BOTTOM |
579 | adr300: mov cl,BORDER_LEFT |
566 | adr300: mov cl,BORDER_LEFT |
580 | rep stosb |
567 | rep stosb |
581 | dec ax ;AL=0 |
568 | dec ax ;AL=0 |
582 | mov cl,LEN_X-BORDER_LEFT-BORDER_RIGHT |
569 | mov cl,LEN_X-BORDER_LEFT-BORDER_RIGHT |
583 | rep stosb |
570 | rep stosb |
584 | inc ax ;AL=1 |
571 | inc ax ;AL=1 |
585 | mov cl,BORDER_RIGHT |
572 | mov cl,BORDER_RIGHT |
586 | rep stosb |
573 | rep stosb |
587 | dec dx |
574 | dec dx |
588 | jne adr300 |
575 | jne adr300 |
589 | 576 | ||
590 | mov ecx,LEN_X*BORDER_BOTTOM |
577 | mov ecx,LEN_X*BORDER_BOTTOM |
591 | rep stosb |
578 | rep stosb |
592 | ret |
579 | ret |
593 | ;-------------------------------------------------------------- |
580 | ;-------------------------------------------------------------- |
594 | ;edx = pointer |
581 | ;edx = pointer |
595 | ;ebx = contatore |
582 | ;ebx = contatore |
596 | check_full_line: |
583 | check_full_line: |
597 | std |
584 | std |
598 | mov al,0 |
585 | mov al,0 |
599 | mov edx,table_tetris+LEN_X*(LEN_Y-BORDER_BOTTOM)-1 |
586 | mov edx,table_tetris+LEN_X*(LEN_Y-BORDER_BOTTOM)-1 |
600 | mov ebx,(LEN_Y-BORDER_TOP-BORDER_BOTTOM-1)*LEN_X |
587 | mov ebx,(LEN_Y-BORDER_TOP-BORDER_BOTTOM-1)*LEN_X |
601 | 588 | ||
602 | adr_5000: mov edi,edx |
589 | adr_5000: mov edi,edx |
603 | mov ecx,LEN_X-BORDER_LEFT-BORDER_RIGHT+1;Wildwest's fix for bug |
590 | mov ecx,LEN_X-BORDER_LEFT-BORDER_RIGHT+1;Wildwest's fix for bug |
604 | ;(was LEN_X-BORDER_LEFT-BORDER_RIGHT) |
591 | ;(was LEN_X-BORDER_LEFT-BORDER_RIGHT) |
605 | repne scasb |
592 | repne scasb |
606 | jz no_full_line |
593 | jz no_full_line |
607 | 594 | ||
608 | lea esi,[edx-LEN_X] |
595 | lea esi,[edx-LEN_X] |
609 | mov edi,edx |
596 | mov edi,edx |
610 | mov ecx,ebx |
597 | mov ecx,ebx |
611 | rep movsb |
598 | rep movsb |
612 | sub edi,BORDER_RIGHT |
599 | sub edi,BORDER_RIGHT |
613 | mov ecx,LEN_X-BORDER_LEFT-BORDER_RIGHT |
600 | mov ecx,LEN_X-BORDER_LEFT-BORDER_RIGHT |
614 | rep stosb |
601 | rep stosb |
615 | add dword [score],50 |
602 | add dword [score],50 |
616 | jmp adr_5000 |
603 | jmp adr_5000 |
617 | 604 | ||
618 | no_full_line: sub edx,LEN_X |
605 | no_full_line: sub edx,LEN_X |
619 | sub ebx,LEN_X |
606 | sub ebx,LEN_X |
620 | jnz adr_5000 |
607 | jnz adr_5000 |
621 | 608 | ||
622 | ret |
609 | ret |
623 | ;-------------------------------------------------------------- |
610 | ;-------------------------------------------------------------- |
624 | random: mov eax,[generator] |
611 | random: mov eax,[generator] |
625 | add eax,-43ab45b5h |
612 | add eax,-43ab45b5h |
626 | ror eax,1 |
613 | ror eax,1 |
627 | xor eax,32c4324fh |
614 | xor eax,32c4324fh |
628 | ror eax,1 |
615 | ror eax,1 |
629 | mov [generator],eax |
616 | mov [generator],eax |
630 | ; --- IVAN --- |
617 | ; --- IVAN --- |
631 | push ebx |
618 | push ebx |
632 | mov eax,26 |
619 | mov eax,26 |
633 | mov ebx,9 |
620 | mov ebx,9 |
634 | int 0x40 |
621 | int 0x40 |
635 | pop ebx |
622 | pop ebx |
636 | xor eax,0xdeadbeef |
623 | xor eax,0xdeadbeef |
637 | add eax,[generator] |
624 | add eax,[generator] |
638 | ; --- IVAN --- |
625 | ; --- IVAN --- |
639 | mov [generator],eax ; Halyavin |
626 | mov [generator],eax ; Halyavin |
640 | ret |
627 | ret |
641 | ;-------------------------------------------------------------- |
628 | ;-------------------------------------------------------------- |
642 | number_to_str: mov edi,end_number_str-1 |
629 | number_to_str: mov edi,end_number_str-1 |
643 | mov ecx,9;size_of_number_str |
630 | mov ecx,9;size_of_number_str |
644 | mov ebx,10 |
631 | mov ebx,10 |
645 | cld |
632 | cld |
646 | new_digit: xor edx,edx |
633 | new_digit: xor edx,edx |
647 | div ebx |
634 | div ebx |
648 | add dl,'0' |
635 | add dl,'0' |
649 | mov [edi],dl |
636 | mov [edi],dl |
650 | dec edi |
637 | dec edi |
651 | loop new_digit |
638 | loop new_digit |
652 | ret |
639 | ret |
653 | ;-------------------------------------------------------------- |
640 | ;-------------------------------------------------------------- |
654 | write_score: |
641 | write_score: |
655 | mov eax,[score] |
642 | mov eax,[score] |
656 | call number_to_str |
643 | call number_to_str |
657 | 644 | ||
658 | mov ebx,100*65536+100 ;clear box to write new score |
645 | mov ebx,90*65536+35 ; draw info text with function 4 |
659 | mov ecx,35*65536+15 |
646 | mov ecx,[sc.work_text] ; color |
660 | mov edx,BACKGROUND |
- | |
661 | mov eax,13 |
- | |
662 | int 40h |
- | |
663 | - | ||
664 | mov ebx,100*65536+35 ; draw info text with function 4 |
- | |
665 | mov ecx,0xffff00 ; color |
647 | or ecx,0x50000000 |
666 | mov edx,number_str |
648 | mov edx,number_str |
- | 649 | mov esi,[size_of_number_str] |
|
667 | mov esi,[size_of_number_str] |
650 | mov edi,[sc.work] |
668 | mov eax,4 |
651 | mov eax,4 |
669 | int 0x40 |
652 | int 0x40 |
670 | ret |
653 | ret |
671 | 654 | ||
672 | ; DATA AREA |
655 | ; DATA AREA |
673 | 656 | ||
674 | ;-------------------------------------------------------------- |
657 | ;-------------------------------------------------------------- |
675 | ;DEFINITION BLOCKS |
658 | ;DEFINITION BLOCKS |
676 | ;-------------------------------------------------------------- |
659 | ;-------------------------------------------------------------- |
677 | t_block_0: db 0,0,0,0 |
660 | t_block_0: db 0,0,0,0 |
678 | db 1,1,1,0 |
661 | db 1,1,1,0 |
679 | db 0,1,0,0 |
662 | db 0,1,0,0 |
680 | db 0,0,0,0 |
663 | db 0,0,0,0 |
681 | dd t_block_3 |
664 | dd t_block_3 |
682 | 665 | ||
683 | t_block_1: db 0,1,0,0 |
666 | t_block_1: db 0,1,0,0 |
684 | db 1,1,0,0 |
667 | db 1,1,0,0 |
685 | db 0,1,0,0 |
668 | db 0,1,0,0 |
686 | db 0,0,0,0 |
669 | db 0,0,0,0 |
687 | dd t_block_0 |
670 | dd t_block_0 |
688 | 671 | ||
689 | t_block_2: db 0,1,0,0 |
672 | t_block_2: db 0,1,0,0 |
690 | db 1,1,1,0 |
673 | db 1,1,1,0 |
691 | db 0,0,0,0 |
674 | db 0,0,0,0 |
692 | db 0,0,0,0 |
675 | db 0,0,0,0 |
693 | dd t_block_1 |
676 | dd t_block_1 |
694 | 677 | ||
695 | t_block_3 db 0,1,0,0 |
678 | t_block_3 db 0,1,0,0 |
696 | db 0,1,1,0 |
679 | db 0,1,1,0 |
697 | db 0,1,0,0 |
680 | db 0,1,0,0 |
698 | db 0,0,0,0 |
681 | db 0,0,0,0 |
699 | dd t_block_2 |
682 | dd t_block_2 |
700 | ;-------------------------------------------------------------- |
683 | ;-------------------------------------------------------------- |
701 | i_block_0: db 0,1,0,0 |
684 | i_block_0: db 0,1,0,0 |
702 | db 0,1,0,0 |
685 | db 0,1,0,0 |
703 | db 0,1,0,0 |
686 | db 0,1,0,0 |
704 | db 0,1,0,0 |
687 | db 0,1,0,0 |
705 | dd i_block_1 |
688 | dd i_block_1 |
706 | 689 | ||
707 | i_block_1: db 0,0,0,0 |
690 | i_block_1: db 0,0,0,0 |
708 | db 1,1,1,1 |
691 | db 1,1,1,1 |
709 | db 0,0,0,0 |
692 | db 0,0,0,0 |
710 | db 0,0,0,0 |
693 | db 0,0,0,0 |
711 | dd i_block_0 |
694 | dd i_block_0 |
712 | ;-------------------------------------------------------------- |
695 | ;-------------------------------------------------------------- |
713 | q_block_0: db 0,1,1,0 |
696 | q_block_0: db 0,1,1,0 |
714 | db 0,1,1,0 |
697 | db 0,1,1,0 |
715 | db 0,0,0,0 |
698 | db 0,0,0,0 |
716 | db 0,0,0,0 |
699 | db 0,0,0,0 |
717 | dd q_block_0 |
700 | dd q_block_0 |
718 | ;-------------------------------------------------------------- |
701 | ;-------------------------------------------------------------- |
719 | s_block_0: |
702 | s_block_0: |
720 | db 0,0,0,0 |
703 | db 0,0,0,0 |
721 | db 0,1,1,0 |
704 | db 0,1,1,0 |
722 | db 1,1,0,0 |
705 | db 1,1,0,0 |
723 | db 0,0,0,0 |
706 | db 0,0,0,0 |
724 | dd s_block_1 |
707 | dd s_block_1 |
725 | 708 | ||
726 | s_block_1: db 1,0,0,0 |
709 | s_block_1: db 1,0,0,0 |
727 | db 1,1,0,0 |
710 | db 1,1,0,0 |
728 | db 0,1,0,0 |
711 | db 0,1,0,0 |
729 | db 0,0,0,0 |
712 | db 0,0,0,0 |
730 | dd s_block_0 |
713 | dd s_block_0 |
731 | ;-------------------------------------------------------------- |
714 | ;-------------------------------------------------------------- |
732 | l_block_0: db 0,0,0,0 |
715 | l_block_0: db 0,0,0,0 |
733 | db 1,1,1,0 |
716 | db 1,1,1,0 |
734 | db 1,0,0,0 |
717 | db 1,0,0,0 |
735 | db 0,0,0,0 |
718 | db 0,0,0,0 |
736 | dd l_block_3 |
719 | dd l_block_3 |
737 | 720 | ||
738 | l_block_1: db 1,1,0,0 |
721 | l_block_1: db 1,1,0,0 |
739 | db 0,1,0,0 |
722 | db 0,1,0,0 |
740 | db 0,1,0,0 |
723 | db 0,1,0,0 |
741 | db 0,0,0,0 |
724 | db 0,0,0,0 |
742 | dd l_block_0 |
725 | dd l_block_0 |
743 | 726 | ||
744 | l_block_2: db 0,0,1,0 |
727 | l_block_2: db 0,0,1,0 |
745 | db 1,1,1,0 |
728 | db 1,1,1,0 |
746 | db 0,0,0,0 |
729 | db 0,0,0,0 |
747 | db 0,0,0,0 |
730 | db 0,0,0,0 |
748 | dd l_block_1 |
731 | dd l_block_1 |
749 | 732 | ||
750 | l_block_3: db 0,1,0,0 |
733 | l_block_3: db 0,1,0,0 |
751 | db 0,1,0,0 |
734 | db 0,1,0,0 |
752 | db 0,1,1,0 |
735 | db 0,1,1,0 |
753 | db 0,0,0,0 |
736 | db 0,0,0,0 |
754 | dd l_block_2 |
737 | dd l_block_2 |
755 | ;----------------------------------------------- |
738 | ;----------------------------------------------- |
756 | 739 | ||
757 | g_block_0: |
740 | g_block_0: |
758 | 741 | ||
759 | db 0,1,0,0 |
742 | db 0,1,0,0 |
760 | db 0,1,0,0 |
743 | db 0,1,0,0 |
761 | db 1,1,0,0 |
744 | db 1,1,0,0 |
762 | db 0,0,0,0 |
745 | db 0,0,0,0 |
763 | dd g_block_1 |
746 | dd g_block_1 |
764 | 747 | ||
765 | g_block_1: |
748 | g_block_1: |
766 | db 0,0,0,0 |
749 | db 0,0,0,0 |
767 | db 1,1,1,0 |
750 | db 1,1,1,0 |
768 | db 0,0,1,0 |
751 | db 0,0,1,0 |
769 | db 0,0,0,0 |
752 | db 0,0,0,0 |
770 | dd g_block_2 |
753 | dd g_block_2 |
771 | 754 | ||
772 | g_block_2: |
755 | g_block_2: |
773 | db 0,1,1,0 |
756 | db 0,1,1,0 |
774 | db 0,1,0,0 |
757 | db 0,1,0,0 |
775 | db 0,1,0,0 |
758 | db 0,1,0,0 |
776 | db 0,0,0,0 |
759 | db 0,0,0,0 |
777 | dd g_block_3 |
760 | dd g_block_3 |
778 | 761 | ||
779 | g_block_3: |
762 | g_block_3: |
780 | db 1,0,0,0 |
763 | db 1,0,0,0 |
781 | db 1,1,1,0 |
764 | db 1,1,1,0 |
782 | db 0,0,0,0 |
765 | db 0,0,0,0 |
783 | db 0,0,0,0 |
766 | db 0,0,0,0 |
784 | dd g_block_0 |
767 | dd g_block_0 |
785 | 768 | ||
786 | ;----------------------------------- |
769 | ;----------------------------------- |
787 | 770 | ||
788 | k_block_0: |
771 | k_block_0: |
789 | db 0,0,0,0 |
772 | db 0,0,0,0 |
790 | db 1,1,0,0 |
773 | db 1,1,0,0 |
791 | db 0,1,1,0 |
774 | db 0,1,1,0 |
792 | db 0,0,0,0 |
775 | db 0,0,0,0 |
793 | dd k_block_1 |
776 | dd k_block_1 |
794 | 777 | ||
795 | k_block_1: |
778 | k_block_1: |
796 | db 0,1,0,0 |
779 | db 0,1,0,0 |
797 | db 1,1,0,0 |
780 | db 1,1,0,0 |
798 | db 1,0,0,0 |
781 | db 1,0,0,0 |
799 | db 0,0,0,0 |
782 | db 0,0,0,0 |
800 | dd k_block_0 |
783 | dd k_block_0 |
801 | 784 | ||
802 | ;----------------------------------- |
785 | ;----------------------------------- |
803 | 786 | ||
804 | color_table: dd 00000000h ;black 0 |
787 | color_table: dd 00000000h ;black 0 |
805 | dd 00cccccch ;white 1 |
788 | dd 00cccccch ;white 1 |
806 | dd 00cc0000h ;red 2 |
789 | dd 00cc0000h ;red 2 |
807 | dd 0000cc00h ;green 3 |
790 | dd 0000cc00h ;green 3 |
808 | dd 000000cch ;blue 4 |
791 | dd 000000cch ;blue 4 |
809 | dd 00cccc00h ;yellow 5 |
792 | dd 00cccc00h ;yellow 5 |
810 | dd 0000cccch ;cyan 6 |
793 | dd 0000cccch ;cyan 6 |
811 | dd 00cc00cch ;pink 7 |
794 | dd 00cc00cch ;pink 7 |
812 | 795 | ||
813 | block_table: |
796 | block_table: |
814 | dd t_block_0 ; t |
797 | dd t_block_0 ; t |
815 | dd t_block_1 |
798 | dd t_block_1 |
816 | dd t_block_2 |
799 | dd t_block_2 |
817 | dd t_block_3 |
800 | dd t_block_3 |
818 | dd i_block_0 ; i |
801 | dd i_block_0 ; i |
819 | dd i_block_1 |
802 | dd i_block_1 |
820 | dd i_block_0 |
803 | dd i_block_0 |
821 | dd i_block_1 |
804 | dd i_block_1 |
822 | dd q_block_0 ; q |
805 | dd q_block_0 ; q |
823 | dd q_block_0 |
806 | dd q_block_0 |
824 | dd q_block_0 |
807 | dd q_block_0 |
825 | dd q_block_0 |
808 | dd q_block_0 |
826 | dd s_block_0 ; s |
809 | dd s_block_0 ; s |
827 | dd s_block_1 |
810 | dd s_block_1 |
828 | dd s_block_0 |
811 | dd s_block_0 |
829 | dd s_block_1 |
812 | dd s_block_1 |
830 | dd l_block_0 ; l |
813 | dd l_block_0 ; l |
831 | dd l_block_1 |
814 | dd l_block_1 |
832 | dd l_block_2 |
815 | dd l_block_2 |
833 | dd l_block_3 |
816 | dd l_block_3 |
834 | dd g_block_0 ; g |
817 | dd g_block_0 ; g |
835 | dd g_block_1 |
818 | dd g_block_1 |
836 | dd g_block_2 |
819 | dd g_block_2 |
837 | dd g_block_3 |
820 | dd g_block_3 |
838 | dd k_block_0 ; k |
821 | dd k_block_0 ; k |
839 | dd k_block_1 |
822 | dd k_block_1 |
840 | dd k_block_0 |
823 | dd k_block_0 |
841 | dd k_block_1 |
824 | dd k_block_1 |
842 | 825 | ||
843 | if lang eq ru |
826 | if lang eq ru |
844 | - | ||
845 | labelt: |
827 | |
846 | db ' 1.6 - ' |
- | |
847 | labellen: |
- | |
848 | labe: |
828 | header db ' 1.61 - ',0 |
849 | db '' |
- | |
850 | labelen: |
829 | labe db '',0 |
851 | text: db '窨: ' |
830 | text db '窨:',0 |
852 | game_finished: db ' ' |
- | |
853 | size_of_game_finished: |
831 | game_finished: db '',0 |
854 | 832 | ||
855 | else |
833 | else |
856 | - | ||
857 | labelt: |
834 | |
858 | db 'TETRIS 1.6 - ARROWS & SPACE' |
- | |
859 | labellen: |
- | |
860 | labe: |
835 | header db 'TETRIS 1.61 - ARROWS & SPACE',0 |
861 | db 'PAUSE' |
- | |
862 | labelen: |
836 | labe db 'PAUSE',0 |
863 | text: db 'Score: ' |
837 | text db 'Score:',0 |
864 | game_finished: db 'NEW GAME' |
- | |
865 | size_of_game_finished: |
838 | game_finished: db 'NEW GAME',0 |
866 | 839 | ||
867 | end if |
840 | end if |
868 | 841 | ||
869 | pauses dd 0 ;/// Wildwest |
842 | pauses dd 0 ;/// Wildwest |
870 | parallel dd 1 |
843 | parallel dd 1 |
871 | score: dd 0 |
844 | score: dd 0 |
872 | TMP_0: dd 0 |
845 | TMP_0: dd 0 |
873 | TMP_1: dd 0 |
846 | TMP_1: dd 0 |
874 | generator: dd 0 |
847 | generator: dd 0 |
875 | current_block_x: dd 0 |
848 | current_block_x: dd 0 |
876 | current_block_y: dd 0 |
849 | current_block_y: dd 0 |
877 | current_block_pointer: dd 0 |
850 | current_block_pointer: dd 0 |
878 | current_block_color: db 0 |
851 | current_block_color: db 0 |
879 | number_str: db 0,0,0,0,0,0,0,0,0 |
852 | number_str: db 0,0,0,0,0,0,0,0,0 |
880 | end_number_str: |
853 | end_number_str: |
881 | size_of_number_str dd 9 |
854 | size_of_number_str dd 9 |
882 | delay: db 40 |
855 | delay: db 40 |
- | 856 | sc system_colors |
|
883 | table_tetris: |
857 | table_tetris: |
884 | 858 | ||
885 | I_END: |
859 | I_END: |
- | 860 |