Subversion Repositories Kolibri OS

Rev

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

Rev 6050 Rev 6058
1
//CODED by Veliant, Leency, Nable, Pavelyakov. GNU GPL licence.
1
//CODED by Veliant, Leency, Nable, Pavelyakov. GNU GPL licence.
2
 
2
 
3
#ifndef INCLUDE_KOLIBRI_H
3
#ifndef INCLUDE_KOLIBRI_H
4
#define INCLUDE_KOLIBRI_H
4
#define INCLUDE_KOLIBRI_H
5
#print "[include ]\n"
5
#print "[include ]\n"
6
 
6
 
7
#pragma option OST
7
#pragma option OST
8
#pragma option ON
8
#pragma option ON
9
#pragma option cri-
9
#pragma option cri-
10
#pragma option -CPA
10
#pragma option -CPA
11
#initallvar 0
11
#initallvar 0
12
#jumptomain FALSE
12
#jumptomain FALSE
13
 
13
 
14
#startaddress 0
14
#startaddress 0
15
 
15
 
16
#code32 TRUE
16
#code32 TRUE
17
 
17
 
18
char   os_name[8]   = {'M','E','N','U','E','T','0','1'};
18
char   os_name[8]   = {'M','E','N','U','E','T','0','1'};
19
dword  os_version   = 0x00000001;
19
dword  os_version   = 0x00000001;
20
dword  start_addr   = #______INIT______;
20
dword  start_addr   = #______INIT______;
21
dword  final_addr   = #______STOP______+32;
21
dword  final_addr   = #______STOP______+32;
22
dword  alloc_mem    = MEMSIZE;
22
dword  alloc_mem    = MEMSIZE;
23
dword  x86esp_reg   = MEMSIZE;
23
dword  x86esp_reg   = MEMSIZE;
24
dword  I_Param      = #param;
24
dword  I_Param      = #param;
25
dword  I_Path       = #program_path;
25
dword  I_Path       = #program_path;
26
char param[4096];
26
char param[4096];
27
char program_path[4096];
27
char program_path[4096];
28
 
28
 
29
#define bool      char
29
#define bool      char
30
 
30
 
31
#define NULL      0
31
#define NULL      0
32
#define OLD      -1
32
#define OLD      -1
33
#define true      1
33
#define true      1
34
#define false     0
34
#define false     0
35
 
35
 
36
//Process Events
36
//Process Events
37
#define evReDraw  1
37
#define evReDraw  1
38
#define evKey     2
38
#define evKey     2
39
#define evButton  3
39
#define evButton  3
40
#define evDesktop 5
40
#define evDesktop 5
41
#define evMouse   6
41
#define evMouse   6
42
#define evIPC     7
42
#define evIPC     7
43
#define evNetwork 8
43
#define evNetwork 8
44
#define evDebug   9
44
#define evDebug   9
45
 
45
 
46
//Button options
46
//Button options
47
#define BT_DEL      0x80000000
47
#define BT_DEL      0x80000000
48
#define BT_HIDE     0x40000000
48
#define BT_HIDE     0x40000000
49
#define BT_NOFRAME  0x20000000
49
#define BT_NOFRAME  0x20000000
50
 
50
 
51
//ASCII KEYS
51
//ASCII KEYS
52
#define ASCII_KEY_BS    008
52
#define ASCII_KEY_BS    008
53
#define ASCII_KEY_TAB   009
53
#define ASCII_KEY_TAB   009
54
#define ASCII_KEY_ENTER 013
54
#define ASCII_KEY_ENTER 013
55
#define ASCII_KEY_ESC   027
55
#define ASCII_KEY_ESC   027
56
#define ASCII_KEY_DEL   182
56
#define ASCII_KEY_DEL   182
57
#define ASCII_KEY_INS   185
57
#define ASCII_KEY_INS   185
58
#define ASCII_KEY_SPACE 032
58
#define ASCII_KEY_SPACE 032
59
 
59
 
60
#define ASCII_KEY_LEFT  176
60
#define ASCII_KEY_LEFT  176
61
#define ASCII_KEY_RIGHT 179
61
#define ASCII_KEY_RIGHT 179
62
#define ASCII_KEY_DOWN  177
62
#define ASCII_KEY_DOWN  177
63
#define ASCII_KEY_UP    178
63
#define ASCII_KEY_UP    178
64
#define ASCII_KEY_HOME  180
64
#define ASCII_KEY_HOME  180
65
#define ASCII_KEY_END   181
65
#define ASCII_KEY_END   181
66
#define ASCII_KEY_PGDN  183
66
#define ASCII_KEY_PGDN  183
67
#define ASCII_KEY_PGUP  184
67
#define ASCII_KEY_PGUP  184
68
 
68
 
69
//SCAN CODE KEYS
69
//SCAN CODE KEYS
70
#define SCAN_CODE_BS    014
70
#define SCAN_CODE_BS    014
71
#define SCAN_CODE_TAB   015
71
#define SCAN_CODE_TAB   015
72
#define SCAN_CODE_ENTER 028
72
#define SCAN_CODE_ENTER 028
73
#define SCAN_CODE_ESC   001
73
#define SCAN_CODE_ESC   001
74
#define SCAN_CODE_DEL   083
74
#define SCAN_CODE_DEL   083
75
#define SCAN_CODE_INS   082
75
#define SCAN_CODE_INS   082
76
#define SCAN_CODE_SPACE 057
76
#define SCAN_CODE_SPACE 057
77
            
77
			
78
#define SCAN_CODE_LEFT  075
78
#define SCAN_CODE_LEFT  075
79
#define SCAN_CODE_RIGHT 077
79
#define SCAN_CODE_RIGHT 077
80
#define SCAN_CODE_DOWN  080
80
#define SCAN_CODE_DOWN  080
81
#define SCAN_CODE_UP    072
81
#define SCAN_CODE_UP    072
82
#define SCAN_CODE_HOME  071
82
#define SCAN_CODE_HOME  071
83
#define SCAN_CODE_END   079
83
#define SCAN_CODE_END   079
84
#define SCAN_CODE_PGDN  081
84
#define SCAN_CODE_PGDN  081
85
#define SCAN_CODE_PGUP  073
85
#define SCAN_CODE_PGUP  073
86
 
