Subversion Repositories Kolibri OS

Rev

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 11... Line 11...
11
fgcolor  equ  0x00E7C750      ;to
11
fgcolor  equ  0x00E7C750      ;to
12
fg2color equ  0x00E0B0A0      ;colorref
12
fg2color equ  0x00E0B0A0      ;colorref
13
fg3color equ  0x007F7F55
13
fg3color equ  0x007F7F55
14
btcolor  equ  0x005B6200
14
btcolor  equ  0x005B6200
Line -... Line 15...
-
 
15
 
Line 15... Line 16...
15
 
16
include '..\..\macros.inc'
Line 16... Line 17...
16
 
17
 
Line 32... Line 33...
32
     call draw_board
33
     call draw_board
Line 33... Line 34...
33
 
34
 
Line 34... Line 35...
34
still:
35
still:
35
 
36
 
Line 36... Line 37...
36
    mov  eax,10 		; wait here for event
37
    mov  eax,10 		; wait here for event
37
    int  0x40
38
    mcall
38
 
39
 
39
    cmp  eax,1			; redraw request ?
40
    cmp  eax,1			; redraw request ?
Line 51... Line 52...
51
    call draw_message
52
    call draw_message
52
    jmp  still
53
    jmp  still
Line 53... Line 54...
53
 
54
 
54
  key:				; key
55
  key:				; key
55
    mov  eax,2			; just read it and ignore
56
    mov  eax,2			; just read it and ignore
56
    int  0x40
57
    mcall
57
    jmp  still
58
    jmp  still
58
  button:			; button
59
  button:			; button
59
    call get_input
60
    call get_input
Line 60... Line 61...
60
    jmp  still
61
    jmp  still
61
 
62
 
62
 
63
 
63
 
64
 
Line 64... Line 65...
64
get_input:
65
get_input:
65
pusha
66
pusha
Line 66... Line 67...
66
    mov  eax,17 		; get id
67
    mov  eax,17 		; get id
67
    int  0x40
68
    mcall
68
 
69
 
69
    cmp  ah,1			; button id=1 ?
70
    cmp  ah,1			; button id=1 ?
70
    jne  .noclose
71
    jne  .noclose
71
 
72
 
72
    mov  eax,-1 		; close this program
73
    mov  eax,-1 		; close this program
Line 237... Line 238...
237
call show_score
238
call show_score
238
mov  ecx,10
239
mov  ecx,10
239
.down:
240
.down:
240
mov  eax,5
241
mov  eax,5
241
mov  ebx,10
242
mov  ebx,10
242
int  0x40
243
mcall
243
mov  eax,11
244
mov  eax,11
244
int  0x40
245
mcall
245
cmp  eax,1
246
cmp  eax,1
246
jne  .nored
247
jne  .nored
247
call draw_window
248
call draw_window
248
call draw_board
249
call draw_board
249
jmp  .nothing
250
jmp  .nothing
Line 280... Line 281...
280
      mov   ecx,dword [speed]
281
      mov   ecx,dword [speed]
281
      add   byte [esi],10
282
      add   byte [esi],10
282
      .down:
283
      .down:
283
      mov   eax,5
284
      mov   eax,5
284
      mov   ebx,2
285
      mov   ebx,2
285
      int   0x40
286
      mcall
286
      mov   eax,11
287
      mov   eax,11
287
      int   0x40
288
      mcall
288
      cmp   eax,1
289
      cmp   eax,1
289
      jne   .nored
290
      jne   .nored
290
      call  draw_window
291
      call  draw_window
291
      .nored:
292
      .nored:
292
      cmp   eax,3
293
      cmp   eax,3
Line 305... Line 306...
305
    cmp [stat],1
306
    cmp [stat],1
306
    jne .loose
307
    jne .loose
307
    call draw_message
308
    call draw_message
308
    mov   eax,5
309
    mov   eax,5
309
    mov   ebx,500
310
    mov   ebx,500
310
    int   0x40
311
    mcall
311
    mov [stat],0
312
    mov [stat],0
312
    inc [level]
313
    inc [level]
313
    cmp [speed],6		 ;waterflowdelay < 6 ?
314
    cmp [speed],6		 ;waterflowdelay < 6 ?
314
    jle .skipsub
315
    jle .skipsub
315
    sub [speed],2
316
    sub [speed],2
