Subversion Repositories Kolibri OS

Rev

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

Rev 2526 Rev 3905
Line 1... Line 1...
1
;
1
;
2
;   pipes for menuet {and now kolibri}
2
;   pipes kolibri
3
;   v1.2
3
;   v1.21
4
;   2006 by Mario Birkner
4
;   2006 by Mario Birkner
5
;
5
;
6
;   l.mod. 27.08.06/15:11
6
;   l.mod. 27.08.06/15:11
7
;
7
;
8
;   Compile with FASM
8
;   Compile with FASM
Line 26... Line 26...
26
	       dd     0x100000		      ; memory for app
26
	       dd     0x100000		      ; memory for app
27
	       dd     0x7fff0		      ; esp
27
	       dd     0x7fff0		      ; esp
28
	       dd     0x0 , 0x0 	      ; I_Param , I_Icon
28
	       dd     0x0 , 0x0 	      ; I_Param , I_Icon
Line 29... Line 29...
29
 
29
 
30
START:				; start of execution
-
 
31
 
-
 
32
     call draw_window
30
START:				; start of execution
Line 33... Line 31...
33
     call draw_board
31
     jmp red
34
 
-
 
35
still:
32
 
36
 
-
 
37
    mov  eax,10 		; wait here for event
-
 
38
    mcall
33
still:
39
 
34
    mcall 10            ; wait here for event
40
    cmp  eax,1			; redraw request ?
35
    cmp  eax,1			; redraw request ?
41
     je  red
36
     je  red
42
    cmp  eax,2			; key in buffer ?
37
    cmp  eax,2			; key in buffer ?
43
     je  key
38
     je  key
44
    cmp  eax,3			; button in buffer ?
-
 
45
     je  button
39
    cmp  eax,3			; button in buffer ?
Line 46... Line 40...
46
 
40
     je  button
47
    jmp  still
41
    jmp  still
48
 
42
 
49
  red:				; redraw
43
  red:				; redraw
50
    call draw_window
44
    call draw_window
Line 51... Line 45...
51
    call draw_board
45
    call draw_board
52
    call draw_message
46
    call draw_message
53
    jmp  still
-
 
54
 
47
    jmp  still
55
  key:				; key
48
 
56
    mov  eax,2			; just read it and ignore
49
  key:				; key
57
    mcall
50
    mcall 2			; just read it and ignore
Line 58... Line 51...
58
    jmp  still
51
    jmp  still
59
  button:			; button
52
  button:			; button
60
    call get_input
53
    call get_input
61
    jmp  still
-
 
Line 62... Line 54...
62
 
54
    jmp  still
63
 
55
 
64
 
-
 
65
get_input:
56
 
66
pusha
-
 
67
    mov  eax,17 		; get id
57
 
68
    mcall
58
get_input:
69
 
59
pusha
70
    cmp  ah,1			; button id=1 ?
60
    mcall 17			; get id
71
    jne  .noclose
61
 
Line 453... Line 443...
453
;   *********************************************
443
;   *********************************************
454
draw_message:
444
draw_message:
455
pusha
445
pusha
456
    cmp  [stat],0
446
    cmp  [stat],0
457
    je	.nomessage
447
	je .nomessage
458
    cmp  [stat],3
-
 
459
    je	.nomessage
-
 
460
    mov  eax,13
448
    mov  eax,13
461
    mov  ebx,146 shl 16 + 200
449
    mov  ebx,146 shl 16 + 200
462
    mov  ecx,190 shl 16 + 40
450
    mov  ecx,190 shl 16 + 40
463
    mov  edx,0x0
451
    mov  edx,0x0
464
    mcall
452
    mcall
465
    add  ebx,2 shl 16 - 4
453
    add  ebx,2 shl 16 - 4
466
    add  ecx,2 shl 16 - 4
454
    add  ecx,2 shl 16 - 4
467
    mov  edx,fgcolor
455
    mov  edx,fgcolor
468
    mcall
456
    mcall
Line -... Line 457...
-
 
457
 
-
 
458
	cmp  [stat],3
-
 
459
	jne .stat1
-
 
460
    mov   eax,4
-
 
461
    mov   ebx,174 shl 16 +206
-
 
462
    mov   edx,lbl_start_a_new_game+1
-
 
463
    movzx esi,byte [lbl_start_a_new_game]
-
 
464
    mov   ecx,btcolor
-
 
465
    add   ecx,0x10000000
-
 
466
    mcall
