Subversion Repositories Kolibri OS

Rev

Rev 551 | Rev 686 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 551 Rev 685
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
 
-
 
61
include 'lang.inc'
60
include 'lang.inc'
62
include '..\..\..\macros.inc'
61
include 'macros.inc'
Line 63... Line 62...
63
 
62
 
Line 64... Line 63...
64
 
63
 
Line 65... Line 64...
65
START:                          ; start of execution
64
START:                          ; start of execution
66
 
65
 
67
 
66
 
68
    ; --  quickcode - start
67
    ; --  quickcode - start
69
 
68
 
70
    mov   eax,3
69
    mov   eax,3
Line 86... Line 85...
86
    call draw_block
85
    call draw_block
Line 87... Line 86...
87
 
86
 
Line 88... Line 87...
88
attesa:
87
attesa:
89
 
88
 
Line 90... Line 89...
90
    mov  eax,11                 ; get event
89
    mov  eax,11                 ; get event
91
    mcall
90
    int  0x40
92
 
91
 
93
    cmp  eax,1                  ; redraw request ?
92
    cmp  eax,1                  ; redraw request ?
Line 124... Line 123...
124
                jne   block_crash
123
                jne   block_crash
125
draw:           movzx edx,byte [current_block_color]
124
draw:           movzx edx,byte [current_block_color]
126
                call  draw_block
125
                call  draw_block
127
                mov   eax,5
126
                mov   eax,5
128
                movzx ebx,byte [delay]
127
                movzx ebx,byte [delay]
129
                mcall
128
                int   0x40
130
                jmp   still
129
                jmp   still
Line 131... Line 130...
131
 
130
 
132
block_crash:    dec dword [current_block_y]
131
block_crash:    dec dword [current_block_y]
133
                movzx edx,byte [current_block_color]
132
                movzx edx,byte [current_block_color]
Line 139... Line 138...
139
                inc dword [score]
138
                inc dword [score]
140
                call write_score
139
                call write_score
141
                call check_crash
140
                call check_crash
142
                jz adr400
141
                jz adr400
143
aspetta:        mov eax,10
142
aspetta:        mov eax,10
144
                mcall
143
                int 0x40
145
                cmp eax,1
144
                cmp eax,1
146
                jne adr10000
145
                jne adr10000
147
                call draw_window
146
                call draw_window
148
adr10000:       cmp eax,3
147
adr10000:       cmp eax,3
149
                jne aspetta
148
                jne aspetta
150
new_game:       mov eax,17
149
new_game:       mov eax,17
151
                mcall
150
                int 0x40
152
                cmp ah,1
151
                cmp ah,1
153
                jnz adr401
152
                jnz adr401
154
                jmp end_program
153
                jmp end_program
155
adr401:      
154
adr401:      
156
;///////////////////////////////////////////////////// Wildwest
155
;///////////////////////////////////////////////////// Wildwest
Line 163... Line 162...
163
 
162
 
164
adr400:         movzx edx,byte [current_block_color]
163
adr400:         movzx edx,byte [current_block_color]
165
                call draw_block
164
                call draw_block
166
                mov eax,5
165
                mov eax,5
167
                movzx ebx,byte [delay]
166
                movzx ebx,byte [delay]
168
                mcall
167
                int 0x40
Line 169... Line 168...
169
                jmp still
168
                jmp still
170
 
169
 
-
 
170
key:            mov  eax,2
-
 
171
                int  0x40
-
 
172
				cmp eax,1
-
 
173
				jne getkeyi
-
 
174
				mov ah,dh
-
 
175
				jmp adr32
-
 
176
 
Line 171... Line 177...
171
key:            mov  eax,2
177
getkeyi:		mov dh,ah
172
                mcall
178
				jmp key
173
 
179
 
174
adr32:          cmp ah,LEFT_KEY
180
adr32:          cmp ah,LEFT_KEY
Line 209... Line 215...
209
adr62:          jmp scendi
215
adr62:          jmp scendi
Line 210... Line 216...
210
 
