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