Subversion Repositories Kolibri OS

Rev

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

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