Subversion Repositories Kolibri OS

Rev

Rev 4266 | Rev 4268 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4266 Rev 4267
1
;
1
;
2
; END
2
; END
3
; KolibriOS Team 2005-2013
3
; KolibriOS Team 2005-2013
4
;
4
;
5
;  note that 'mov al,xx' is shorter than 'mov eax,xx'
5
;  note that 'mov al,xx' is shorter than 'mov eax,xx'
6
;           and if we know that high 24 bits of eax are zero, we can use 1st form
6
;           and if we know that high 24 bits of eax are zero, we can use 1st form
7
;           the same about ebx,ecx,edx
7
;           the same about ebx,ecx,edx
8
fade equ 0
8
fade equ 0
9
 
9
 
10
use32        ; ¢ª«îç¨âì 32-¡¨â­ë© ०¨¬  áᥬ¡«¥à 
10
use32        ; ¢ª«îç¨âì 32-¡¨â­ë© ०¨¬  áᥬ¡«¥à 
11
org 0x0      ;  ¤à¥á æ¨ï á ­ã«ï
11
org 0x0      ;  ¤à¥á æ¨ï á ­ã«ï
12
 
12
 
13
db 'MENUET01'    ; 8-¡ ©â­ë© ¨¤¥­â¨ä¨ª â®à MenuetOS
13
db 'MENUET01'    ; 8-¡ ©â­ë© ¨¤¥­â¨ä¨ª â®à MenuetOS
14
dd 0x01          ; ¢¥àá¨ï § £®«®¢ª  (¢á¥£¤  1)
14
dd 0x01          ; ¢¥àá¨ï § £®«®¢ª  (¢á¥£¤  1)
15
dd START         ;  ¤à¥á ¯¥à¢®© ª®¬ ­¤ë
15
dd START         ;  ¤à¥á ¯¥à¢®© ª®¬ ­¤ë
16
dd IM_END        ; à §¬¥à ¯à®£à ¬¬ë
16
dd IM_END        ; à §¬¥à ¯à®£à ¬¬ë
17
dd I_END         ; ª®«¨ç¥á⢮ ¯ ¬ïâ¨
17
dd I_END         ; ª®«¨ç¥á⢮ ¯ ¬ïâ¨
18
dd stacktop      ;  ¤à¥á ¢¥à設ë á⥪ 
18
dd stacktop      ;  ¤à¥á ¢¥à設ë á⥪ 
19
dd 0x0           ;  ¤à¥á ¡ãä¥à  ¤«ï ¯ à ¬¥â஢
19
dd 0x0           ;  ¤à¥á ¡ãä¥à  ¤«ï ¯ à ¬¥â஢
20
dd cur_dir_path
20
dd cur_dir_path
21
 
21
 
22
include 'lang.inc'
22
include 'lang.inc'
23
include '../../../macros.inc'
23
include '../../../macros.inc'
24
include '../../../proc32.inc'
24
include '../../../proc32.inc'
25
include '../../../dll.inc'
25
include '../../../dll.inc'
26
include '../../../develop/libraries/box_lib/load_lib.mac'
26
include '../../../develop/libraries/box_lib/load_lib.mac'
27
include '../../../develop/libraries/box_lib/trunk/box_lib.mac'
27
include '../../../develop/libraries/box_lib/trunk/box_lib.mac'
28
 
28
 
29
        @use_library
29
        @use_library
30
 
30
 
31
align 4
31
align 4
32
START:
32
START:
33
 
33
 
34
load_libraries l_libs_start,end_l_libs
34
load_libraries l_libs_start,end_l_libs
35
        inc     eax
35
        inc     eax
36
        test    eax,eax
36
        test    eax,eax
37
        jz      close
37
        jz      close
38
 
38
 
39
push    dword check1
39
push    dword check1
40
call    [init_checkbox2]
40
call    [init_checkbox2]
41
 
41
 
42
stdcall dll.Init,[init_lib]
42
stdcall dll.Init,[init_lib]
43
 
43
 
44
invoke  ini_get_int,ini_file,asettings,aautosave,0
44
invoke  ini_get_int,ini_file,asettings,aautosave,0
45
        mov   [autosave],eax
45
        mov   [autosave],eax
46
        dec   eax
46
        dec   eax
47
        jnz   @f
47
        jnz   @f
48
        bts   dword [check1.flags],1
48
        bts   dword [check1.flags],1
49
@@:
49
@@:
50
        mcall   40,0x80000027
50
        mcall   40,0x80000027
51
redraw:
51
redraw:
52
    call draw_window
52
    call draw_window
53
still:
53
still:
54
    mov  al,10
54
    mov  al,10
55
    mcall                                    ;wait here for event
55
    mcall                                    ;wait here for event
56
    dec  eax
56
    dec  eax
57
    jz   redraw
57
    jz   redraw
58
    dec  eax
58
    dec  eax
59
    jz   key
59
    jz   key
60
    dec  eax