Line 329... Line 330...
329
pusha
330
pusha
330
mov  eax,13			 ;clear time and score area
331
mov  eax,13			 ;clear time and score area
331
mov  ebx,50 shl 16 +15
332
mov  ebx,50 shl 16 +15
332
mov  ecx,395 shl 16 +15
333
mov  ecx,395 shl 16 +15
333
mov  edx,bgcolor
334
mov  edx,bgcolor
334
int  0x40
335
mcall
335
add  ebx,60 shl 16 + 20
336
add  ebx,60 shl 16 + 20
336
int  0x40
337
mcall
337
add  ebx,80 shl 16
338
add  ebx,80 shl 16
338
int  0x40
339
mcall
339
mov  eax,47
340
mov  eax,47
340
mov  ebx,0x20000
341
mov  ebx,0x20000
341
mov  ecx,[time]
342
mov  ecx,[time]
342
mov  edx,50*65536+398
343
mov  edx,50*65536+398
343
mov  esi,fg2color
344
mov  esi,fg2color
344
int  0x40
345
mcall
345
mov  ebx,0x50000
346
mov  ebx,0x50000
346
mov  ecx,[score]
347
mov  ecx,[score]
347
add  edx,60 shl 16
348
add  edx,60 shl 16
348
int  0x40
349
mcall
349
mov  ebx,0x20000
350
mov  ebx,0x20000
350
mov  ecx,[level]
351
mov  ecx,[level]
351
add  edx,80 shl 16
352
add  edx,80 shl 16
352
int  0x40
353
mcall
Line 353... Line 354...
353
 
354
 
354
popa
355
popa
Line 458... Line 459...
458
    je	.nomessage
459
    je	.nomessage
459
    mov  eax,13
460
    mov  eax,13
460
    mov  ebx,146 shl 16 + 200
461
    mov  ebx,146 shl 16 + 200
461
    mov  ecx,190 shl 16 + 40
462
    mov  ecx,190 shl 16 + 40
462
    mov  edx,0x0
463
    mov  edx,0x0
463
    int  0x40
464
    mcall
464
    add  ebx,2 shl 16 - 4
465
    add  ebx,2 shl 16 - 4
465
    add  ecx,2 shl 16 - 4
466
    add  ecx,2 shl 16 - 4
466
    mov  edx,fgcolor
467
    mov  edx,fgcolor
467
    int  0x40
468
    mcall
Line 468... Line 469...
468
 
469
 
469
    cmp   [stat],1
470
    cmp   [stat],1
470
     je   .winmessage
471
     je   .winmessage
471
    mov   eax,4
472
    mov   eax,4
472
    mov   ebx,186 shl 16 +200
473
    mov   ebx,186 shl 16 +200
473
    mov   edx,lbl_gameover+1
474
    mov   edx,lbl_gameover+1
474
    movzx esi,byte [lbl_gameover]
475
    movzx esi,byte [lbl_gameover]
475
    mov   ecx,btcolor
476
    mov   ecx,btcolor
476
    add   ecx,0x10000000
477
    add   ecx,0x10000000
477
    int   0x40
478
    mcall
478
    add   ebx,8 shl 16 +17
479
    add   ebx,8 shl 16 +17
479
    mov   edx,lbl_yscore+1
480
    mov   edx,lbl_yscore+1
480
    movzx esi,byte [lbl_yscore]
481
    movzx esi,byte [lbl_yscore]
481
    mov   ecx,btcolor
482
    mov   ecx,btcolor
482
    int   0x40
483
    mcall
483
    mov   esi,ecx	;color
484
    mov   esi,ecx	;color
484
    mov   edx,ebx	;pos
485
    mov   edx,ebx	;pos
485
    add   edx,80 shl 16
486
    add   edx,80 shl 16
486
    mov   ebx,0x50000	 ;type
487
    mov   ebx,0x50000	 ;type
487
    mov   ecx,[score]	 ;inp
488
    mov   ecx,[score]	 ;inp
488
    mov   eax,47
489
    mov   eax,47
489
    int   0x40
490
    mcall
490
    jmp   .nomessage
491
    jmp   .nomessage
491
   .winmessage:
492
   .winmessage:
492
    mov   eax,4
493
    mov   eax,4
493
    mov   ebx,152 shl 16 +200
494
    mov   ebx,152 shl 16 +200
494
    mov   edx,lbl_win+1
495
    mov   edx,lbl_win+1
495
    movzx esi,byte [lbl_win]
496
    movzx esi,byte [lbl_win]
496
    mov   ecx,btcolor
497
    mov   ecx,btcolor
497
    add   ecx,0x10000000
498
    add   ecx,0x10000000
498
    int   0x40
499
    mcall
499
    mov   ebx,152 shl 16 +217
500
    mov   ebx,152 shl 16 +217
500
    add   edx,esi
501
    add   edx,esi
501
    mov   ecx,btcolor
502
    mov   ecx,btcolor
502
    int   0x40
503
    mcall
503
   .nomessage:
504
   .nomessage:
504
popa
505
popa
Line 505... Line 506...
505
ret
506
ret
Line 517... Line 518...
517
    push edx
518
    push edx
518
    mov  eax,8
519
    mov  eax,8
519
    movsx edx, byte [map]
520
    movsx edx, byte [map]
520
    add  edx,9		    ;button-id = map-pos + 10;gen_image inkrements
