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