Rev 205 | Rev 551 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 205 | Rev 485 | ||
---|---|---|---|
Line 55... | Line 55... | ||
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 | ||
60 | include 'lang.inc' |
61 | include 'lang.inc' |
61 | include 'macros.inc' |
62 | include '..\..\..\macros.inc' |
Line 62... | Line 63... | ||
62 | 63 | ||
Line 63... | Line 64... | ||
63 | 64 | ||
Line 64... | Line 65... | ||
64 | START: ; start of execution |
65 | START: ; start of execution |
65 | 66 | ||
66 | 67 | ||
67 | ; -- quickcode - start |
68 | ; -- quickcode - start |
68 | 69 | ||
69 | mov eax,3 |
70 | mov eax,3 |
Line 85... | Line 86... | ||
85 | call draw_block |
86 | call draw_block |
Line 86... | Line 87... | ||
86 | 87 | ||
Line 87... | Line 88... | ||
87 | attesa: |
88 | attesa: |
88 | 89 | ||
Line 89... | Line 90... | ||
89 | mov eax,11 ; get event |
90 | mov eax,11 ; get event |
90 | int 0x40 |
91 | mcall |
91 | 92 | ||
92 | cmp eax,1 ; redraw request ? |
93 | cmp eax,1 ; redraw request ? |
Line 123... | Line 124... | ||
123 | jne block_crash |
124 | jne block_crash |
124 | draw: movzx edx,byte [current_block_color] |
125 | draw: movzx edx,byte [current_block_color] |
125 | call draw_block |
126 | call draw_block |
126 | mov eax,5 |
127 | mov eax,5 |
127 | movzx ebx,byte [delay] |
128 | movzx ebx,byte [delay] |
128 | int 0x40 |
129 | mcall |
129 | jmp still |
130 | jmp still |
Line 130... | Line 131... | ||
130 | 131 | ||
131 | block_crash: dec dword [current_block_y] |
132 | block_crash: dec dword [current_block_y] |
132 | movzx edx,byte [current_block_color] |
133 | movzx edx,byte [current_block_color] |
Line 138... | Line 139... | ||
138 | inc dword [score] |
139 | inc dword [score] |
139 | call write_score |
140 | call write_score |
140 | call check_crash |
141 | call check_crash |
141 | jz adr400 |
142 | jz adr400 |
142 | aspetta: mov eax,10 |
143 | aspetta: mov eax,10 |
143 | int 0x40 |
144 | mcall |
144 | cmp eax,1 |
145 | cmp eax,1 |
145 | jne adr10000 |
146 | jne adr10000 |
146 | call draw_window |
147 | call draw_window |
147 | adr10000: cmp eax,3 |
148 | adr10000: cmp eax,3 |
148 | jne aspetta |
149 | jne aspetta |
149 | new_game: mov eax,17 |
150 | new_game: mov eax,17 |
150 | int 0x40 |
151 | mcall |
151 | cmp ah,1 |
152 | cmp ah,1 |
152 | jnz adr401 |
153 | jnz adr401 |
153 | jmp end_program |
154 | jmp end_program |
154 | adr401: |
155 | adr401: |
155 | ;///////////////////////////////////////////////////// Wildwest |
156 | ;///////////////////////////////////////////////////// Wildwest |
Line 162... | Line 163... | ||
162 | 163 | ||
163 | adr400: movzx edx,byte [current_block_color] |
164 | adr400: movzx edx,byte [current_block_color] |
164 | call draw_block |
165 | call draw_block |
165 | mov eax,5 |
166 | mov eax,5 |
166 | movzx ebx,byte [delay] |
167 | movzx ebx,byte [delay] |
167 | int 0x40 |
168 | mcall |
Line 168... | Line 169... | ||
168 | jmp still |
169 | jmp still |
169 | 170 | ||
Line 170... | Line 171... | ||
170 | key: mov eax,2 |
171 | key: mov eax,2 |
171 | int 0x40 |
172 | mcall |
172 | 173 | ||
173 | adr32: cmp ah,LEFT_KEY |
174 | adr32: cmp ah,LEFT_KEY |
Line 208... | Line 209... | ||
208 | adr62: jmp scendi |
209 | adr62: jmp scendi |
Line 209... | Line 210... | ||
209 | 210 | ||
210 | 211 | ||
211 | button: ; button |
212 | button: ; button |
212 | mov eax,17 |
213 | mov eax,17 |
213 | int 0x40 |
214 | mcall |
214 | cmp ah,1 ; button id=1 ? |
215 | cmp ah,1 ; button id=1 ? |
215 | jz end_program |
216 | jz end_program |
216 | cmp ah,2 |
217 | cmp ah,2 |
217 | jz go_new_game |
218 | jz go_new_game |
218 | cmp ah,3 ; button id=3 ? ///Wildwest's 'Pause' button |
219 | cmp ah,3 ; button id=3 ? ///Wildwest's 'Pause' button |
Line 219... | Line 220... | ||
219 | jz pause_program |
220 | jz pause_program |
220 | jmp still |
221 | jmp still |
221 | 222 | ||
Line 222... | Line 223... | ||
222 | end_program: |
223 | end_program: |
223 | or eax,-1 ; close this program |
224 | or eax,-1 ; close this program |
224 | int 0x40 |
225 | mcall |
225 | 226 | ||
Line 243... | Line 244... | ||
243 | 244 | ||
244 | mov eax,48 |
245 | mov eax,48 |
245 | mov ebx,3 |
246 | mov ebx,3 |
246 | mov ecx,sc |
247 | mov ecx,sc |
247 | mov edx,sizeof.system_colors |
248 | mov edx,sizeof.system_colors |
Line 248... | Line 249... | ||
248 | int 0x40 |
249 | mcall |
249 | 250 | ||
250 | mov eax,12 ; function 12:tell os about windowdraw |
251 | mov eax,12 ; function 12:tell os about windowdraw |
Line 251... | Line 252... | ||
251 | mov ebx,1 ; 1, start of draw |
252 | mov ebx,1 ; 1, start of draw |
252 | int 0x40 |
253 | mcall |
253 | 254 | ||
254 | ; DRAW WINDOW |
255 | ; DRAW WINDOW |
255 | xor eax,eax ; function 0 : define and draw window |
256 | xor eax,eax ; function 0 : define and draw window |
256 | mov ebx,320*65536+(LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2 |
257 | mov ebx,320*65536+(LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2 |
257 | mov ecx,25*65536+ (LEN_Y-BORDER_TOP-BORDER_BOTTOM)*ADOBE_SIZE+Y_LOCATION+30 |
258 | mov ecx,25*65536+ (LEN_Y-BORDER_TOP-BORDER_BOTTOM)*ADOBE_SIZE+Y_LOCATION+30 |
258 | mov edx,[sc.work] ; color of work area RRGGBB |
259 | mov edx,[sc.work] ; color of work area RRGGBB |
Line 259... | Line 260... | ||
259 | or edx,0x13000000 |
260 | or edx,0x13000000 |
260 | mov edi,header ; WINDOW LABEL |
261 | mov edi,title ; WINDOW LABEL |
261 | int 0x40 |
262 | mcall |
262 | 263 | ||
263 | 264 | ||
264 | mov eax,8 |
265 | mov eax,8 |
265 | mov ebx,30*65536+100 |
266 | mov ebx,30*65536+100 |
266 | mov ecx,378*65536+18 |
267 | mov ecx,378*65536+18 |
267 | mov edx,2 |
268 | mov edx,2 |
268 | mov esi,[sc.work_button] |
269 | mov esi,[sc.work_button] |
269 | int 0x40 |
270 | mcall |
270 | ;/////////////////////////////////////////////// Wildwest's 'Pause' button |
271 | ;/////////////////////////////////////////////// Wildwest's 'Pause' button |
271 | ;mov eax,8 |
272 | ;mov eax,8 |
Line 272... | Line 273... | ||
272 | mov ebx,132*65536+102 |
273 | mov ebx,132*65536+102 |
273 | mov ecx,378*65536+18 |
274 | mov ecx,378*65536+18 |
274 | mov edx,3 |
275 | mov edx,3 |
275 | mov esi,[sc.work_button]; |
276 | mov esi,[sc.work_button]; |
276 | int 0x40 |
277 | mcall |
277 | 278 | ||
278 | mov eax,4 ; function 4 : write text to window |
279 | mov eax,4 ; function 4 : write text to window |
279 | mov ebx,164*65536+384 ; [x start] *65536 + [y start] |
280 | mov ebx,164*65536+384 ; [x start] *65536 + [y start] |
280 | mov ecx,[sc.work_button_text] ; color of text RRGGBB |
281 | mov ecx,[sc.work_button_text] ; color of text RRGGBB |
281 | or ecx,0x90000000 |
282 | or ecx,0x90000000 |
282 | mov edx,labe ; pointer to text |
283 | mov edx,labe ; pointer to text |
283 | int 0x40 |
284 | mcall |
Line 284... | Line 285... | ||
284 | ;/////////////////////////////////////////////// |
285 | ;/////////////////////////////////////////////// |
285 | ;mov eax,4 |
286 | ;mov eax,4 |
Line 295... | Line 296... | ||
295 | mov ebx,38*65536+35 ; draw info text with function 4 |
296 | mov ebx,38*65536+35 ; draw info text with function 4 |
296 | mov ecx,[sc.work_text] ; color |
297 | mov ecx,[sc.work_text] ; color |
297 | or ecx,0x90000000 |
298 | or ecx,0x90000000 |
298 | mov edx,text |
299 | mov edx,text |
299 | mov eax,4 |
300 | mov eax,4 |
300 | int 0x40 |
301 | mcall |
Line 301... | Line 302... | ||
301 | 302 | ||
Line 302... | Line 303... | ||
302 | call write_score |
303 | call write_score |
303 | 304 | ||
304 | mov eax,12 ; function 12:tell os about windowdraw |
305 | mov eax,12 ; function 12:tell os about windowdraw |
Line 305... | Line 306... | ||
305 | mov ebx,2 ; 2, end of draw |
306 | mov ebx,2 ; 2, end of draw |
Line 306... | Line 307... | ||
306 | int 0x40 |
307 | mcall |
307 | 308 | ||
Line 437... | Line 438... | ||
437 | mov edi,LEN_X-BORDER_LEFT-BORDER_RIGHT |
438 | mov edi,LEN_X-BORDER_LEFT-BORDER_RIGHT |
438 | x_draw: push edi |
439 | x_draw: push edi |
439 | ; pusha |
440 | ; pusha |
440 | ; mov eax,5 |
441 | ; mov eax,5 |
441 | ; mov ebx,10 |
442 | ; mov ebx,10 |
442 | ; int 0x40 |
443 | ; mcall |
443 | ; popa |
444 | ; popa |
444 | mov eax,13 |
445 | mov eax,13 |
445 | movzx edx,byte [esi] |
446 | movzx edx,byte [esi] |
446 | mov edx,[color_table+edx*4] |
447 | mov edx,[color_table+edx*4] |
447 | int 0x40 |
448 | mcall |
448 | call draw_frames |
449 | call draw_frames |
449 | inc esi |
450 | inc esi |
450 | add ebx,65536*ADOBE_SIZE |
451 | add ebx,65536*ADOBE_SIZE |
451 | pop edi |
452 | pop edi |
452 | dec edi |
453 | dec edi |
Line 491... | Line 492... | ||
491 | mov dword [TMP_1],4 |
492 | mov dword [TMP_1],4 |
492 | adr_122: mov dword [TMP_0],4 |
493 | adr_122: mov dword [TMP_0],4 |
493 | adr_121: cmp byte [edi],0 |
494 | adr_121: cmp byte [edi],0 |
494 | je adr_120 |
495 | je adr_120 |
Line 495... | Line 496... | ||
495 | 496 | ||
Line 496... | Line 497... | ||
496 | int 040h |
497 | mcall |
Line 497... | Line 498... | ||
497 | 498 | ||
498 | call draw_frames |
499 | call draw_frames |
Line 515... | Line 516... | ||
515 | df1: |
516 | df1: |
516 | pusha |
517 | pusha |
517 | mov bx,1 |
518 | mov bx,1 |
518 | add edx,0x282828 |
519 | add edx,0x282828 |
519 | mov eax,13 |
520 | mov eax,13 |
520 | int 0x40 |
521 | mcall |
521 | popa |
522 | popa |
Line 522... | Line 523... | ||
522 | 523 | ||
523 | pusha |
524 | pusha |
524 | mov cx,1 |
525 | mov cx,1 |
525 | add edx,0x282828 |
526 | add edx,0x282828 |
526 | mov eax,13 |
527 | mov eax,13 |
527 | int 0x40 |
528 | mcall |
Line 528... | Line 529... | ||
528 | popa |
529 | popa |
529 | 530 | ||
530 | pusha |
531 | pusha |
Line 534... | Line 535... | ||
534 | pop ebx |
535 | pop ebx |
535 | mov bx,1 |
536 | mov bx,1 |
536 | shr edx,1 |
537 | shr edx,1 |
537 | and edx,0x7f7f7f |
538 | and edx,0x7f7f7f |
538 | mov eax,13 |
539 | mov eax,13 |
539 | int 0x40 |
540 | mcall |
540 | popa |
541 | popa |
Line 541... | Line 542... | ||
541 | 542 | ||
542 | pusha |
543 | pusha |
543 | push ecx |
544 | push ecx |
Line 546... | Line 547... | ||
546 | pop ecx |
547 | pop ecx |
547 | mov cx,1 |
548 | mov cx,1 |
548 | shr edx,1 |
549 | shr edx,1 |
549 | and edx,0x7f7f7f |
550 | and edx,0x7f7f7f |
550 | mov eax,13 |
551 | mov eax,13 |
551 | int 0x40 |
552 | mcall |
552 | popa |
553 | popa |
Line 553... | Line 554... | ||
553 | 554 | ||
Line 616... | Line 617... | ||
616 | mov [generator],eax |
617 | mov [generator],eax |
617 | ; --- IVAN --- |
618 | ; --- IVAN --- |
618 | push ebx |
619 | push ebx |
619 | mov eax,26 |
620 | mov eax,26 |
620 | mov ebx,9 |
621 | mov ebx,9 |
621 | int 0x40 |
622 | mcall |
622 | pop ebx |
623 | pop ebx |
623 | xor eax,0xdeadbeef |
624 | xor eax,0xdeadbeef |
624 | add eax,[generator] |
625 | add eax,[generator] |
625 | ; --- IVAN --- |
626 | ; --- IVAN --- |
626 | mov [generator],eax ; Halyavin |
627 | mov [generator],eax ; Halyavin |
Line 647... | Line 648... | ||
647 | or ecx,0x50000000 |
648 | or ecx,0x50000000 |
648 | mov edx,number_str |
649 | mov edx,number_str |
649 | mov esi,[size_of_number_str] |
650 | mov esi,[size_of_number_str] |
650 | mov edi,[sc.work] |
651 | mov edi,[sc.work] |
651 | mov eax,4 |
652 | mov eax,4 |
652 | int 0x40 |
653 | mcall |
653 | ret |
654 | ret |
Line 654... | Line 655... | ||
654 | 655 | ||
Line 655... | Line 656... | ||
655 | ; DATA AREA |
656 | ; DATA AREA |
Line 823... | Line 824... | ||
823 | dd k_block_0 |
824 | dd k_block_0 |
824 | dd k_block_1 |
825 | dd k_block_1 |
Line 825... | Line 826... | ||
825 | 826 | ||
Line 826... | Line 827... | ||
826 | if lang eq ru |
827 | if lang eq ru |
827 | 828 | ||
828 | header db ' 1.61 - ',0 |
829 | title db ' 1.61 - ',0 |
829 | labe db '',0 |
830 | labe db '',0 |
Line 830... | Line 831... | ||
830 | text db '窨:',0 |
831 | text db '窨:',0 |
Line 831... | Line 832... | ||
831 | game_finished: db '',0 |
832 | game_finished: db '',0 |
832 | 833 | ||
833 | else |
834 | else |
834 | 835 | ||
Line 835... | Line 836... | ||
835 | header db 'TETRIS 1.61 - ARROWS & SPACE',0 |
836 | title db 'TETRIS 1.61 - ARROWS & SPACE',0 |