86
 
87
#define KEY_LSHIFT     00000000001b
87
#define KEY_LSHIFT     00000000001b
88
#define KEY_RSHIFT     00000000010b
88
#define KEY_RSHIFT     00000000010b
89
#define KEY_LCTRL      00000000100b
89
#define KEY_LCTRL      00000000100b
90
#define KEY_RCTRL      00000001000b
90
#define KEY_RCTRL      00000001000b
91
#define KEY_LALT       00000010000b
91
#define KEY_LALT       00000010000b
92
#define KEY_RALT       00000100000b
92
#define KEY_RALT       00000100000b
93
#define KEY_CAPSLOCK   00001000000b
93
#define KEY_CAPSLOCK   00001000000b
94
#define KEY_NUMLOCK    00010000000b
94
#define KEY_NUMLOCK    00010000000b
95
#define KEY_SCROLLLOCK 00100000000b
95
#define KEY_SCROLLLOCK 00100000000b
96
#define KEY_LWIN       01000000000b
96
#define KEY_LWIN       01000000000b
97
#define KEY_RWIN       10000000000b
97
#define KEY_RWIN       10000000000b
98
 
98
 
99
dword calc(EAX) { return EAX; }
99
dword calc(EAX) { return EAX; }
100
 
100
 
101
inline fastcall word GetKey()  //+Gluk fix
101
inline fastcall word GetKey()  //+Gluk fix
102
{
102
{
103
		$push edx
103
		$push edx
104
GETKEY:
104
GETKEY:
105
		$mov  eax,2
105
		$mov  eax,2
106
		$int  0x40
106
		$int  0x40
107
		$cmp eax,1
107
		$cmp eax,1
108
		$jne GETKEYI
108
		$jne GETKEYI
109
		$mov ah,dh
109
		$mov ah,dh
110
		$jmp GETKEYII //jz?
110
		$jmp GETKEYII //jz?
111
GETKEYI:
111
GETKEYI:
112
		$mov dh,ah
112
		$mov dh,ah
113
		$jmp GETKEY
113
		$jmp GETKEY
114
GETKEYII:
114
GETKEYII:
115
		$pop edx
115
		$pop edx
116
		$shr eax,8
116
		$shr eax,8
117
}
117
}
118
 
118
 
119
 
119
 
120
unsigned char key_ascii;
120
unsigned char key_ascii;
121
dword key_scancode, key_modifier;
121
dword key_scancode, key_modifier;
122
int GetKeys()
122
int GetKeys()
123
{
123
{
124
		$push edx
124
		$push edx
125
GETKEY:
125
GETKEY:
126
		$mov  eax,2
126
		$mov  eax,2
127
		$int  0x40
127
		$int  0x40
128
		$cmp eax,1
128
		$cmp eax,1
129
		$jne GETKEYI
129
		$jne GETKEYI
130
		$mov eax,edx
130
		$mov eax,edx
131
		$jmp GETKEYII
131
		$jmp GETKEYII
132
GETKEYI:
132
GETKEYI:
133
		$mov edx,eax
133
		$mov edx,eax
134
		$jmp GETKEY
134
		$jmp GETKEY
135
GETKEYII:
135
GETKEYII:
136
		$pop edx
136
		$pop edx
137
	key_ascii = AH;
137
	key_ascii = AH;
138
	$shr  eax,16
138
	$shr  eax,16
139
	key_scancode = AL;
139
	key_scancode = AL;
140
	//get alt/shift/ctrl key status
140
	//get alt/shift/ctrl key status
141
	$mov eax,66
141
	$mov eax,66
142
	$mov ebx,3
142
	$mov ebx,3
143
	$int 0x40
143
	$int 0x40
144
	key_modifier = EAX;
144
	key_modifier = EAX;
145
}
145
}
146
 
146
 
147
//allow event mask
147
//allow event mask
148
#define EVENT_MASK_REDRAW   000000001b
148
#define EVENT_MASK_REDRAW   000000001b
149
#define EVENT_MASK_KEYBOARD 000000010b
149
#define EVENT_MASK_KEYBOARD 000000010b
150
#define EVENT_MASK_BUTTONS  000000100b
150
#define EVENT_MASK_BUTTONS  000000100b
151
#define EVENT_MASK_DESKTOP  000010000b
151
#define EVENT_MASK_DESKTOP  000010000b
152
#define EVENT_MASK_MOUSE    000100000b
152
#define EVENT_MASK_MOUSE    000100000b
153
#define EVENT_MASK_IPC      001000000b
153
#define EVENT_MASK_IPC      001000000b
154
#define EVENT_MASK_NETWORK  010000000b
154
#define EVENT_MASK_NETWORK  010000000b
155
#define EVENT_MASK_DEBUG    100000000b
155
#define EVENT_MASK_DEBUG    100000000b
156
 
156
 
157
//ARGS FUNCTION
157
//ARGS FUNCTION
158
#define END_ARGS 0xFF00FF
158
#define END_ARGS 0xFF00FF
159
//-------------------------------------------------------------------------
159
//-------------------------------------------------------------------------
160
 
160
 
161
#ifndef INCLUDE_SYSTEM_H
161
#ifndef INCLUDE_SYSTEM_H
162
#include "../lib/system.h"
162
#include "../lib/system.h"
163
#endif
163
#endif
164
 
164
 
165
#ifndef INCLUDE_MOUSE_H
165
#ifndef INCLUDE_MOUSE_H
166
#include "../lib/mouse.h"
166
#include "../lib/mouse.h"
167
#endif
167
#endif
168
 
168
 
169
:struct raw_image {
169
:struct raw_image {
170
	dword w, h, data;
170
	dword w, h, data;
171
};
171
};
172
 
172
 
173
 
173
 
174
 
174
 