60
    dec  eax
61
    jz   button
61
    jz   button
62
 
62
 
63
    push dword check1
63
    push dword check1
64
    call [check_box_mouse2]
64
    call [check_box_mouse2]
65
    bt   dword [check1.flags],1
65
    bt   dword [check1.flags],1
66
    jnc  @f
66
    jnc  @f
67
    mov  [autosave],1
67
    mov  [autosave],1
68
    jmp  still
68
    jmp  still
69
@@:
69
@@:
70
    mov  [autosave],0
70
    mov  [autosave],0
71
    jmp  still
71
    jmp  still
72
 
72
 
73
key:
73
key:
74
    mov  al,2
74
    mov  al,2
75
    mcall                                    ;eax=2 - get key code
75
    mcall                                    ;eax=2 - get key code
76
    mov  al,ah
76
    mov  al,ah
77
     cmp  al,13
77
     cmp  al,13
78
     je   restart
78
     je   restart
79
     cmp  al,19
79
     cmp  al,19
80
     je   checkbox
80
     je   checkbox
81
     cmp  al,180
81
     cmp  al,180
82
     je   restart_kernel
82
     je   restart_kernel
83
     cmp  al,181
83
     cmp  al,181
84
     je   power_off
84
     je   power_off
85
     cmp  al,27
85
     cmp  al,27
86
     jne   still
86
     jne   still
87
 
87
 
88
close:
88
close:
89
    mcall -1
89
    mcall -1
90
 
90
 
91
button:
91
button:
92
    mcall 17                                 ;eax=17 - get pressed button id
92
    mcall 17                                 ;eax=17 - get pressed button id
93
    xchg al,ah
93
    xchg al,ah
94
    dec  eax
94
    dec  eax
95
    jz   close
95
    jz   close
96
    dec  eax
96
    dec  eax
97
    jz   restart_kernel
97
    jz   restart_kernel
98
    dec  eax
98
    dec  eax
99
    jz   restart
99
    jz   restart
100
    dec  eax
100
    dec  eax
101
    jnz  checkbox
101
    jnz  checkbox
102
 
102
 
103
power_off:
103
power_off:
104
    push 2
104
    push 2
105
    jmp  mcall_and_close
105
    jmp  mcall_and_close
106
 
106
 
107
restart:
107
restart:
108
    push 3
108
    push 3
109
    jmp  mcall_and_close
109
    jmp  mcall_and_close
110
 
110
 
111
restart_kernel:
111
restart_kernel:
112
    push 4
112
    push 4
113
 
113
 
114
mcall_and_close:
114
mcall_and_close:
115
if fade=1
115
if fade=1
116
 ; === FADE IN ===
116
 ; === FADE IN ===
117
    mov eax, color1
117
    mov eax, color1
118
  @@:
118
  @@:
119
    mov ebx, [eax + 32]
119
    mov ebx, [eax + 32]
120
    mov [eax], ebx
120
    mov [eax], ebx
121
    add eax, 4
121
    add eax, 4
122
    cmp eax, color21
122
    cmp eax, color21
123
    jne @b
123
    jne @b
124
 
124
 
125
    call    draw_window
125
    call    draw_window
126
else
126
else
127
    mov   al,4
127
    mov   al,4
128
    mcall   ,<50,110> ,0x80000000,label7        ;eax=4 - write text
128
    mcall   ,<50,110> ,0x800000cc,label7        ;eax=4 - write text
129
end if
129
end if
130
 
130
 
131
    invoke  ini_set_int,ini_file,asettings,aautosave,[autosave]
131
    invoke  ini_set_int,ini_file,asettings,aautosave,[autosave]
132
    cmp  [autosave],1
132
    cmp  [autosave],1
133
    jne   no_save
133
    jne   no_save
134
    mcall 70,rdsave
134
    mcall 70,rdsave
135
    test  eax,eax
135
    test  eax,eax
136
    js    no_save
136
    js    no_save
137
    mov   ecx,eax
137
    mov   ecx,eax
138
    mcall 18,21
138
    mcall 18,21
139
    mov   ecx,eax
139
    mov   ecx,eax
140
@@:
140
@@:
141
    push ecx
141
    push ecx
142
    mcall 23,100
142
    mcall 23,100
143
    dec   eax
143
    dec   eax
144
    jnz   no_red
144
    jnz   no_red
145
    call draw_window
145
    call draw_window
146
no_red:
146
no_red:
147
    pop   ecx
147
    pop   ecx
148
    mcall 9,proc_info
148
    mcall 9,proc_info
149
    cmp   [proc_info+50],9
149
    cmp   [proc_info+50],9
150
    je    no_save
150
    je    no_save
151
    jmp   @b
151
    jmp   @b
152
no_save:
152
no_save:
153
    pop  ecx
153
    pop  ecx
154
  mcall 18,9
154
  mcall 18,9
155
 
155
 
156
checkbox:
156
checkbox:
157
    btc   dword [check1.flags],1