521
    add  edx,9		    ;button-id = map-pos + 10;gen_image inkrements
521
    add  edx,0x50000000     ;no button image - no esi need
522
    add  edx,0x50000000     ;no button image - no esi need
522
    int  0x40
523
    mcall
523
    pop  edx
524
    pop  edx
524
    push ebx
525
    push ebx
525
    push ecx
526
    push ecx
526
    mov  eax,7
527
    mov  eax,7
527
    mov  ebx,0x10000
528
    mov  ebx,0x10000
528
    mov  ecx,32 shl 16 +32
529
    mov  ecx,32 shl 16 +32
529
    int  0x40
530
    mcall
530
    pop  ecx
531
    pop  ecx
531
    pop  ebx
532
    pop  ebx
532
    add  edx,33 shl 16
533
    add  edx,33 shl 16
533
    add  ebx,33 shl 16
534
    add  ebx,33 shl 16
534
    dec  edi
535
    dec  edi
Line 547... Line 548...
547
draw_window:
548
draw_window:
548
pusha
549
pusha
Line 549... Line 550...
549
 
550
 
550
    mov  eax,12 		   ; function 12:tell os about windowdraw
551
    mov  eax,12 		   ; function 12:tell os about windowdraw
551
    mov  ebx,1			   ; 1, start of draw
552
    mov  ebx,1			   ; 1, start of draw
Line 552... Line 553...
552
    int  0x40
553
    mcall
553
 
554
 
554
				   ; DRAW WINDOW
555
				   ; DRAW WINDOW
555
    mov  eax,0			   ; function 0 : define and draw window
556
    mov  eax,0			   ; function 0 : define and draw window
556
    mov  ebx,100*65536+492	   ; [x start] *65536 + [x size]
557
    mov  ebx,100*65536+492	   ; [x start] *65536 + [x size]
557
    mov  ecx,100*65536+420	   ; [y start] *65536 + [y size]
558
    mov  ecx,100*65536+420	   ; [y start] *65536 + [y size]
558
    mov  edx,bgcolor		   ; color of work area RRGGBB,8->color gl
559
    mov  edx,bgcolor		   ; color of work area RRGGBB,8->color gl
559
    or   edx,0x13000000
560
    or   edx,0x13000000
Line 560... Line 561...
560
    mov  edi,header
561
    mov  edi,title
561
    int  0x40
562
    mcall
562
 
563
 
563
    mov   eax,8
564
    mov   eax,8
564
    mov   ebx,84*65536+72
565
    mov   ebx,84*65536+72
565
    mov   ecx,28*65536+15
566
    mov   ecx,28*65536+15
566
    mov   edx,2
567
    mov   edx,2
567
    mov   esi,btcolor
568
    mov   esi,btcolor
568
    int   0x40
569
    mcall
569
    add   ebx,76 shl 16
570
    add   ebx,76 shl 16
570
    inc   edx
571
    inc   edx
571
    int   0x40
572
    mcall
Line 572... Line 573...
572
    add   ebx,76 shl 16
573
    add   ebx,76 shl 16
573
    inc   edx
574
    inc   edx
574
    int   0x40
575
    mcall
575
 
576
 
576
    mov   eax,4
577
    mov   eax,4
577
    mov   ebx,26 shl 16 +32
578
    mov   ebx,26 shl 16 +32
578
    mov   ecx,fgcolor
579
    mov   ecx,fgcolor
579
    mov   edx,lbl_toolbar+1
580
    mov   edx,lbl_toolbar+1
580
    movsx esi, byte [lbl_toolbar]
581
    movsx esi, byte [lbl_toolbar]
581
    int   0x40
582
    mcall
582
    mov   ebx,18 shl 16 +398
583
    mov   ebx,18 shl 16 +398
583
    mov   edx,lbl_score+1
584
    mov   edx,lbl_score+1
584
    movsx esi, byte [lbl_score]
585
    movsx esi, byte [lbl_score]
585
    int   0x40
586
    mcall
586
    mov   ebx,350 shl 16 +405
587
    mov   ebx,350 shl 16 +405
Line 587... Line 588...
587
    mov   ecx,fg3color
588
    mov   ecx,fg3color
588
    mov   edx,lbl_copy+1
589
    mov   edx,lbl_copy+1
589
    movsx esi,byte [lbl_copy]
590
    movsx esi,byte [lbl_copy]
Line 590... Line 591...
590
    int   0x40
591
    mcall
591
 
592
 
Line 592... Line 593...
592
    mov  eax,12 		   ; function 12:tell os about windowdraw
593
    mov  eax,12 		   ; function 12:tell os about windowdraw
Line 593... Line 594...
593
    mov  ebx,2			   ; 2, end of draw
594
    mov  ebx,2			   ; 2, end of draw
594
    int  0x40
595
    mcall
595
 
596
 
596
    popa
597
    popa
597
    ret
598
    ret
598
 
599