175
//------------------------------------------------------------------------------
175
//------------------------------------------------------------------------------
176
:dword wait_event_code;
176
:dword wait_event_code;
177
inline fastcall dword WaitEvent()
177
inline fastcall dword WaitEvent()
178
{
178
{
179
	$mov eax,10
179
	$mov eax,10
180
	$int 0x40
180
	$int 0x40
181
	wait_event_code = EAX;
181
	wait_event_code = EAX;
182
	//if(wait_event_code==evMouse) MOUSE.get();
182
	//if(wait_event_code==evMouse) MOUSE.get();
183
	//return wait_event_code;
183
	//return wait_event_code;
184
}
184
}
185
 
185
 
186
inline fastcall dword CheckEvent()
186
inline fastcall dword CheckEvent()
187
{
187
{
188
	$mov eax,11
188
	$mov eax,11
189
	$int 0x40
189
	$int 0x40
190
}
190
}
191
 
191
 
192
inline fastcall dword WaitEventTimeout(EBX)
192
inline fastcall dword WaitEventTimeout(EBX)
193
{
193
{
194
	$mov eax,23
194
	$mov eax,23
195
	$int 0x40
195
	$int 0x40
196
} 
196
} 
197
 
197
 
198
inline fastcall SetEventMask(EBX)
198
inline fastcall SetEventMask(EBX)
199
{
199
{
200
	$mov eax,40
200
	$mov eax,40
201
	$int 0x40
201
	$int 0x40
202
}
202
}
203
 
203
 
204
 
204
 
205
inline fastcall pause(EBX)
205
inline fastcall pause(EBX)
206
{
206
{
207
	$mov eax, 5
207
	$mov eax, 5
208
	$int 0x40
208
	$int 0x40
209
}
209
}
210
 
210
 
211
inline fastcall word GetButtonID()
211
inline fastcall word GetButtonID()
212
{
212
{
213
	$mov eax,17
213
	$mov eax,17
214
	$int  0x40
214
	$int  0x40
215
	$shr eax,8
215
	$shr eax,8
216
}
216
}
217
 
217
 
218
inline fastcall dword GetFreeRAM()
218
inline fastcall dword GetFreeRAM()
219
{
219
{
220
	$mov eax, 18
220
	$mov eax, 18
221
	$mov ebx, 16
221
	$mov ebx, 16
222
	$int 0x40
222
	$int 0x40
223
	//return eax = ðàçìåð ñâîáîäíîé ïàìÿòè â êèëîáàéòàõ
223
	//return eax = ðàçìåð ñâîáîäíîé ïàìÿòè â êèëîáàéòàõ
224
}
224
}
225
 
225
 
226
inline void draw_line(dword x1,y1,x2,y2,color)
226
inline void draw_line(dword x1,y1,x2,y2,color)
227
{
227
{
228
	x2--;y2--;y1--;
228
	x2--;y2--;y1--;
229
	$mov EAX,38
229
	$mov EAX,38
230
	EBX = x1<<16;
230
	EBX = x1<<16;
231
	EBX |= x2;
231
	EBX |= x2;
232
	ECX = y1<<16;
232
	ECX = y1<<16;
233
	ECX |= y2;
233
	ECX |= y2;
234
	$mov EDX,color
234
	$mov EDX,color
235
	$int 0x40
235
	$int 0x40
236
}
236
}
237
 
237
 
238
inline fastcall dword LoadDriver(ECX) //ECX - èìÿ äðàéâåðà
238
inline fastcall dword LoadDriver(ECX) //ECX - èìÿ äðàéâåðà
239
{
239
{
240
	$mov eax, 68
240
	$mov eax, 68
241
	$mov ebx, 16
241
	$mov ebx, 16
242
	$int 0x40
242
	$int 0x40
243
	//return 0 - íåóäà÷à, èíà÷å eax = õýíäë äðàéâåðà 
243
	//return 0 - íåóäà÷à, èíà÷å eax = õýíäë äðàéâåðà 
244
}
244
}
245
 
245
 
246
inline fastcall dword RuleDriver(ECX) //óêàçàòåëü íà óïðàâëÿþùóþ ñòðóêòóðó
246
inline fastcall dword RuleDriver(ECX) //óêàçàòåëü íà óïðàâëÿþùóþ ñòðóêòóðó
247
{
247
{
248
	$mov eax, 68
248
	$mov eax, 68
249
	$mov ebx, 17
249
	$mov ebx, 17
250
	$int 0x40
250
	$int 0x40
251
	//return eax = îïðåäåëÿåòñÿ äðàéâåðîì
251
	//return eax = îïðåäåëÿåòñÿ äðàéâåðîì
252
}
252
}
253
 
253
 
254
struct proc_info
254
struct proc_info
255
{
255
{
256
	#define SelfInfo -1
256
	#define SelfInfo -1
257
	dword	use_cpu;
257
	dword	use_cpu;
258
	word	pos_in_stack,num_slot,rezerv1;
258
	word	pos_in_stack,num_slot,rezerv1;
259
	unsigned char name[11];
259
	unsigned char name[11];
260
	char	rezerv2;
260
	char	rezerv2;
261
	dword	adress,use_memory,ID,left,top,width,height;
261
	dword	adress,use_memory,ID,left,top,width,height;
262
	word	status_slot,rezerv3;
262
	word	status_slot,rezerv3;
263
	dword	work_left,work_top,work_width,work_height;
263
	dword	work_left,work_top,work_width,work_height;
264
	char	status_window;
264
	char	status_window;
265
	dword   cwidth,cheight;
265
	dword   cwidth,cheight;
266
	byte    reserved[1024-71-8];
266
	byte    reserved[1024-71-8];
267
};
267
};
268
 
268
 
269
inline fastcall void GetProcessInfo(EBX, ECX)
269
inline fastcall void GetProcessInfo(EBX, ECX)
270
{
270
{
271
	$mov eax,9;
271
	$mov eax,9;
272
	$int  0x40
272
	$int  0x40
273
	DSDWORD[EBX+71] = DSDWORD[EBX+42] - 9; //set cwidth
273
	DSDWORD[EBX+71] = DSDWORD[EBX+42] - 9; //set cwidth
274
	DSDWORD[EBX+75] = DSDWORD[EBX+46] - GetSkinHeight() - 4; //set cheight
274
	DSDWORD[EBX+75] = DSDWORD[EBX+46] - GetSkinHeight() - 4; //set cheight
275
}
275
}
276
 
276
 