-
 
467
    jmp	.nomessage
-
 
468
 
469
 
469
  .stat1:	
470
    cmp   [stat],1
470
    cmp   [stat],1
471
     je   .winmessage
471
     je   .winmessage
472
    mov   eax,4
472
    mov   eax,4
473
    mov   ebx,186 shl 16 +200
473
    mov   ebx,186 shl 16 +200
Line 519... Line 519...
519
    mov  eax,8
519
    mov  eax,8
520
    movsx edx, byte [map]
520
    movsx edx, byte [map]
521
    add  edx,9		    ;button-id = map-pos + 10;gen_image inkrements
521
    add  edx,9		    ;button-id = map-pos + 10;gen_image inkrements
522
    add  edx,0x80000000     ;first delete previous button
522
    add  edx,0x80000000     ;first delete previous button
523
	mcall
523
	mcall
524
    movsx edx, byte [map]
-
 
525
    add  edx,9		    ;button-id = map-pos + 10;gen_image inkrements
-
 
526
	add  edx,0x50000000     ;no button image - no esi need
524
    sub  edx,0x30000000     ;first delete previous button
527
    mcall
525
    mcall
528
    pop  edx
526
    pop  edx
529
    push ebx
527
    push ebx
530
    push ecx
528
    push ecx
531
    mov  eax,7
529
    mov  eax,7
Line 550... Line 548...
550
 
548
 
551
 
549
 
Line 552... Line -...
552
draw_window:
-
 
553
pusha
-
 
554
 
550
draw_window:
Line 555... Line -...
555
    mov  eax,12 		   ; function 12:tell os about windowdraw
-
 
556
    mov  ebx,1			   ; 1, start of draw
551
pusha
557
    mcall
552
 
558
 
553
    mcall 12,1
559
				   ; DRAW WINDOW
554
	
560
    mov  eax,0			   ; function 0 : define and draw window
555
    mov  eax,0			   ; function 0 : define and draw window
Line 586... Line 581...
586
    mcall
581
    mcall
587
    mov   ebx,18 shl 16 +398
582
    mov   ebx,18 shl 16 +398
588
    mov   edx,lbl_score+1
583
    mov   edx,lbl_score+1
589
    movsx esi, byte [lbl_score]
584
    movsx esi, byte [lbl_score]
590
    mcall
585
    mcall
591
    mov   ebx,350 shl 16 +405
586
    mov   ebx,340 shl 16 +405
592
    mov   ecx,fg3color
587
    mov   ecx,fg3color
593
    mov   edx,lbl_copy+1
588
    mov   edx,lbl_copy+1
594
    movsx esi,byte [lbl_copy]
589
    movsx esi,byte [lbl_copy]
595
    mcall
590
    mcall
Line 596... Line -...
596
 
-
 
597
    mov  eax,12 		   ; function 12:tell os about windowdraw
-
 
598
    mov  ebx,2			   ; 2, end of draw
591
 
Line 599... Line 592...
599
    mcall
592
    mcall 12,2
600
 
593
 
Line 601... Line 594...
601
    popa
594
    popa
Line 602... Line 595...
602
    ret
595
    ret
603
 
596
 
604
 
597
 
605
; DATA AREA
598
; DATA AREA
-
 
599
 
-
 
600
 
-
 
601
title  db   'Pipes',0
606
 
602
lbl_gameover:
607
 
603
     db 19
608
title  db   'PIPES',0
604
     db 'G a m e   O v e r !'
609
lbl_gameover:
605
lbl_start_a_new_game:
610
     db 19
606
     db 22
Line 618... Line 614...
618
     db 'Your Score:'
614
     db 'Your Score:'
619
lbl_toolbar:
615
lbl_toolbar:
620
     db 43
616
     db 43
621
     db 'New Game:     Easy       Moderate      Hard'
617
     db 'New Game:     Easy       Moderate      Hard'
622
lbl_copy:
618
lbl_copy:
623
     db 23
619
     db 24
624
     db 'v1.2 2006,Mario Birkner'
620
     db 'v1.21 2006,Mario Birkner'
625
lbl_score:
621
lbl_score:
626
     db 28
622
     db 28
627
     db   'Time:    Score:       Level:'
623
     db   'Time:    Score:       Level:'
628
stat	db 3  ;0=gameplay 1=won 2-lost 3=stopped
624
stat	db 3  ;0=gameplay 1=won 2-lost 3=stopped
629
speed	db 0
625
speed	db 0