216
 
211
 
217
 
212
button:                       ; button
218
button:                       ; button
213
    mov  eax,17
219
    mov  eax,17
214
    mcall
220
    int  0x40
215
    cmp  ah,1                   ; button id=1 ?
221
    cmp  ah,1                   ; button id=1 ?
216
    jz  end_program
222
    jz  end_program
217
    cmp ah,2
223
    cmp ah,2
218
    jz go_new_game
224
    jz go_new_game
219
    cmp  ah,3                   ; button id=3 ? ///Wildwest's  'Pause' button
225
    cmp  ah,3                   ; button id=3 ? ///Wildwest's  'Pause' button
Line 220... Line 226...
220
    jz  pause_program
226
    jz  pause_program
221
    jmp still
227
    jmp still
222
 
228
 
Line 223... Line 229...
223
end_program:
229
end_program:
224
    or   eax,-1                ; close this program
230
    or   eax,-1                ; close this program
225
    mcall
231
    int  0x40
226
 
232
 
Line 244... Line 250...
244
 
250
 
245
    mov  eax,48
251
    mov  eax,48
246
    mov  ebx,3
252
    mov  ebx,3
247
    mov  ecx,sc
253
    mov  ecx,sc
248
    mov  edx,sizeof.system_colors
254
    mov  edx,sizeof.system_colors
Line 249... Line 255...
249
    mcall
255
    int  0x40
250
 
256
 
251
    mov  eax,12                    ; function 12:tell os about windowdraw
257
    mov  eax,12                    ; function 12:tell os about windowdraw
Line 252... Line 258...
252
    mov  ebx,1                     ; 1, start of draw
258
    mov  ebx,1                     ; 1, start of draw
253
    mcall
259
    int  0x40
254
 
260
 
255
                                 ; DRAW WINDOW
261
                                 ; DRAW WINDOW
256
  xor  eax,eax                   ; function 0 : define and draw window
262
  xor  eax,eax                   ; function 0 : define and draw window