277
inline fastcall int GetPointOwner( EBX, ECX) //ebx=m.x, ecx=m.y
277
inline fastcall int GetPointOwner( EBX, ECX) //ebx=m.x, ecx=m.y
278
{
278
{
279
	$mov eax,34
279
	$mov eax,34
280
	$int 0x40
280
	$int 0x40
281
}
281
}
282
 
282
 
283
inline fastcall int GetProcessSlot( ECX)
283
inline fastcall int GetProcessSlot( ECX)
284
{
284
{
285
	EAX = 18;
285
	EAX = 18;
286
	EBX = 21;
286
	EBX = 21;
287
	$int 0x40
287
	$int 0x40
288
}
288
}
289
 
289
 
290
inline fastcall int GetActiveProcess()
290
inline fastcall int GetActiveProcess()
291
{
291
{
292
	EAX = 18;
292
	EAX = 18;
293
	EBX = 7;
293
	EBX = 7;
294
	$int 0x40
294
	$int 0x40
295
}
295
}
296
 
296
 
297
:int CheckActiveProcess(int Form_ID)
297
:int CheckActiveProcess(int Form_ID)
298
{
298
{
299
	int id9=GetProcessSlot(Form_ID);
299
	int id9=GetProcessSlot(Form_ID);
300
	if (id9==GetActiveProcess()) return 1;
300
	if (id9==GetActiveProcess()) return 1;
301
	return 0;
301
	return 0;
302
}
302
}
303
 
303
 
304
inline fastcall void ActivateWindow( ECX)
304
inline fastcall void ActivateWindow( ECX)
305
{
305
{
306
	EAX = 18;
306
	EAX = 18;
307
	EBX = 3;
307
	EBX = 3;
308
	$int 0x40
308
	$int 0x40
309
}
309
}
310
 
310
 
311
inline fastcall int MinimizeWindow()
311
inline fastcall int MinimizeWindow()
312
{
312
{
313
	EAX = 18;
313
	EAX = 18;
314
	EBX = 10;
314
	EBX = 10;
315
	$int 0x40
315
	$int 0x40
316
}
316
}
317
 
317
 
318
inline fastcall int CreateThread(ECX,EDX)
318
inline fastcall int CreateThread(ECX,EDX)
319
{
319
{
320
	$mov eax,51
320
	$mov eax,51
321
	$mov ebx,1
321
	$mov ebx,1
322
	$int 0x40
322
	$int 0x40
323
}
323
}
324
 
324
 
325
inline fastcall void SwitchToAnotherThread()
325
inline fastcall void SwitchToAnotherThread()
326
{
326
{
327
	$mov eax,68
327
	$mov eax,68
328
	$mov ebx,1
328
	$mov ebx,1
329
	$int 0x40
329
	$int 0x40
330
}
330
}
331
 
331
 
332
inline fastcall int SendWindowMessage( ECX, EDX)
332
inline fastcall int SendWindowMessage( ECX, EDX)
333
{
333
{
334
	$mov eax, 72
334
	$mov eax, 72
335
	$mov ebx, 1
335
	$mov ebx, 1
336
	$int 0x40
336
	$int 0x40
337
}
337
}
338
 
338
 
339
inline fastcall int KillProcess( ECX)
339
inline fastcall int KillProcess( ECX)
340
{
340
{
341
	$mov eax,18;
341
	$mov eax,18;
342
	$mov ebx,18;
342
	$mov ebx,18;
343
	$int 0x40
343
	$int 0x40
344
}
344
}
345
 
345
 
346
#define TURN_OFF 2
346
#define TURN_OFF 2
347
#define REBOOT 3
347
#define REBOOT 3
348
#define KERNEL 4
348
#define KERNEL 4
349
inline fastcall int ExitSystem( ECX)
349
inline fastcall int ExitSystem( ECX)
350
{
350
{
351
	$mov eax, 18
351
	$mov eax, 18
352
	$mov ebx, 9
352
	$mov ebx, 9
353
	$int 0x40
353
	$int 0x40
354
}
354
}
355
 
355
 
356
inline fastcall ExitProcess()
356
inline fastcall ExitProcess()
357
{
357
{
358
	$mov eax,-1;
358
	$mov eax,-1;
359
	$int 0x40
359
	$int 0x40
360
}
360
}
361
 
361
 
362
//------------------------------------------------------------------------------
362
//------------------------------------------------------------------------------
363
 
363
 
364
//eax = ÿçûê ñèñòåìû (1=eng, 2=fi, 3=ger, 4=rus)
364
//eax = ÿçûê ñèñòåìû (1=eng, 2=fi, 3=ger, 4=rus)
365
inline fastcall int GetSystemLanguage()
365
inline fastcall int GetSystemLanguage()
366
{
366
{
367
	EAX = 26;
367
	EAX = 26;
368
	EBX = 5;
368
	EBX = 5;
369
	$int 0x40
369
	$int 0x40
370
}
370
}
371
 
371
 
372
inline fastcall GetSkinHeight()
372
inline fastcall GetSkinHeight()
373
{
373
{
374
	$push ebx
374
	$push ebx
375
	$mov  eax,48
375
	$mov  eax,48
376
	$mov  ebx,4
376
	$mov  ebx,4
377
	$int 0x40
377
	$int 0x40
378
	$pop  ebx
378
	$pop  ebx
379
}
379
}
380
 
380
 
381
inline fastcall void SetSystemSkin( ECX)
381
inline fastcall void SetSystemSkin( ECX)
382
{
382
{
383
	EAX = 48;
383
	EAX = 48;
384
	EBX = 8;
384
	EBX = 8;
385
	$int 0x40
385
	$int 0x40
386
}
386
}
387
 
387
 
388
inline fastcall int GetScreenWidth()
388
inline fastcall int GetScreenWidth()
389
{
389
{
390
	$mov eax, 14
390
	$mov eax, 14
391
	$int 0x40
391
	$int 0x40
392
	$shr eax, 16
392
	$shr eax, 16
393
}
393
}
394
 
394
 
