Subversion Repositories Kolibri OS

Rev

Rev 7547 | Rev 9456 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
5665 Pathoswith 1
 
1742 mario79 2
; KolibriOS Team 2005-2021
8532 IgorA 3
5665 Pathoswith 4
 
4266 heavyiron 5
1742 mario79 6
 
5665 Pathoswith 7
org 0x0      ; адресация с нуля
4266 heavyiron 8
1742 mario79 9
 
5665 Pathoswith 10
dd 0x01 	 ; версия заголовка (всегда 1)
11
dd START	 ; адрес первой команды
12
dd IM_END	 ; размер программы
13
dd I_END	 ; количество памяти
14
dd stacktop	 ; адрес вершины стека
15
dd 0x0		 ; адрес буфера для параметров
16
dd cur_dir_path
4213 heavyiron 17
1742 mario79 18
 
4213 heavyiron 19
include '../../../macros.inc'
20
include '../../../proc32.inc'
21
include '../../../dll.inc'
22
include '../../../KOSfuncs.inc'
8532 IgorA 23
include '../../../load_lib.mac'
24
include '../../../develop/libraries/box_lib/trunk/box_lib.mac'
4213 heavyiron 25
include '../../../gui_patterns.inc'
6215 leency 26
include "../../../string.inc"
6642 leency 27
1742 mario79 28
 
6642 leency 29
WIN_H equ 200
30
BOT_PANEL_H equ 70
31
32
 
33
HOME_BUTTON_ID equ 2
6662 leency 34
REBOOT_BUTTON_ID equ 3
35
POWEROFF_BUTTON_ID equ 4
6642 leency 36
37
 
6190 leency 38
1742 mario79 39
 
6190 leency 40
 
4213 heavyiron 41
START:
42
1742 mario79 43
 
6190 leency 44
 
4213 heavyiron 45
	inc	eax
5665 Pathoswith 46
	test	eax,eax
47
	jz	close
48
1742 mario79 49
 
8532 IgorA 50
1742 mario79 51
 
4213 heavyiron 52
53
 
5665 Pathoswith 54
	mov   [autosave],eax
55
	dec   eax
56
	jnz   @f
57
	bts   dword [check1.flags],1
58
@@:
4213 heavyiron 59
	mcall	SF_SET_EVENTS_MASK,0x80000027
8532 IgorA 60
redraw:
4213 heavyiron 61
    call draw_window
62
still:
1742 mario79 63
    mov  al,SF_WAIT_EVENT
8532 IgorA 64
    mcall				     ;wait here for event
5665 Pathoswith 65
    dec  eax
1742 mario79 66
    jz	 redraw
5665 Pathoswith 67
    dec  eax
1742 mario79 68
    jz	 key
5665 Pathoswith 69
    dec  eax
4213 heavyiron 70
    jz	 button
5665 Pathoswith 71
4044 heavyiron 72
 
8532 IgorA 73
    bt	 dword [check1.flags],1
5665 Pathoswith 74
    jnc  @f
4213 heavyiron 75
    mov  [autosave],1
76
    jmp  still
77
@@:
78
    mov  [autosave],0
79
    jmp  still
80
4266 heavyiron 81
 
4213 heavyiron 82
    mov  al,SF_GET_KEY
8532 IgorA 83
    mcall				     ;get key code
84
    mov  al,ah
1742 mario79 85
     cmp  al,13
86
     je   restart
4215 heavyiron 87
     cmp  al,19
1742 mario79 88
     je   checkbox
4215 heavyiron 89
     cmp  al,180
1742 mario79 90
     je   restart_kernel
4215 heavyiron 91
     cmp  al,181
1742 mario79 92
     je   power_off
4215 heavyiron 93
     cmp  al,27
94
     jne   still
95
1742 mario79 96
 
4215 heavyiron 97
    mcall SF_TERMINATE_PROCESS
8532 IgorA 98
4215 heavyiron 99
 
4044 heavyiron 100
    mcall SF_GET_BUTTON				     ;get pressed button id
8532 IgorA 101
    xchg al,ah
1742 mario79 102
    dec  eax
103
    jz	 close
5665 Pathoswith 104
    dec  eax
1742 mario79 105
    jz	 restart_kernel
5665 Pathoswith 106
    dec  eax
1742 mario79 107
    jz	 restart
5665 Pathoswith 108
    dec  eax
1742 mario79 109
    jnz  checkbox
4213 heavyiron 110
4044 heavyiron 111
 
2676 leency 112
    push 2
113
    jmp  mcall_and_close
114
4213 heavyiron 115
 
2676 leency 116
    push 3
1742 mario79 117
    jmp  mcall_and_close
118
4213 heavyiron 119
 
4044 heavyiron 120
    push 4
1742 mario79 121
4213 heavyiron 122
 
1742 mario79 123
if fade=1
4266 heavyiron 124
 ; === FADE IN ===
125
    mov eax, color1
126
  @@:
127
    mov ebx, [eax + 32]
128
    mov [eax], ebx
129
    add eax, 4
130
    cmp eax, color21
131
    jne @b
132
133
 
134
end if
135
136
 
4213 heavyiron 137
    cmp  [autosave],1
138
    jne   no_save
139
4284 heavyiron 140
 
141
    mov   al,SF_DRAW_TEXT
8532 IgorA 142
    mcall   ,<50,120> ,0x800000cc,label7
143
end if
4284 heavyiron 144
145
 
8532 IgorA 146
    test  eax,eax
4213 heavyiron 147
    js	  no_save
5665 Pathoswith 148
    mov   ecx,eax