257
  mov  ebx,320*65536+(LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2
263
  mov  ebx,320*65536+(LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2
258
  mov  ecx,25*65536+ (LEN_Y-BORDER_TOP-BORDER_BOTTOM)*ADOBE_SIZE+Y_LOCATION+30
264
  mov  ecx,25*65536+ (LEN_Y-BORDER_TOP-BORDER_BOTTOM)*ADOBE_SIZE+Y_LOCATION+30
259
  mov  edx,[sc.work]             ; color of work area RRGGBB
265
  mov  edx,[sc.work]             ; color of work area RRGGBB
Line 260... Line 266...
260
  or   edx,0x14000000
266
  or   edx,0x13000000
261
  mov  edi,title                ; WINDOW LABEL
267
  mov  edi,header                ; WINDOW LABEL
262
  mcall
268
  int  0x40
263
 
269
 
264
                                    
270
                                    
265
    mov eax,8
271
    mov eax,8
266
    mov ebx,30*65536+100
272
    mov ebx,30*65536+100
267
    mov ecx,378*65536+18
273
    mov ecx,378*65536+18
268
    mov edx,2
274
    mov edx,2
269
    mov esi,[sc.work_button]
275
    mov esi,[sc.work_button]
270
    mcall
276
    int 0x40
271
;/////////////////////////////////////////////// Wildwest's  'Pause' button
277
;/////////////////////////////////////////////// Wildwest's  'Pause' button
272
    ;mov eax,8
278
    ;mov eax,8
Line 273... Line 279...
273
    mov ebx,132*65536+102
279
    mov ebx,132*65536+102
274
    mov ecx,378*65536+18
280
    mov ecx,378*65536+18
275
    mov edx,3
281
    mov edx,3
276
    mov esi,[sc.work_button];
282
    mov esi,[sc.work_button];
277
    mcall
283
    int 0x40
278
 
284
 
279
    mov  eax,4                      ; function 4 : write text to window
285
    mov  eax,4                      ; function 4 : write text to window
280
    mov  ebx,164*65536+384          ; [x start] *65536 + [y start]
286
    mov  ebx,164*65536+384          ; [x start] *65536 + [y start]
281
    mov  ecx,[sc.work_button_text]  ; color of text RRGGBB
287
    mov  ecx,[sc.work_button_text]  ; color of text RRGGBB
282
    or   ecx,0x90000000
288
    or   ecx,0x90000000
283
    mov  edx,labe                   ; pointer to text
289
    mov  edx,labe                   ; pointer to text
284
    mcall
290
    int  0x40
Line 285... Line 291...
285
;///////////////////////////////////////////////
291
;///////////////////////////////////////////////
286
    ;mov eax,4
292
    ;mov eax,4
Line 296... Line 302...
296
    mov  ebx,38*65536+35           ; draw info text with function 4
302
    mov  ebx,38*65536+35           ; draw info text with function 4
297
    mov  ecx,[sc.work_text]              ; color
303
    mov  ecx,[sc.work_text]              ; color
298
    or   ecx,0x90000000    
304
    or   ecx,0x90000000    
299
    mov  edx,text
305
    mov  edx,text
300
    mov  eax,4
306
    mov  eax,4
301
    mcall
307
    int  0x40
Line 302... Line 308...
302
 
308
 
Line 303... Line 309...
303
    call write_score
309
    call write_score
304
 
310
 
305
    mov  eax,12                    ; function 12:tell os about windowdraw
311
    mov  eax,12                    ; function 12:tell os about windowdraw
Line 306... Line 312...
306
    mov  ebx,2                     ; 2, end of draw
312
    mov  ebx,2                     ; 2, end of draw
Line 307... Line 313...
307
    mcall
313
    int  0x40
308
 
314
 
Line 438... Line 444...
438
                mov edi,LEN_X-BORDER_LEFT-BORDER_RIGHT
444
                mov edi,LEN_X-BORDER_LEFT-BORDER_RIGHT
439
x_draw:         push edi
445
x_draw:         push edi
440
              ;  pusha
446
              ;  pusha
441
              ;  mov eax,5
447
              ;  mov eax,5
442
              ;  mov ebx,10
448
              ;  mov ebx,10
443
              ;  mcall
449
              ;  int 0x40
444
              ;  popa
450
              ;  popa
445
                mov eax,13
451
                mov eax,13
446
                movzx edx,byte [esi]
452
                movzx edx,byte [esi]
447
                mov edx,[color_table+edx*4]
453
                mov edx,[color_table+edx*4]
448
                mcall
454
                int 0x40
449
                call draw_frames
455
                call draw_frames
450
                inc esi
456
                inc esi
451
                add ebx,65536*ADOBE_SIZE
457
                add ebx,65536*ADOBE_SIZE
452
                pop edi
458
                pop edi
453
                dec edi
459
                dec edi
Line 492... Line 498...
492
                mov dword [TMP_1],4
498
                mov dword [TMP_1],4
493
adr_122:        mov dword [TMP_0],4
499
adr_122:        mov dword [TMP_0],4
494
adr_121:        cmp byte [edi],0
500
adr_121:        cmp byte [edi],0
495
                je adr_120
501
                je adr_120
Line 496... Line 502...
496
 
502
 
Line 497... Line 503...
497
                mcall
503
                int 040h
Line 498... Line 504...
498
 
504
 
499
                call draw_frames
505
                call draw_frames
Line 516... Line 522...
516
             df1:
522
             df1:
517
                 pusha
523
                 pusha
518
                 mov bx,1
524
                 mov bx,1
519
                 add edx,0x282828
525
                 add edx,0x282828
520
                 mov eax,13
526
                 mov eax,13
521
                 mcall
527
                 int 0x40
522
                 popa
528
                 popa
Line 523... Line 529...
523
 
529
 
524
                 pusha
530
                 pusha
525
                 mov cx,1
531
                 mov cx,1
526
                 add edx,0x282828
532
                 add edx,0x282828
527
                 mov eax,13
533
                 mov eax,13
528
                 mcall
534
                 int 0x40
Line 529... Line 535...
529
                 popa
535
                 popa
530
 
536
 
531
                 pusha
537
                 pusha
Line 535... Line 541...
535
                 pop  ebx
541
                 pop  ebx
536
                 mov  bx,1
542
                 mov  bx,1
537
                 shr  edx,1
543
                 shr  edx,1
538
                 and  edx,0x7f7f7f
544
                 and  edx,0x7f7f7f
539
                 mov  eax,13
545
                 mov  eax,13
540
                 mcall
546
                 int  0x40
541
                 popa
547
                 popa
Line 542... Line 548...
542
 
548
 
543
                 pusha
549
                 pusha
544
                 push ecx
550
                 push ecx
Line 547... Line 553...
547
                 pop  ecx
553
                 pop  ecx
548
                 mov  cx,1
554
                 mov  cx,1
549
                 shr  edx,1
555
                 shr  edx,1
550
                 and  edx,0x7f7f7f
556
                 and  edx,0x7f7f7f
551
                 mov  eax,13
557
                 mov  eax,13
552
                 mcall
558
                 int  0x40
553
                 popa
559
                 popa
Line 554... Line 560...
554
 
560
 
Line 617... Line 623...
617
                mov [generator],eax
623
                mov [generator],eax
618
                ; --- IVAN ---
624
                ; --- IVAN ---
619
                push ebx
625
                push ebx
620
                mov eax,26
626
                mov eax,26
621
                mov ebx,9
627
                mov ebx,9
622
                mcall
628
                int 0x40
623
                pop ebx
629
                pop ebx
624
                xor eax,0xdeadbeef
630
                xor eax,0xdeadbeef
625
                add eax,[generator]
631
                add eax,[generator]
626
                ; --- IVAN ---
632
                ; --- IVAN ---
627
                mov [generator],eax ; Halyavin
633
                mov [generator],eax ; Halyavin
Line 648... Line 654...
648
    or   ecx,0x50000000    
654
    or   ecx,0x50000000    
649
    mov  edx,number_str
655
    mov  edx,number_str
650
    mov  esi,[size_of_number_str]
656
    mov  esi,[size_of_number_str]
651
    mov  edi,[sc.work]
657
    mov  edi,[sc.work]
652
    mov  eax,4
658
    mov  eax,4
653
    mcall
659
    int  0x40
654
    ret
660
    ret
Line 655... Line 661...
655
 
661
 
Line 656... Line 662...
656
; DATA AREA
662
; DATA AREA
Line 824... Line 830...
824
    dd k_block_0
830
    dd k_block_0
825
    dd k_block_1
831
    dd k_block_1
Line 826... Line 832...
826
 
832
 
Line 827... Line 833...
827
if lang eq ru
833
if lang eq ru
828
 
834
 
829
  title         db '’…’ˆ‘ 1.61 - ‘’…‹Šˆ ˆ Ž…‹',0
835
  header         db '’…’ˆ‘ 1.61 - ‘’…‹Šˆ ˆ Ž…‹',0
830
  labe           db '€“‡€',0
836
  labe           db '€“‡€',0
Line 831... Line 837...
831
  text           db 'Žçª¨:',0
837
  text           db 'Žçª¨:',0
Line 832... Line 838...
832
  game_finished: db 'Ž‚€Ÿ',0
838
  game_finished: db 'Ž‚€Ÿ',0
833
 
839
 
834
else
840
else
835
 
841
 
Line 836... Line 842...
836
  title         db 'TETRIS 1.61 - ARROWS & SPACE',0
842
  header         db 'TETRIS 1.61 - ARROWS & SPACE',0