395
inline fastcall int GetScreenHeight()
395
inline fastcall int GetScreenHeight()
396
{
396
{
397
	$mov eax, 14
397
	$mov eax, 14
398
	$int 0x40
398
	$int 0x40
399
	$and eax,0x0000FFFF
399
	$and eax,0x0000FFFF
400
}
400
}
401
 
401
 
402
inline fastcall int GetClientTop()
402
inline fastcall int GetClientTop()
403
{
403
{
404
	$mov eax, 48
404
	$mov eax, 48
405
	$mov ebx, 5
405
	$mov ebx, 5
406
	$int 0x40
406
	$int 0x40
407
    $mov eax, ebx
407
	$mov eax, ebx
408
    $shr eax, 16
408
	$shr eax, 16
409
}
409
}
410
 
410
 
411
inline fastcall int GetClientHeight()
411
inline fastcall int GetClientHeight()
412
{
412
{
413
	$mov eax, 48
413
	$mov eax, 48
414
	$mov ebx, 5
414
	$mov ebx, 5
415
	$int 0x40
415
	$int 0x40
416
    $mov eax, ebx
416
	$mov eax, ebx
417
}
417
}
418
 
418
 
419
 
419
 
420
inline fastcall dword LoadLibrary( ECX)
420
inline fastcall dword LoadLibrary( ECX)
421
{
421
{
422
	$mov eax, 68 
422
	$mov eax, 68 
423
	$mov ebx, 19
423
	$mov ebx, 19
424
	$int  0x40
424
	$int  0x40
425
}
425
}
426
 
426
 
427
inline fastcall int TestBit( EAX, CL)
427
inline fastcall int TestBit( EAX, CL)
428
{
428
{
429
	$shr eax,cl
429
	$shr eax,cl
430
	$and eax,1
430
	$and eax,1
431
}
431
}
432
 
432
 
433
inline fastcall int PlaySpeaker( ESI)
433
inline fastcall int PlaySpeaker( ESI)
434
{
434
{
435
	$mov eax, 55
435
	$mov eax, 55
436
	$mov ebx, 55
436
	$mov ebx, 55
437
	$int 0x40
437
	$int 0x40
438
}
438
}
439
 
-
 
440
inline fastcall void debugln( EDX)
-
 
441
{
-
 
442
	$push eax
-
 
443
	$push ebx
-
 
444
	$push ecx
-
 
445
	$mov eax, 63
-
 
446
	$mov ebx, 1
-
 
447
NEXT_CHAR:
-
 
448
	$mov ecx, DSDWORD[edx]
-
 
449
	$or	 cl, cl
-
 
450
	$jz  DONE
-
 
451
	$int 0x40
-
 
452
	$inc edx
-
 
453
	$jmp NEXT_CHAR
-
 
454
DONE:
-
 
455
	$mov cl, 13
-
 
456
	$int 0x40
-
 
457
	$mov cl, 10
-
 
458
	$int 0x40
-
 
459
	$pop ecx
-
 
460
	$pop ebx
-
 
461
	$pop eax
-
 
462
}
-
 
463
 
-
 
464
inline fastcall void debug( EDX)
-
 
465
{
-
 
466
	$push eax
-
 
467
	$push ebx
-
 
468
	$push ecx
-
 
469
	$mov eax, 63
-
 
470
	$mov ebx, 1
-
 
471
NEXT_CHAR:
-
 
472
	$mov ecx, DSDWORD[edx]
-
 
473
	$or	 cl, cl
-
 
474
	$jz  DONE
-
 
475
	$int 0x40
-
 
476
	$inc edx
-
 
477
	$jmp NEXT_CHAR
-
 
478
DONE:
-
 
479
	$pop ecx
-
 
480
	$pop ebx
-
 
481
	$pop eax
-
 
482
}
-
 
483
 
-
 
484
 
-
 
485
inline fastcall void debugch( ECX)
-
 
486
{
-
 
487
	$push eax
-
 
488
	$push ebx
-
 
489
	$mov eax,63
-
 
490
	$mov ebx,1
-
 
491
	$int 0x40
-
 
492
	$pop ebx
-
 
493
	$pop eax
-
 
494
}
439
 
495
//------------------------------------------------------------------------------
440
//------------------------------------------------------------------------------
496
 
441
 
497
void DefineAndDrawWindow(dword x, y, size_w, size_h, byte WindowType,dword WindowAreaColor, EDI, ESI)
442
void DefineAndDrawWindow(dword x, y, size_w, size_h, byte WindowType,dword WindowAreaColor, EDI, ESI)
498
{
443
{
499
	EAX = 12;              // function 12:tell os about windowdraw
444
	EAX = 12;              // function 12:tell os about windowdraw
500
	EBX = 1;
445
	EBX = 1;
501
	$int 0x40
446
	$int 0x40
502
	
447
	
503
	$xor EAX,EAX
448
	$xor EAX,EAX
504
	EBX = x << 16 + size_w; 
449
	EBX = x << 16 + size_w; 
505
	ECX = y << 16 + size_h;
450
	ECX = y << 16 + size_h;
506
 
451
 
507
	EDX = WindowType << 24 | WindowAreaColor;
452
	EDX = WindowType << 24 | WindowAreaColor;
508
	$int 0x40
453
	$int 0x40
509
 
454
 
510
	EAX = 12;              // function 12:tell os about windowdraw
455
	EAX = 12;              // function 12:tell os about windowdraw
511
	EBX = 2;
456
	EBX = 2;
512
	$int 0x40
457
	$int 0x40
513
}
458
}
514
 
459
 
515
inline fastcall MoveSize( EBX,ECX,EDX,ESI)
460
inline fastcall MoveSize( EBX,ECX,EDX,ESI)
516
{
461
{
517
	$mov eax, 67
462
	$mov eax, 67
518
	$int 0x40
463
	$int 0x40
519
}
464
}
520
 
465
 
521
inline fastcall void DrawTitle( ECX)
466
inline fastcall void DrawTitle( ECX)
522
{
467
{
523
	EAX = 71;
468
	EAX = 71;
524
	EBX = 1;
469
	EBX = 1;
525
	$int 0x40;
470
	$int 0x40;
526
}
471
}
527
 
472
 