4213 heavyiron 149
    mcall SF_SYSTEM,SSF_GET_THREAD_SLOT
8532 IgorA 150
    mov   ecx,eax
4213 heavyiron 151
@@:
152
    push ecx
153
    mcall SF_WAIT_EVENT_TIMEOUT,100
8532 IgorA 154
    dec   eax
4213 heavyiron 155
    jnz   no_red
156
    call draw_window
157
no_red:
4266 heavyiron 158
    pop   ecx
4213 heavyiron 159
    mcall SF_THREAD_INFO,proc_info
8532 IgorA 160
    cmp   [proc_info+50],9
4213 heavyiron 161
    je	  no_save
5665 Pathoswith 162
    jmp   @b
4213 heavyiron 163
no_save:
164
    pop  ecx
1742 mario79 165
    mcall SF_SYSTEM,SSF_SHUTDOWN
8532 IgorA 166
    mcall SF_TERMINATE_PROCESS
167
ret
4268 heavyiron 168
1742 mario79 169
 
4213 heavyiron 170
    btc   dword [check1.flags],1
171
    jc	  .1
5665 Pathoswith 172
    mov   [autosave],1
4213 heavyiron 173
    jmp   .draw
174
.1:
175
    mov   [autosave],0
176
.draw:
177
    stdcall  [check_box_draw], check1
8532 IgorA 178
    jmp    still
4213 heavyiron 179
4266 heavyiron 180
 
4213 heavyiron 181
    mcall SF_REDRAW,SSF_BEGIN_DRAW
8532 IgorA 182
6642 leency 183
 
8532 IgorA 184
    mcall				     ;get screen max x & max y
185
    movzx ecx,ax
4213 heavyiron 186
    shr   eax,17
4215 heavyiron 187
    shl   eax,16
188
    lea   ebx,[eax-(WIN_W/2) shl 16+WIN_W-1]
6642 leency 189
    shr   ecx,1
4215 heavyiron 190
    shl   ecx,16
191
    lea   ecx,[ecx-(WIN_H/2) shl 16+WIN_H-1]
6642 leency 192
4213 heavyiron 193
 
4215 heavyiron 194
	mov edx, 0x41000000
6642 leency 195
	mcall ;define and draw window
196
197
 
198
	DrawBar 2, 2, WIN_W-4, WIN_H-BOT_PANEL_H-2, 0x202020
199
	DrawBar 2, WIN_H-BOT_PANEL_H-2, WIN_W-4, BOT_PANEL_H, 0x4B4B4B
200
	WriteText 30, 27, 10010001b, 0xFFFfff, TEXT_TITLE
201
	WriteText 55, 70, 10010000b, 0xFFFfff, TEXT_RDSAVE1
202
	WriteText 55, 86, 10010000b, 0xFFFfff, TEXT_RDSAVE2
203
204
 
205
	WriteText  WIN_W-23, 5, 10000001b, 0xFFFfff, TEXT_CANCEL
206
4213 heavyiron 207
 
8532 IgorA 208
4213 heavyiron 209
 
6642 leency 210
{
211
	buty equ WIN_H-60
212
	butw equ 116
213
	buth equ 43
214
	DrawWideRectangle x-3, buty-3, butw+6, buth+6, 3, 0x202020
215
	DefineButton x, buty, butw-1, buth-1, id, bgcol
216
	; WriteTextBold -strlen(but_text)*8 + butw / 2 + x, buty+8,  10010000b, 0xFFFfff, but_text
217
	; WriteText     -strlen(but_text)*6 + butw / 2 + x, buty+26, 10000000b, 0xFFFfff, hotkey_text
218
	stdcall string.length, but_text
219
	mov  ebx,eax
220
	imul ebx,4
221
	neg  ebx
222
	add  ebx,butw / 2 + x
223
	shl  ebx,16
224
	add  ebx,buty+8
225
	mcall SF_DRAW_TEXT, , 10010000b shl 24 + 0xFFFfff, but_text
8532 IgorA 226
	add ebx,1 shl 16
6642 leency 227
	mcall
228
	stdcall string.length, hotkey_text
229
	mov  ebx,eax
230
	imul ebx,3
231
	neg  ebx
232
	add  ebx,butw / 2 + x
233
	shl  ebx,16
234
	add  ebx,buty+26
235
	mcall SF_DRAW_TEXT, , 10000000b shl 24 + 0xFFFfff, hotkey_text
8532 IgorA 236
}
6642 leency 237
4213 heavyiron 238
 
6642 leency 239
	EndButton 160, 0x55C891, REBOOT_BUTTON_ID,   TEXT_REBOOT, TEXT_ENTER
240
	EndButton 300, 0xC75C54, POWEROFF_BUTTON_ID, TEXT_OFF,    TEXT_END
241
4215 heavyiron 242
 
8532 IgorA 243
    mcall   ,SSF_END_DRAW
244
    ret
4213 heavyiron 245
;---------------------------------------------------------------------
4215 heavyiron 246
;data
247
include 'data.inc'
4044 heavyiron 248
;---------------------------------------------------------------------
4213 heavyiron 249
IM_END:
250
;---------------------------------------------------------------------
251
align 4
252
1742 mario79 253
 
4213 heavyiron 254
255
 
256
;---------------------------------------------------------------------
257
cur_dir_path rb 4096
8532 IgorA 258
library_path rb 4096
259
;---------------------------------------------------------------------
4213 heavyiron 260
align 32
261
	rb 4096
5665 Pathoswith 262
stacktop:
4213 heavyiron 263
I_END:	; метка конца программы
5665 Pathoswith 264