Subversion Repositories Kolibri OS

Rev

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

Rev 4044 Rev 4051
Line 2... Line 2...
2
; END
2
; END
3
; KolibriOS Team 2005-2013
3
; KolibriOS Team 2005-2013
4
;
4
;
5
include "lang.inc"
5
include "lang.inc"
6
include "..\..\..\macros.inc"
6
include "..\..\..\macros.inc"
-
 
7
;  note that 'mov al,xx' is shorter than 'mov eax,xx'
-
 
8
;           and if we know that high 24 bits of eax are zero, we can use 1st form
-
 
9
;           the same about ebx,ecx,edx
Line 7... Line 10...
7
 
10
 
8
meos_app_start
11
meos_app_start
9
code
12
code
-
 
13
draw_window:
10
draw_window:
14
    mov   al,12
Line -... Line 15...
-
 
15
    mcall ,1
11
    mcall 12,1
16
 
12
 
17
    mov  al,14
13
    mcall 14                                 ;eax=14 - get screen max x & max y
18
    mcall                                    ;eax=14 - get screen max x & max y
14
    movzx ecx,ax
19
    movzx ecx,ax
15
    shr  eax,17
20
    shr  eax,17
16
    shl  eax,16
21
    shl  eax,16
17
    lea  ebx,[eax-110 shl 16+222]
22
    lea  ebx,[eax-110 shl 16+222]
18
    shr  ecx,1
23
    shr  ecx,1
Line -... Line 24...
-
 
24
    shl  ecx,16
19
    shl  ecx,16
25
    lea  ecx,[ecx-65 shl 16+137]
Line -... Line 26...
-
 
26
 
20
    lea  ecx,[ecx-70 shl 16+137]
27
    xor eax,eax
21
 
28
    mcall  , , ,0x019098b0,0x01000000        ;define and draw window
22
    mcall 0, , ,0x01ffffff                   ;define and draw window
29
 
23
 
30
    mov   al,13
Line -... Line 31...
-
 
31
    mcall   ,<0,223> ,<0,275>
24
    mcall 13,   223 ,   138 ,0x9098b0
32
    mcall   ,<1,221>,<1,136>,0xffffff
25
    mcall   ,<1,221>,<1,136>,0xffffff
33
    mcall   ,<2,220>,<2,135>,0xe4dfe1
26
    mcall   ,<2,220>,<2,135>,0xe4dfe1
34
    mcall   ,<16,189>,<97,23>,0x9098b0
27
    mcall   ,<16,189>,<97,23>,0x9098b0
35
 
28
 
36
    mov    al,8
Line -... Line 37...
-
 
37
    mcall   ,<16,90> ,<20,27>,4,0x990022     ;eax=8 - draw buttons
29
    mcall  8,<16,90> ,<20,27>,4,0x990022     ;eax=8 - draw buttons
38
    mcall   ,<113,90>,       ,2,0xaa7700
30
    mcall   ,<113,90>,       ,2,0xaa7700
39
    mcall   ,        ,<54,27>,1,0x777777
31
    mcall   ,        ,<54,27>,1,0x777777
40
    mcall   ,<16,90> ,       ,3,0x007700
32
    mcall   ,<16,90> ,       ,3,0x007700
41
    mcall   ,<17,186>,<98,20>,5,0xe4dfe1
33
    mcall   ,<17,186>,<98,20>,5,0xe4dfe1
42
 
Line -... Line 43...
-
 
43
    mov   al,4
34
 
44
    mcall  ,<28,105>,0x80000000,label4        ;eax=4 - write text
Line 35... Line 45...
35
    mcall 4,<28,105>,0x80000000,label4        ;eax=4 - write text
45
    mcall  ,<35,24> ,0x80ffffff,label2
-
 
46
    mcall  ,<34,58> ,          ,label3
36
    mcall  ,<35,24> ,0x80ffffff,label2
47
    mcall  ,<47,37> ,          ,label5
37
    mcall  ,<34,58> ,          ,label3
48
    mcall  ,<43,71> ,          ,label6
38
    mcall  ,<47,37> ,          ,label5
49
 
39
    mcall  ,<43,71> ,          ,label6
50
    mov   al,12
40
 
51
    mcall   ,2
Line -... Line 52...
-
 
52
 
41
    mcall 12,2
53
still:
42
 
54
    mov  al,10
43
still:
55
    mcall                                    ;wait here for event
44
    mcall 10                                 ;wait here for event
56
    dec  eax
45
    dec  eax
57
    jz   draw_window
46
    jz   draw_window
58
    dec  eax
Line 60... Line 72...
60
     cmp  al,181
72
     cmp  al,181
61
     jz   power_off
73
     jz   power_off
62
     jmp  still
74
     jmp  still
Line 63... Line 75...
63
 
75
 
-
 
76
button:
64
button:
77
    mov  al,17
65
    mcall 17                                 ;eax=17 - get pressed button id
78
    mcall                                    ;eax=17 - get pressed button id
66
    xchg al,ah
79
    xchg al,ah
67
    dec  eax
80
    dec  eax
68
    jz   close_1
81
    jz   close_1
69
    dec  eax
82
    dec  eax
70
    jz   restart_kernel
83
    jz   restart_kernel
71
    dec  eax
84
    dec  eax
72
    jz   restart
85
    jz   restart
73
    dec  eax
86
    dec  eax
-
 
87
    jnz   run_rdsave
-
 
88
;    dec  eax                                ; we have only one button left, this is close button
Line 74... Line 89...
74
    jnz   run_rdsave
89
;    jnz  still
75
 
90
 
76
power_off:
91
power_off:
77
    push 2
92
    push 2
Line 81... Line 96...
81
    jmp  mcall_and_close
96
    jmp  mcall_and_close
82
restart_kernel:
97
restart_kernel:
83
    push 4
98
    push 4
84
mcall_and_close:
99
mcall_and_close:
85
    pop  ecx
100
    pop  ecx
-
 
101
    mov  al,18
86
    mcall 18,9
102
    mcall   ,9
Line 87... Line 103...
87
 
103
 
-
 
104
close_1:
88
close_1:
105
    or  eax,-1
Line 89... Line 106...
89
    mcall -1
106
    mcall  
-
 
107
 
90
 
108
run_rdsave:
91
run_rdsave:
109
    mov  al,70
Line 92... Line 110...
92
    mcall 70,rdsave
110
    mcall   ,rdsave
93
    jmp still
111
    jmp still