528
void WriteTextB(dword x,y,byte fontType, dword color, EDX)
473
void WriteTextB(dword x,y,byte fontType, dword color, EDX)
529
{
474
{
530
	EAX = 4;
475
	EAX = 4;
531
	EBX = x<<16+y;
476
	EBX = x<<16+y;
532
	ECX = fontType<<24+color;
477
	ECX = fontType<<24+color;
533
	ESI = 0;
478
	ESI = 0;
534
	$int 0x40;
479
	$int 0x40;
535
	$add ebx, 1<<16
480
	$add ebx, 1<<16
536
	$int 0x40
481
	$int 0x40
537
}
482
}
538
 
483
 
539
void WriteText(dword x,y,byte fontType, dword color, EDX)
484
void WriteText(dword x,y,byte fontType, dword color, EDX)
540
{
485
{
541
	EAX = 4;
486
	EAX = 4;
542
	EBX = x<<16+y;
487
	EBX = x<<16+y;
543
	ECX = fontType<<24+color;
488
	ECX = fontType<<24+color;
544
	$int 0x40;
489
	$int 0x40;
545
}
490
}
546
 
491
 
547
dword WriteBufText(dword x,y,byte fontType, dword color, EDX, EDI)
492
dword WriteBufText(dword x,y,byte fontType, dword color, EDX, EDI)
548
{
493
{
549
	EAX = 4;
494
	EAX = 4;
550
	EBX = x<<16+y;
495
	EBX = x<<16+y;
551
	ECX = fontType<<24+color;
496
	ECX = fontType<<24+color;
552
	$int 0x40;
497
	$int 0x40;
553
}
498
}
554
 
499
 
555
void WriteNumber(dword x,y,byte fontType, dword color, count, ECX)
500
void WriteNumber(dword x,y,byte fontType, dword color, count, ECX)
556
{
501
{
557
	EAX = 47;
502
	EAX = 47;
558
	EBX = count<<16;
503
	EBX = count<<16;
559
	EDX = x<<16+y;
504
	EDX = x<<16+y;
560
	ESI = fontType<<24+color;
505
	ESI = fontType<<24+color;
561
	$int 0x40;
506
	$int 0x40;
562
}
507
}
563
 
508
 
564
void CopyScreen(dword EBX, x, y, w, h)
509
void CopyScreen(dword EBX, x, y, w, h)
565
{
510
{
566
  EAX = 36;
511
  EAX = 36;
567
  ECX = w << 16 + h;
512
  ECX = w << 16 + h;
568
  EDX = x << 16 + y;
513
  EDX = x << 16 + y;
569
  $int  0x40;
514
  $int  0x40;
570
}
515
}
571
 
516
 
572
:dword GetPixelColor(dword x, x_size, y)
517
:dword GetPixelColor(dword x, x_size, y)
573
{
518
{
574
	$mov eax, 35
519
	$mov eax, 35
575
	EBX= y*x_size+x;
520
	EBX= y*x_size+x;
576
	$int 0x40
521
	$int 0x40
577
}
522
}
578
 
523
 
579
 
524
 
580
void _PutImage(dword x,y, w,h, EBX)
525
void _PutImage(dword x,y, w,h, EBX)
581
{
526
{
582
	EAX = 7;
527
	EAX = 7;
583
	ECX = w<<16+h;
528
	ECX = w<<16+h;
584
	EDX = x<<16+y;
529
	EDX = x<<16+y;
585
	$int 0x40
530
	$int 0x40
586
}
531
}
587
 
532
 
588
void PutPaletteImage(dword EBX,w,h,x,y,ESI,EDI)
533
void PutPaletteImage(dword EBX,w,h,x,y,ESI,EDI)
589
{
534
{
590
	EAX = 65;
535
	EAX = 65;
591
	ECX = w<<16+h;
536
	ECX = w<<16+h;
592
	EDX = x<<16+y;
537
	EDX = x<<16+y;
593
	EBP = 0;
538
	EBP = 0;
594
	$int 0x40
539
	$int 0x40
595
} 
540
} 
596
 
541
 
597
inline fastcall void PutPixel( EBX,ECX,EDX)
542
inline fastcall void PutPixel( EBX,ECX,EDX)
598
{
543
{
599
  EAX=1;
544
  EAX=1;
600
  $int 0x40
545
  $int 0x40
601
}
546
}
602
 
547
 
603
void DrawBar(dword x,y,w,h,EDX)
548
void DrawBar(dword x,y,w,h,EDX)
604
{
549
{
605
	if (h<=0) || (h>60000) || (w<=0) || (w>60000) return; //bad boy :)
550
	if (h<=0) || (h>60000) || (w<=0) || (w>60000) return; //bad boy :)
606
	EAX = 13;
551
	EAX = 13;
607
	EBX = x<<16+w;
552
	EBX = x<<16+w;
608
	ECX = y<<16+h;
553
	ECX = y<<16+h;
609
 	$int 0x40
554
	$int 0x40
610
}
555
}
611
 
556
 
612
void DefineButton(dword x,y,w,h,EDX,ESI)
557
void DefineButton(dword x,y,w,h,EDX,ESI)
613
{
558
{
614
	EAX = 8;
559
	EAX = 8;
615
	$push edx
560
	$push edx
616
	EDX += BT_DEL;
561
	EDX += BT_DEL;
617
	$int 0x40;
562
	$int 0x40;
618
	$pop edx
563
	$pop edx
619
	EBX = x<<16+w;
564
	EBX = x<<16+w;
620
	ECX = y<<16+h;
565
	ECX = y<<16+h;
621
	$int 0x40
566
	$int 0x40
622
}
567
}
623
 
568
 
624
inline RefreshWindow(dword ID_REFRESH,ID_ACTIVE)
569
inline RefreshWindow(dword ID_REFRESH,ID_ACTIVE)
625
{
570
{
626
	EAX = 18;
571
	EAX = 18;
627
	EBX = 22;
572
	EBX = 22;
628
	ECX = 3;
573
	ECX = 3;
629
	EDX = ID_REFRESH;
574
	EDX = ID_REFRESH;
630
	$int 0x40
575
	$int 0x40
631
	EAX = 18;
576
	EAX = 18;
632
	EBX = 3;
577
	EBX = 3;
633
	EDX = ID_ACTIVE;
578
	EDX = ID_ACTIVE;
634
	$int 0x40
579
	$int 0x40
635
}
580
}
636
 