157
    btc   dword [check1.flags],1
158
    jc    .1
158
    jc    .1
159
    mov   [autosave],1
159
    mov   [autosave],1
160
    jmp   .draw
160
    jmp   .draw
161
.1:
161
.1:
162
    mov   [autosave],0
162
    mov   [autosave],0
163
.draw:
163
.draw:
164
    push  dword check1
164
    push  dword check1
165
    call  [check_box_draw2]
165
    call  [check_box_draw2]
166
    jmp    still
166
    jmp    still
167
 
167
 
168
draw_window:
168
draw_window:
169
    mov   al,12
169
    mov   al,12
170
    mcall   ,1
170
    mcall   ,1
171
 
171
 
172
    mov   al,14
172
    mov   al,14
173
    mcall                                    ;eax=14 - get screen max x & max y
173
    mcall                                    ;eax=14 - get screen max x & max y
174
    movzx ecx,ax
174
    movzx ecx,ax
175
    shr   eax,17
175
    shr   eax,17
176
    shl   eax,16
176
    shl   eax,16
177
    lea   ebx,[eax-110 shl 16+222]
177
    lea   ebx,[eax-110 shl 16+222]
178
    shr   ecx,1
178
    shr   ecx,1
179
    shl   ecx,16
179
    shl   ecx,16
180
    lea   ecx,[ecx-70 shl 16+122]
180
    lea   ecx,[ecx-70 shl 16+122]
181
 
181
 
182
    xor   eax,eax
182
    xor   eax,eax
183
    mcall  , , ,[color1],0x01000000        ;define and draw window
183
    mcall  , , ,[color1],0x01000000        ;define and draw window
184
 
184
 
185
    mov   al,13
185
    mov   al,13
186
    mcall   ,<0,223> ,<0,123>
186
    mcall   ,<0,223> ,<0,123>
187
    mcall   ,<1,221>,<1,121>,[color2]
187
    mcall   ,<1,221>,<1,121>,[color2]
188
    mcall   ,<2,220>,<2,120>, [color3]
188
    mcall   ,<2,220>,<2,120>, [color3]
189
 
189
 
190
    mov   al,8
190
    mov   al,8
191
    mcall   ,<16,90> ,<20,27>,4,[color4]     ;eax=8 - draw buttons
191
    mcall   ,<16,90> ,<20,27>,4,[color4]     ;eax=8 - draw buttons
192
    mcall   ,<113,90>,       ,2,[color5]
192
    mcall   ,<113,90>,       ,2,[color5]
193
    mcall   ,        ,<54,27>,1,[color6]
193
    mcall   ,        ,<54,27>,1,[color6]
194
    mcall   ,<16,90> ,       ,3,[color7]
194
    mcall   ,<16,90> ,       ,3,[color7]
195
 
195
 
196
    mov   al,4
196
    mov   al,4
197
    mcall   ,<27,24> ,[color8],label2        ;eax=4 - write text
197
    mcall   ,<27,24> ,[color8],label2        ;eax=4 - write text
198
    mcall   ,<23,58> ,        ,label3
198
    mcall   ,<23,58> ,        ,label3
199
    mcall   ,<47,37> ,        ,label5
199
    mcall   ,<47,37> ,        ,label5
200
    mcall   ,<41,71> ,        ,label6
200
    mcall   ,<41,71> ,        ,label6
201
 
201
 
202
    push  dword check1
202
    push  dword check1
203
    call  [check_box_draw2]
203
    call  [check_box_draw2]
204
 
204
 
205
    mov   al,12
205
    mov   al,12
206
    mcall   ,2
206
    mcall   ,2
207
    ret
207
    ret
208
;---------------------------------------------------------------------
208
;---------------------------------------------------------------------
209
;data
209
;data
210
include 'data.inc'
210
include 'data.inc'
211
;---------------------------------------------------------------------
211
;---------------------------------------------------------------------
212
IM_END:
212
IM_END:
213
;---------------------------------------------------------------------
213
;---------------------------------------------------------------------
214
align 4
214
align 4
215
 
215
 
216
proc_info  rb 1024
216
proc_info  rb 1024
217
 
217
 
218
autosave rd 1
218
autosave rd 1
219
;---------------------------------------------------------------------
219
;---------------------------------------------------------------------
220
cur_dir_path:
220
cur_dir_path:
221
        rb 4096
221
        rb 4096
222
;---------------------------------------------------------------------
222
;---------------------------------------------------------------------
223
library_path:
223
library_path:
224
        rb 4096
224
        rb 4096
225
;---------------------------------------------------------------------
225
;---------------------------------------------------------------------
226
align 32
226
align 32
227
        rb 4096
227
        rb 4096
228
stacktop:
228
stacktop:
229
I_END:  ; ¬¥âª  ª®­æ  ¯à®£à ¬¬ë
229
I_END:  ; ¬¥âª  ª®­æ  ¯à®£à ¬¬ë