581
 
637
inline getIPC(ECX,EDX)
582
inline getIPC(ECX,EDX)
638
{
583
{
639
	$mov EAX,60
584
	$mov EAX,60
640
	$mov EBX,2
585
	$mov EBX,2
641
	$int 0x40
586
	$int 0x40
642
}
587
}
643
 
588
 
644
inline sendIPC(ECX,EDX,ESI)
589
inline sendIPC(ECX,EDX,ESI)
645
{
590
{
646
	$mov EAX,60
591
	$mov EAX,60
647
	$mov EBX,1
592
	$mov EBX,1
648
	$int 0x40
593
	$int 0x40
649
}
594
}
650
 
595
 
651
void UnsafeDefineButton(dword x,y,w,h,EDX,ESI)
596
void UnsafeDefineButton(dword x,y,w,h,EDX,ESI)
652
{
597
{
653
	EAX = 8;
598
	EAX = 8;
654
	EBX = x<<16+w;
599
	EBX = x<<16+w;
655
	ECX = y<<16+h;
600
	ECX = y<<16+h;
656
	$int 0x40
601
	$int 0x40
657
}
602
}
658
 
603
 
659
inline fastcall void DeleteButton( EDX)
604
inline fastcall void DeleteButton( EDX)
660
{
605
{
661
	EAX = 8;
606
	EAX = 8;
662
	EDX += BT_DEL;
607
	EDX += BT_DEL;
663
	$int 0x40
608
	$int 0x40
664
}
609
}
665
 
610
 
666
inline fastcall dword GetStartTime()
611
inline fastcall dword GetStartTime()
667
{
612
{
668
	$mov eax,26
613
	$mov eax,26
669
	$mov ebx,9
614
	$mov ebx,9
670
	$int 0x40
615
	$int 0x40
671
}
616
}
672
 
617
 
673
:dword X_EventRedrawWindow,Y_EventRedrawWindow;
618
:dword X_EventRedrawWindow,Y_EventRedrawWindow;
674
:void _EventRedrawWindow()
619
:void _EventRedrawWindow()
675
{
620
{
676
	loop()switch(WaitEvent())
621
	loop()switch(WaitEvent())
677
	{
622
	{
678
		case evReDraw:
623
		case evReDraw:
679
			DefineAndDrawWindow(X_EventRedrawWindow,Y_EventRedrawWindow,100,1,1,0x34,0xFFFFFF,"");
624
			DefineAndDrawWindow(X_EventRedrawWindow,Y_EventRedrawWindow,100,1,1,0x34,0xFFFFFF,"");
680
			pause(10);
625
			pause(10);
681
			ExitProcess();
626
			ExitProcess();
682
			break;
627
			break;
683
	}
628
	}
684
}
629
}
685
:char REDRAW_BUFF_EVENT_[4096];
630
:char REDRAW_BUFF_EVENT_[4096];
686
:void EventRedrawWindow(dword x,y)
631
:void EventRedrawWindow(dword x,y)
687
{
632
{
688
	X_EventRedrawWindow = x;
633
	X_EventRedrawWindow = x;
689
	Y_EventRedrawWindow = y;
634
	Y_EventRedrawWindow = y;
690
	CreateThread(#_EventRedrawWindow,#REDRAW_BUFF_EVENT_+4092);
635
	CreateThread(#_EventRedrawWindow,#REDRAW_BUFF_EVENT_+4092);
691
}
636
}
692
 
637
 
693
:dword ALERT_TEXT;
638
:dword ALERT_TEXT;
694
:void dialog_alert()
639
:void dialog_alert()
695
{
640
{
696
	byte id;
641
	byte id;
697
	loop()switch(WaitEvent())
642
	loop()switch(WaitEvent())
698
	{
643
	{
699
		case evReDraw:
644
		case evReDraw:
700
			DefineAndDrawWindow(215,100,250,200,0x34,0xFFFFFF,"Alert");
645
			DefineAndDrawWindow(215,100,250,200,0x34,0xFFFFFF,"Alert");
701
			WriteTextB(5,5,0x90,0x0,ALERT_TEXT);
646
			WriteTextB(5,5,0x90,0x0,ALERT_TEXT);
702
		break;
647
		break;
703
		case evKey:
648
		case evKey:
704
		case evButton:
649
		case evButton:
705
			id=GetButtonID();
650
			id=GetButtonID();
706
			if (id==1) ExitProcess();
651
			if (id==1) ExitProcess();
707
		break;
652
		break;
708
	}
653
	}
709
}
654
}
710
:dword alert(dword text)
655
:dword alert(dword text)
711
{
656
{
712
	dword mem = malloc(4096);
657
	dword mem = malloc(4096);
713
	ALERT_TEXT = text;
658
	ALERT_TEXT = text;
714
	CreateThread(#dialog_alert,mem+4092);
659
	CreateThread(#dialog_alert,mem+4092);
715
	return mem;
660
	return mem;
716
}
661
}
717
 
662
 
718
:struct _screen
663
:struct _screen
719
{
664
{
720
	dword width,height;
665
	dword width,height;
721
} screen;
666
} screen;
722
 
667
 
723
:byte skin_height;
668
:byte skin_height;
724
 
669
 
725
:void DrawDate(dword x, y, color, in_date)
670
:void DrawDate(dword x, y, color, in_date)
726
{
671
{
727
	//char text[15];
672
	//char text[15];
728
	EDI = in_date;
673
	EDI = in_date;
729
	EAX = 47;
674
	EAX = 47;
730
	EBX = 2<<16;
675
	EBX = 2<<16;
731
	EDX = x<<16+y;
676
	EDX = x<<16+y;
732
	ESI = 0x80<<24+color;
677
	ESI = 0x80<<24+color;
733
	ECX = EDI.date.day;
678
	ECX = EDI.date.day;
734
	$int 0x40;
679
	$int 0x40;
735
	EDX += 18<<16;
680
	EDX += 18<<16;
736
	ECX = EDI.date.month;
681
	ECX = EDI.date.month;
737
	$int 0x40;
682
	$int 0x40;
738
	EDX += 18<<16;
683
	EDX += 18<<16;
739
	EBX = 4<<16;
684
	EBX = 4<<16;
740
	ECX = EDI.date.year;
685
	ECX = EDI.date.year;
741
	$int 0x40;
686
	$int 0x40;
742
	PutPixel(x+14,y+6,color);
687
	PutPixel(x+14,y+6,color);
743
	PutPixel(x+32,y+6,color);
688
	PutPixel(x+32,y+6,color);
744
	//sprintf(#text,"%d",EDI.date.year);
689
	//sprintf(#text,"%d",EDI.date.year);
745
	//WriteText(x, y, 0x80, 0x000000, #text);
690
	//WriteText(x, y, 0x80, 0x000000, #text);
746
}
691
}
747
 
692
 
748
:void __path_name__(dword BUF,PATH)
693
:void __path_name__(dword BUF,PATH)
749
{
694
{
750
	dword beg = PATH;
695
	dword beg = PATH;
751
	dword pos = PATH;
696
	dword pos = PATH;
752
	dword sav = PATH;
697
	dword sav = PATH;
753
	dword i;
698
	dword i;
754
	while(DSBYTE[pos])
699
	while(DSBYTE[pos])
755
	{
700
	{
756
		if(DSBYTE[pos]=='/')sav = pos;
701
		if(DSBYTE[pos]=='/')sav = pos;
757
		pos++;
702
		pos++;
758
	}
703
	}
759
	i = sav-beg;
704
	i = sav-beg;
760
	while(i)
705
	while(i)
761
	{
706
	{
762
		DSBYTE[BUF] = DSBYTE[beg];
707
		DSBYTE[BUF] = DSBYTE[beg];
763
		beg++;
708
		beg++;
764
		BUF++;
709
		BUF++;
765
		i--;
710
		i--;
766
	}
711
	}
767
	/*while(DSBYTE[beg])
712
	/*while(DSBYTE[beg])
768
	{
713
	{
769
		DSBYTE[BUF1] = DSBYTE[beg];
714
		DSBYTE[BUF1] = DSBYTE[beg];
770
		beg++;
715
		beg++;
771
		BUF1++;
716
		BUF1++;
772
	}*/
717
	}*/
773
	//DSBYTE[BUF1] = 0;
718
	//DSBYTE[BUF1] = 0;
774
	DSBYTE[BUF] = 0;
719
	DSBYTE[BUF] = 0;
775
}
720
}
776
char __BUF_DIR__[4096];
721
char __BUF_DIR__[4096];
777
:struct SELF
722
:struct SELF
778
{
723
{
779
	dword dir;
724
	dword dir;
780
	dword file;
725
	dword file;
781
	dword path;
726
	dword path;
782
} self;
727
} self;
783
 
728
 
784
dword __generator;  // random number generator - äëÿ ãåíåðàöèè ñëó÷àéíûõ ÷èñåë
729
dword __generator;  // random number generator - äëÿ ãåíåðàöèè ñëó÷àéíûõ ÷èñåë
785
 
730
 
786
:dword program_path_length;
731
:dword program_path_length;
787
 
732
 
788
//The initialization of the initial data before running
733
//The initialization of the initial data before running
789
void ______INIT______()
734
void ______INIT______()
790
{
735
{
791
	self.dir = #__BUF_DIR__;
736
	self.dir = #__BUF_DIR__;
792
	self.file = 0;
737
	self.file = 0;
793
	self.path = I_Path;
738
	self.path = I_Path;
794
	__path_name__(#__BUF_DIR__,I_Path);
739
	__path_name__(#__BUF_DIR__,I_Path);
795
	
740
	
796
	skin_height   = GetSkinHeight();
741
	skin_height   = GetSkinHeight();
797
	screen.width  = GetScreenWidth();
742
	screen.width  = GetScreenWidth();
798
	screen.height = GetScreenHeight();
743
	screen.height = GetScreenHeight();
799
	
744
	
800
	//program_path_length = strlen(I_Path);
745
	//program_path_length = strlen(I_Path);
801
	DOUBLE_CLICK_DELAY = GetMouseDoubleClickDelay();
746
	DOUBLE_CLICK_DELAY = GetMouseDoubleClickDelay();
802
	__generator = GetStartTime();
747
	__generator = GetStartTime();
803
	
748
	
804
	mem_init();
749
	mem_init();
805
 
750
 
806
	main();
751
	main();
807
	ExitProcess();
752
	ExitProcess();
808
}
753
}
809
______STOP______:
754
______STOP______:
810
#endif
755
#endif
811
 
756
 
812
#ifndef INCLUDE_MEM_H
757
#ifndef INCLUDE_MEM_H
813
#include "../lib/mem.h"
758
#include "../lib/mem.h"
814
#endif
759
#endif
-
 
760
 
-
 
761
#ifndef INCLUDE_DEBUG_H
-
 
762
#include "../lib/debug.h"
-
 
763
#endif
815
>
764
>
816
>
765
>
817
>
766
>
818
>
767
>
819
>
768
>
820
>
769
>
821
>
770
>
822
>
771
>
823
>
772
>
824
>
773
>
825
>
774
>
826
>
775
>
827
>
776
>
828
>
777
>
829
>
778
>
830
>
779
>
831
>
780
>
832
>
781
>
833
>
782
>
834
>
783
>
835
>
784
>
836
>
785
>
837
>
786
>
838
>
787
>
839
>
788
>
840
>
789
>
841
>
790
>
842
>
791
>
843
>
792
>
844
>
793
>
845
>
794
>
846
>
795
>
847
>
796
>
848
>
797
>
849
>
798
>
850
>
799
>
851
>
800
>
852
>
801
>
853
>
802
>
854
>
803
>
855
>
804
>
856
>
805
>
857
>
806
>
858
>
807
>
859
>
808
>
860
>
809
>
861
>
810
>
862
>
811
>
863
>
812
>
864
>
813
>
865
>
814
>
866
>
815
>
867
>
816
>
868
>
817
>
869
>
818
>
870
>
819
>